Skip to content

Commit 24d9915

Browse files
lud-wjmhanberg
andauthored
fix: add .gitignore file to .elixir-tools directory (#113)
Co-authored-by: Mitchell Hanberg <[email protected]>
1 parent 43177f4 commit 24d9915

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ Using eglot:
4646

4747
## Installation
4848

49-
The preferred way to use NextLS is through one of the supported editor extensions.
49+
The preferred way to use Next LS is through one of the supported editor extensions.
5050

51-
If you need to install NextLS on it's own, you can download the executable hosted by the GitHub release. The executable is an Elixir script that utilizes `Mix.install/2`.
51+
If you need to install Next LS on it's own, you can download the executable hosted by the GitHub release. The executable is an Elixir script that utilizes `Mix.install/2`.
5252

5353
### Note
5454

55-
NextLS creates an `.elixir-tools` hidden directory in your project.
56-
57-
This should be added to your project's `.gitignore`.
55+
Next LS creates an `.elixir-tools` hidden directory in your project, but it will be automatically ignored by `git`.

lib/next_ls/lsp_supervisor.ex

+8-1
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,20 @@ defmodule NextLS.LSPSupervisor do
5151
raise OptionsError, invalid
5252
end
5353

54+
# FIXME: this directory should be inside the workspace, which will is not determined until
55+
# the LSP has begun initialization
56+
# The symbol table may need to started dynamically, like the extensions and the runtimes
57+
hidden_folder = Path.expand(".elixir-tools")
58+
File.mkdir_p!(hidden_folder)
59+
File.write!(Path.join(hidden_folder, ".gitignore"), "*\n")
60+
5461
children = [
5562
{DynamicSupervisor, name: NextLS.DynamicSupervisor},
5663
{Task.Supervisor, name: NextLS.TaskSupervisor},
5764
{Task.Supervisor, name: :runtime_task_supervisor},
5865
{GenLSP.Buffer, buffer_opts},
5966
{NextLS.DiagnosticCache, name: :diagnostic_cache},
60-
{NextLS.SymbolTable, name: :symbol_table, path: Path.expand(".elixir-tools")},
67+
{NextLS.SymbolTable, name: :symbol_table, path: hidden_folder},
6168
{Registry, name: NextLS.ExtensionRegistry, keys: :duplicate},
6269
{NextLS,
6370
cache: :diagnostic_cache,

lib/next_ls/symbol_table.ex

-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ defmodule NextLS.SymbolTable do
3939
symbol_table_name = Keyword.get(args, :symbol_table_name, :symbol_table)
4040
reference_table_name = Keyword.get(args, :reference_table_name, :reference_table)
4141

42-
File.mkdir_p!(path)
43-
4442
{:ok, name} =
4543
:dets.open_file(symbol_table_name,
4644
file: Path.join(path, "symbol_table.dets") |> String.to_charlist(),

0 commit comments

Comments
 (0)