Skip to content

Commit b4dd201

Browse files
committed
fixup!: use persistent_term instead of adding .lsp to Project
1 parent 0be6594 commit b4dd201

File tree

18 files changed

+36
-35
lines changed

18 files changed

+36
-35
lines changed

apps/engine/benchmarks/ets_bench.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defmodule BenchHelper do
3333
end
3434

3535
cwd = __DIR__
36-
project = Project.new(%GenLSP.LSP{mod: :foo}, "file://#{cwd}")
36+
project = Project.new("file://#{cwd}")
3737

3838
Engine.set_project(project)
3939
Project.ensure_workspace(project)

apps/engine/test/engine/build/state_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ defmodule Engine.Build.StateTest do
4040

4141
project_name = to_string(project_name)
4242
fixture_dir = Path.join(fixtures_path(), project_name)
43-
project = Project.new(%GenLSP.LSP{mod: :foo}, "file://#{fixture_dir}")
43+
project = Project.new("file://#{fixture_dir}")
4444
state = State.new(project)
4545

4646
Engine.set_project(project)

apps/engine/test/engine/build_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ defmodule Engine.BuildTest do
3535
def with_project(project_name) do
3636
project_name = to_string(project_name)
3737
fixture_dir = Path.join(fixtures_path(), project_name)
38-
project = Project.new(%GenLSP.LSP{mod: :foo}, "file://#{fixture_dir}")
38+
project = Project.new("file://#{fixture_dir}")
3939

4040
project
4141
|> Project.workspace_path()

apps/engine/test/engine/plugin/runner/coordinator_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ defmodule Engine.Plugin.Runner.CoordinatorTest do
7777
end
7878

7979
test "works with projects" do
80-
project = Project.new(%GenLSP.LSP{mod: :foo}, "file://" <> __DIR__)
80+
project = Project.new("file://" <> __DIR__)
8181

8282
Runner.diagnose(project, notifier())
8383

apps/engine/test/remote_control_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule EngineTest do
2424
[fixtures_path(), "umbrella", "apps", "first"]
2525
|> Path.join()
2626
|> Document.Path.to_uri()
27-
|> then(&Project.new(%GenLSP.LSP{mod: :foo}, &1))
27+
|> then(&Project.new(&1))
2828

2929
start_project(subapp_project)
3030

apps/engine/test/support/test/fixtures.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule Engine.Test.Fixtures do
1515
|> Path.join()
1616
|> Path.expand()
1717
|> Forge.Document.Path.to_uri()
18-
|> then(&Project.new(%GenLSP.LSP{mod: :foo}, &1))
18+
|> then(&Project.new(&1))
1919
end
2020

2121
def project do

apps/expert/.iex.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ other_project =
1111
|> Path.join()
1212
|> Path.expand()
1313

14-
project = Forge.Project.new(%GenLSP.LSP{mod: :foo}, "file://#{other_project}")
14+
project = Forge.Project.new("file://#{other_project}")

apps/expert/lib/expert.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ defmodule Expert do
2424

2525
@dialyzer {:nowarn_function, apply_to_state: 2}
2626

27+
def get_lsp(), do: :persistent_term.get(:expert_lsp, nil)
28+
2729
def start_link(args) do
2830
Logger.debug(inspect(args))
2931

@@ -35,6 +37,7 @@ defmodule Expert do
3537
end
3638

3739
def init(lsp, _args) do
40+
:persistent_term.put(:expert_lsp, lsp)
3841
{:ok, assign(lsp, state: State.new())}
3942
end
4043

apps/expert/lib/expert/configuration.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ defmodule Expert.Configuration do
3030
@dialyzer {:nowarn_function, set_dialyzer_enabled: 2}
3131

3232
@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
33+
def new(root_uri, %Structures.ClientCapabilities{} = client_capabilities, client_name, _lsp) do
3434
support = Support.new(client_capabilities)
35-
project = Project.new(lsp, root_uri)
35+
project = Project.new(root_uri)
3636

3737
%__MODULE__{support: support, project: project, client_name: client_name}
3838
|> tap(&set/1)

apps/expert/lib/expert/iex/helpers.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ defmodule Expert.IEx.Helpers do
178178

179179
project_uri = "file://#{project_path}"
180180
# FIXME(mhanberg): unclear how we will get LSP struct here
181-
Forge.Project.new(%GenLSP.LSP{mod: :foo}, project_uri)
181+
Forge.Project.new(project_uri)
182182
end)
183183
end
184184

0 commit comments

Comments
 (0)