From ae40661aa36d88d577314a954f98997a99fa5a8f Mon Sep 17 00:00:00 2001 From: Lukasz Samson Date: Wed, 18 May 2022 19:07:02 +0200 Subject: [PATCH] do not consider changes in .elixir-ls and _build dirs when deciding id rebuild is necessary Fixes https://github.com/elixir-lsp/elixir-ls/issues/686 --- apps/language_server/lib/language_server/server.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/language_server/lib/language_server/server.ex b/apps/language_server/lib/language_server/server.ex index e5e9d27c7..c9bf9261f 100644 --- a/apps/language_server/lib/language_server/server.ex +++ b/apps/language_server/lib/language_server/server.ex @@ -407,7 +407,11 @@ defmodule ElixirLS.LanguageServer.Server do Enum.any?(changes, fn %{"uri" => uri = "file:" <> _, "type" => type} -> path = SourceFile.path_from_uri(uri) - Path.extname(path) in (additional_watched_extensions ++ @default_watched_extensions) and + relative_path = Path.relative_to(path, state.project_dir) + first_path_segment = relative_path |> Path.split() |> hd + + first_path_segment not in [".elixir_ls", "_build"] and + Path.extname(path) in (additional_watched_extensions ++ @default_watched_extensions) and (type in [1, 3] or not Map.has_key?(state.source_files, uri) or state.source_files[uri].dirty?) end)