Skip to content

Commit 997f2ac

Browse files
committed
do not use starts_with? to check if file is in dir
it returns false positives if dir name is a prefix of file name
1 parent f42fa99 commit 997f2ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/language_server/lib/language_server/dialyzer.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
defmodule ElixirLS.LanguageServer.Dialyzer do
2-
alias ElixirLS.LanguageServer.{JsonRpc, Server}
2+
alias ElixirLS.LanguageServer.{JsonRpc, Server, SourceFile}
33
alias ElixirLS.LanguageServer.Dialyzer.{Manifest, Analyzer, Utils, SuccessTypings}
44
import Utils
55
use GenServer
@@ -490,7 +490,8 @@ defmodule ElixirLS.LanguageServer.Dialyzer do
490490
end
491491

492492
defp in_project?(path, project_dir) do
493-
File.exists?(path) and String.starts_with?(Path.absname(path), project_dir)
493+
# TODO return false for deps Mix.Project.config()[:deps_path]
494+
File.exists?(path) and SourceFile.Path.path_in_dir?(Path.absname(path), project_dir)
494495
end
495496

496497
defp module_md5(file) do

0 commit comments

Comments
 (0)