Skip to content

Commit d200ed5

Browse files
committed
fixup!: fix dialyzer issues
1 parent b4dd201 commit d200ed5

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

apps/expert/lib/expert.ex

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ defmodule Expert do
4545
state = assigns(lsp).state
4646
Process.send_after(self(), :default_config, :timer.seconds(5))
4747

48-
case State.initialize(state, request, lsp) do
48+
case State.initialize(state, request) do
4949
{:ok, response, state} ->
5050
# TODO: this should be gated behind the dynamic registration in the initialization params
5151
registrations = registrations()
@@ -153,18 +153,20 @@ defmodule Expert do
153153
end
154154
end
155155

156-
def handle_info(:default_config, %State{configuration: nil} = state) do
157-
Logger.warning(
158-
"Did not receive workspace/didChangeConfiguration notification after 5 seconds. " <>
159-
"Using default settings."
160-
)
156+
def handle_info(:default_config, lsp) do
157+
state = assigns(lsp).state
161158

162-
{:ok, config} = State.default_configuration(state)
163-
{:noreply, %State{state | configuration: config}}
164-
end
159+
if state.configuration == nil do
160+
Logger.warning(
161+
"Did not receive workspace/didChangeConfiguration notification after 5 seconds. " <>
162+
"Using default settings."
163+
)
165164

166-
def handle_info(:default_config, %State{} = state) do
167-
{:noreply, state}
165+
{:ok, config} = State.default_configuration(state)
166+
{:noreply, assign(lsp, state: %State{state | configuration: config})}
167+
else
168+
{:noreply, lsp}
169+
end
168170
end
169171

170172
defp apply_to_state(%State{} = state, %{} = request_or_notification) do

apps/expert/lib/expert/configuration.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ defmodule Expert.Configuration do
2929

3030
@dialyzer {:nowarn_function, set_dialyzer_enabled: 2}
3131

32-
@spec new(Forge.uri(), map(), String.t() | nil, GenLSP.Lsp.t()) :: t
33-
def new(root_uri, %Structures.ClientCapabilities{} = client_capabilities, client_name, _lsp) do
32+
@spec new(Forge.uri(), map(), String.t() | nil) :: t
33+
def new(root_uri, %Structures.ClientCapabilities{} = client_capabilities, client_name) do
3434
support = Support.new(client_capabilities)
3535
project = Project.new(root_uri)
3636

apps/expert/lib/expert/state.ex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ defmodule Expert.State do
4040
%__MODULE__{initialized?: false} = state,
4141
%Requests.Initialize{
4242
params: %Structures.InitializeParams{} = event
43-
},
44-
lsp
43+
}
4544
) do
4645
client_name =
4746
case event.client_info do
4847
%{name: name} -> name
4948
_ -> nil
5049
end
5150

52-
config = Configuration.new(event.root_uri, event.capabilities, client_name, lsp)
51+
config = Configuration.new(event.root_uri, event.capabilities, client_name)
5352
new_state = %__MODULE__{state | configuration: config, initialized?: true}
5453
Logger.info("Starting project at uri #{config.project.root_uri}")
5554

apps/expert/mix.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ defmodule Expert.MixProject do
4444
Mix.Dialyzer.dependency(),
4545
{:elixir_sense,
4646
github: "elixir-lsp/elixir_sense", ref: "73ce7e0d239342fb9527d7ba567203e77dbb9b25"},
47+
{:engine, path: "../engine", env: Mix.env()},
48+
{:forge, path: "../forge", env: Mix.env()},
49+
{:gen_lsp, github: "elixir-tools/gen_lsp", branch: "async"},
4750
{:jason, "~> 1.4"},
4851
{:logger_file_backend, "~> 0.0", only: [:dev, :prod]},
4952
{:patch, "~> 0.15", runtime: false, only: [:dev, :test]},
5053
{:path_glob, "~> 0.2"},
5154
{:schematic, "~> 0.2"},
52-
{:engine, path: "../engine", env: Mix.env()},
53-
{:gen_lsp, github: "elixir-tools/gen_lsp", branch: "async"},
5455
{:sourceror, "~> 1.9"}
5556
]
5657
end

0 commit comments

Comments
 (0)