Skip to content

Commit 63ceee1

Browse files
committed
Merge main
1 parent 3ba3c91 commit 63ceee1

File tree

15 files changed

+62
-30
lines changed

15 files changed

+62
-30
lines changed

apps/engine/lib/engine/engine.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ defmodule Engine do
119119
end
120120

121121
def manager_node_name(%Project{} = project) do
122-
workspace = Lexical.Workspace.get_workspace()
122+
workspace = Forge.Workspace.get_workspace()
123123

124124
workspace_name =
125125
case workspace do
126126
nil -> Project.name(project)
127-
_ -> Lexical.Workspace.name(workspace)
127+
_ -> Forge.Workspace.name(workspace)
128128
end
129129

130130
:"manager-#{workspace_name}-#{Project.entropy(project)}@127.0.0.1"

apps/expert/lib/expert.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ defmodule Expert do
127127
def handle_message(%_{} = request, %State{} = state) do
128128
with {:ok, handler} <- fetch_handler(request),
129129
{:ok, request} <- Convert.to_native(request) do
130-
# Logger.info("Handling request: #{inspect(request, pretty: true)}")
131-
132130
TaskQueue.add(request.id, {handler, :handle, [request, state.configuration]})
133131
else
134132
{:error, {:unhandled, _}} ->

apps/expert/lib/expert/configuration.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ defmodule Expert.Configuration do
4444
end
4545

4646
defp find_projects(root_uri) do
47-
root_path = Lexical.Document.Path.from_uri(root_uri)
47+
root_path = Forge.Document.Path.from_uri(root_uri)
4848
root_mix_exs = Path.join(root_path, "mix.exs")
4949

5050
projects =
@@ -65,7 +65,7 @@ defmodule Expert.Configuration do
6565
project_uri =
6666
mix_exs_path
6767
|> Path.dirname()
68-
|> Lexical.Document.Path.to_uri()
68+
|> Forge.Document.Path.to_uri()
6969

7070
Project.new(project_uri)
7171
end

apps/expert/lib/expert/provider/handlers/code_action.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule Expert.Provider.Handlers.CodeAction do
22
alias Engine.CodeAction
33
alias Expert.Configuration
4+
alias Forge.Project
45
alias Forge.Protocol.Response
56
alias GenLSP.Requests
67
alias GenLSP.Structures
@@ -11,11 +12,12 @@ defmodule Expert.Provider.Handlers.CodeAction do
1112
%Configuration{} = config
1213
) do
1314
document = Forge.Document.Container.context_document(params, nil)
15+
project = Project.project_for_document(config.projects, document)
1416
diagnostics = Enum.map(params.context.diagnostics, &to_code_action_diagnostic/1)
1517

1618
code_actions =
1719
Engine.Api.code_actions(
18-
config.project,
20+
project,
1921
document,
2022
params.range,
2123
diagnostics,

apps/expert/lib/expert/provider/handlers/code_lens.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ defmodule Expert.Provider.Handlers.CodeLens do
1616
%Requests.TextDocumentCodeLens{params: %Structures.CodeLensParams{} = params} = request,
1717
%Configuration{} = config
1818
) do
19-
project = Project.project_for_document(config.projects, request.document)
19+
document = Document.Container.context_document(params, nil)
20+
project = Project.project_for_document(config.projects, document)
2021

2122
document = Document.Container.context_document(params, nil)
2223

2324
lenses =
24-
case reindex_lens(project, request.document) do
25+
case reindex_lens(project, document) do
2526
nil -> []
2627
lens -> List.wrap(lens)
2728
end

apps/expert/lib/expert/provider/handlers/completion.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ defmodule Expert.Provider.Handlers.Completion do
44
alias Forge.Ast
55
alias Forge.Document
66
alias Forge.Document.Position
7+
alias Forge.Project
78
alias Forge.Protocol.Response
89
alias GenLSP.Enumerations.CompletionTriggerKind
910
alias GenLSP.Requests
@@ -19,10 +20,11 @@ defmodule Expert.Provider.Handlers.Completion do
1920
%Configuration{} = config
2021
) do
2122
document = Document.Container.context_document(params, nil)
23+
project = Project.project_for_document(config.projects, document)
2224

