Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit 7648ec3

Browse files
committed
Keep previous compiler_refs
1 parent 8a151e1 commit 7648ec3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/next_ls/runtime.ex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ defmodule NextLS.Runtime do
164164
%{
165165
name: name,
166166
working_dir: working_dir,
167-
compiler_ref: nil,
167+
compiler_refs: %{},
168168
port: port,
169169
task_supervisor: task_supervisor,
170170
logger: logger,
@@ -224,21 +224,21 @@ defmodule NextLS.Runtime do
224224
end
225225
end)
226226

227-
{:noreply, %{state | compiler_ref: %{task.ref => from}}}
227+
{:noreply, %{state | compiler_refs: Map.put(state.compiler_refs, task.ref, from)}}
228228
end
229229

230230
@impl GenServer
231-
def handle_info({ref, errors}, %{compiler_ref: compiler_ref} = state) when is_map_key(compiler_ref, ref) do
231+
def handle_info({ref, errors}, %{compiler_refs: compiler_refs} = state) when is_map_key(compiler_refs, ref) do
232232
Process.demonitor(ref, [:flush])
233233

234-
GenServer.reply(compiler_ref[ref], errors)
234+
GenServer.reply(compiler_refs[ref], errors)
235235

236-
{:noreply, %{state | compiler_ref: nil}}
236+
{:noreply, %{state | compiler_refs: Map.delete(compiler_refs, ref)}}
237237
end
238238

239-
def handle_info({:DOWN, ref, :process, _pid, _reason}, %{compiler_ref: compiler_ref} = state)
240-
when is_map_key(compiler_ref, ref) do
241-
{:noreply, %{state | compiler_ref: nil}}
239+
def handle_info({:DOWN, ref, :process, _pid, _reason}, %{compiler_refs: compiler_refs} = state)
240+
when is_map_key(compiler_refs, ref) do
241+
{:noreply, %{state | compiler_refs: Map.delete(compiler_refs, ref)}}
242242
end
243243

244244
def handle_info({:DOWN, _, :port, port, _}, %{port: port} = state) do

0 commit comments

Comments
 (0)