-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create the symbol table in the workspace path
- Loading branch information
Showing
9 changed files
with
157 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule NextLS.Runtime.Sidecar do | ||
@moduledoc false | ||
use GenServer | ||
|
||
alias NextLS.SymbolTable | ||
|
||
def start_link(args) do | ||
GenServer.start_link(__MODULE__, Keyword.take(args, [:symbol_table]), Keyword.take(args, [:name])) | ||
end | ||
|
||
def init(args) do | ||
symbol_table = Keyword.fetch!(args, :symbol_table) | ||
{:ok, %{symbol_table: symbol_table}} | ||
end | ||
|
||
def handle_info({:tracer, payload}, state) do | ||
SymbolTable.put_symbols(state.symbol_table, payload) | ||
{:noreply, state} | ||
end | ||
|
||
def handle_info({{:tracer, :reference}, payload}, state) do | ||
SymbolTable.put_reference(state.symbol_table, payload) | ||
{:noreply, state} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule NextLS.Runtime.Supervisor do | ||
@moduledoc false | ||
|
||
use Supervisor | ||
|
||
def start_link(init_arg) do | ||
Supervisor.start_link(__MODULE__, init_arg) | ||
end | ||
|
||
@impl true | ||
def init(init_arg) do | ||
name = init_arg[:name] | ||
registry = init_arg[:registry] | ||
hidden_folder = init_arg[:path] | ||
File.mkdir_p!(hidden_folder) | ||
File.write!(Path.join(hidden_folder, ".gitignore"), "*\n") | ||
|
||
symbol_table_name = :"symbol-table-#{name}" | ||
sidecar_name = :"sidecar-#{name}" | ||
|
||
children = [ | ||
{NextLS.SymbolTable, workspace: name, path: hidden_folder, registry: registry, name: symbol_table_name}, | ||
{NextLS.Runtime.Sidecar, name: sidecar_name, symbol_table: symbol_table_name}, | ||
{NextLS.Runtime, init_arg[:runtime] ++ [name: name, registry: registry, parent: sidecar_name]} | ||
] | ||
|
||
Supervisor.init(children, strategy: :one_for_one) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.