Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions apps/expert/lib/expert.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ defmodule Expert do
GenLSP.Notifications.TextDocumentDidOpen,
GenLSP.Notifications.TextDocumentDidSave,
GenLSP.Notifications.Exit,
GenLSP.Notifications.Initialized,
GenLSP.Requests.Shutdown
]

Expand Down Expand Up @@ -47,13 +46,6 @@ defmodule Expert do

case State.initialize(state, request) do
{:ok, response, state} ->
# TODO: this should be gated behind the dynamic registration in the initialization params
registrations = registrations()

if nil != GenLSP.request(lsp, registrations) do
Logger.error("Failed to register capability")
end

lsp = assign(lsp, state: state)
{:ok, response} = Forge.Protocol.Convert.to_lsp(response)

Expand Down Expand Up @@ -119,6 +111,16 @@ defmodule Expert do
end
end

def handle_notification(%GenLSP.Notifications.Initialized{}, lsp) do
registrations = registrations()

if nil != GenLSP.request(lsp, registrations) do
Logger.error("Failed to register capability")
end

{:noreply, lsp}
end

def handle_notification(%mod{} = notification, lsp) when mod in @server_specific_messages do
with {:ok, notification} <- Convert.to_native(notification),
{:ok, state} <- apply_to_state(assigns(lsp).state, notification) do
Expand Down
3 changes: 2 additions & 1 deletion apps/expert/lib/expert/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ defmodule Expert.State do

response = initialize_result()

Project.Supervisor.start(config.project)
Task.start_link(fn -> Project.Supervisor.start(config.project) end)

{:ok, response, new_state}
end

Expand Down
Loading