Skip to content
Open
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
2 changes: 0 additions & 2 deletions apps/expert/lib/expert/state.ex
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ defmodule Expert.State do
GenLSP.request(Expert.get_lsp(), request)
{:ok, %__MODULE__{state | configuration: config}}
end

{:ok, state}
end

def apply(%__MODULE__{} = state, %GenLSP.Notifications.TextDocumentDidChange{params: params}) do
Expand Down
26 changes: 26 additions & 0 deletions apps/expert/test/expert_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,32 @@ defmodule Expert.ExpertTest do

import Expert.Test.Protocol.TransportSupport

describe "workspace/didChangeConfiguration" do
test "updates configuration when settings change" do
with_patched_transport()

patch(Expert.Dialyzer, :check_support, :ok)

project = Fixtures.project()
lsp = initialize_lsp(project)

# dialyzer_enabled? defaults to false
assert GenLSP.Assigns.get(lsp.assigns).state.configuration.dialyzer_enabled? == false

did_change_config = %GenLSP.Notifications.WorkspaceDidChangeConfiguration{
jsonrpc: "2.0",
method: "workspace/didChangeConfiguration",
params: %GenLSP.Structures.DidChangeConfigurationParams{
settings: %{"dialyzerEnabled" => true}
}
}

assert {:noreply, updated_lsp} = Expert.handle_notification(did_change_config, lsp)

assert GenLSP.Assigns.get(updated_lsp.assigns).state.configuration.dialyzer_enabled? == true
end
end

test "sends an error message on engine initialization error" do
with_patched_transport()

Expand Down
Loading