2325
completions =
2426
CodeIntelligence.Completion.complete(
25-
config.project,
27+
project,
2628
document_analysis(document, params.position),
2729
params.position,
2830
params.context || %CompletionContext{trigger_kind: CompletionTriggerKind.invoked()}

apps/expert/lib/expert/provider/handlers/document_symbols.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ defmodule Expert.Provider.Handlers.DocumentSymbols do
33
alias Engine.CodeIntelligence.Symbols
44
alias Expert.Configuration
55
alias Forge.Document
6+
alias Forge.Project
67
alias Forge.Protocol.Response
78
alias GenLSP.Enumerations.SymbolKind
89
alias GenLSP.Requests
910
alias GenLSP.Structures
1011

1112
def handle(%Requests.TextDocumentDocumentSymbol{} = request, %Configuration{} = config) do
1213
document = Document.Container.context_document(request.params, nil)
14+
project = Project.project_for_document(config.projects, document)
1315

1416
symbols =
15-
config.project
17+
project
1618
|> Api.document_symbols(document)
1719
|> Enum.map(&to_response(&1, document))
1820

apps/expert/lib/expert/provider/handlers/find_references.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ defmodule Expert.Provider.Handlers.FindReferences do
33
alias Expert.Configuration
44
alias Forge.Ast
55
alias Forge.Document
6+
alias Forge.Project
67
alias Forge.Protocol.Response
78
alias GenLSP.Requests.TextDocumentReferences
89
alias GenLSP.Structures
@@ -14,12 +15,13 @@ defmodule Expert.Provider.Handlers.FindReferences do
1415
%Configuration{} = config
1516
) do
1617
document = Forge.Document.Container.context_document(params, nil)
18+
project = Project.project_for_document(config.projects, document)
1719
include_declaration? = !!params.context.include_declaration
1820

1921
locations =
2022
case Document.Store.fetch(document.uri, :analysis) do
2123
{:ok, _document, %Ast.Analysis{} = analysis} ->
22-
Api.references(config.project, analysis, params.position, include_declaration?)
24+
Api.references(project, analysis, params.position, include_declaration?)
2325

2426
_ ->
2527
nil

apps/expert/lib/expert/provider/handlers/formatting.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule Expert.Provider.Handlers.Formatting do
22
alias Expert.Configuration
33
alias Forge.Document.Changes
4+
alias Forge.Project
45
alias Forge.Protocol.Response
56
alias GenLSP.Requests
67
alias GenLSP.Structures
@@ -13,8 +14,9 @@ defmodule Expert.Provider.Handlers.Formatting do
1314
%Configuration{} = config
1415
) do
1516
document = Forge.Document.Container.context_document(params, nil)
17+
project = Project.project_for_document(config.projects, document)
1618

17-
case Engine.Api.format(config.project, document) do
19+
case Engine.Api.format(project, document) do
1820
{:ok, %Changes{} = document_edits} ->
1921
response = %Response{id: request.id, result: document_edits}
2022
{:reply, response}

apps/expert/lib/expert/provider/handlers/go_to_definition.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
defmodule Expert.Provider.Handlers.GoToDefinition do
22
alias Expert.Configuration
3+
alias Forge.Project
34
alias Forge.Protocol.Response
45
alias GenLSP.Requests
56
alias GenLSP.Structures
@@ -13,8 +14,9 @@ defmodule Expert.Provider.Handlers.GoToDefinition do
1314
%Configuration{} = config
1415
) do
1516
document = Forge.Document.Container.context_document(params, nil)
17+
project = Project.project_for_document(config.projects, document)
1618

17-
case Engine.Api.definition(config.project, document, params.position) do
19+
case Engine.Api.definition(project, document, params.position) do
1820
{:ok, native_location} ->
1921
{:reply, %Response{id: request.id, result: native_location}}
2022

0 commit comments

Comments
 (0)