Skip to content

Commit

Permalink
feat: log version when initialized (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhanberg authored Jun 27, 2023
1 parent 909207b commit c4f0cac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 11 additions & 1 deletion lib/credo_language_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ defmodule CredoLanguageServer do

@impl true
def handle_notification(%Initialized{}, lsp) do
GenLSP.log(lsp, "[Credo] LSP Initialized!")
GenLSP.log(
lsp,
"[Credo] Credo Language Server v#{version()} Initialized!"
)

token =
8
Expand Down Expand Up @@ -443,4 +446,11 @@ defmodule CredoLanguageServer do
wait_until(n - 1, cb)
end
end

defp version() do
case :application.get_key(:credo_language_server, :vsn) do
{:ok, version} -> to_string(version)
_ -> "dev"
end
end
end
9 changes: 4 additions & 5 deletions test/credo_language_server_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ defmodule CredoLanguageServerTest do
params: %{}
})

assert_notification "window/logMessage",
%{
"message" => "[Credo] LSP Initialized!",
"type" => 4
}
assert_notification "window/logMessage", %{
"message" => "[Credo] Credo Language Server v" <> _,
"type" => 4
}

assert_notification "$/progress", %{"value" => %{"kind" => "begin"}}

Expand Down

0 comments on commit c4f0cac

Please sign in to comment.