credo-language-server
credo-language-server copied to clipboard
timing out (another one)
Hi, my apologies for commenting on a closed issue! And thank you for all of your work on this project!
I'm having the same issue that @barkerja was having but the solution that worked for him does not appear to work for me.
[Error - 10:37:20 AM] Stopping server failed
Error: Stopping the server timed out
at /Users/mz/.vscode/extensions/elixir-tools.elixir-tools-0.2.2/dist/extension.js:2:150423
[Error - 10:37:20 AM] Stopping server failed
Error: Stopping the server timed out
at /Users/mz/.vscode/extensions/elixir-tools.elixir-tools-0.2.2/dist/extension.js:2:150423
[Error - 10:37:20 AM] Stopping server failed
Error: Stopping the server timed out
at /Users/mz/.vscode/extensions/elixir-tools.elixir-tools-0.2.2/dist/extension.js:2:150423
[Error - 10:37:20 AM] Client Credo: connection to server is erroring. Shutting down server.
I'll try to list out all applicable versions:
- vscode:
1.79.2
-
elixir-tools.vscode
:v0.2.2
- erlang:
24.3.4.8
- elixir:
1.14.2-otp-24
- credo:
1.6.4
and1.7.0
I've tried blowing away .elixir-tools
, _build
and deps
, mix local.hex --force
and mix local.rebar --force
, mix deps.get
and restarting vscode but it yields the same issue.
Also, I may very well be mistaken but it doesn't seem like using the excluded
field to exclode _build
and deps
even though those folders weren't included should do anything.
Mix.install([:credo])
defmodule Test do
def run do
not_excluded_config = %Credo.Execution{
cli_options: %Credo.CLI.Options{path: "."},
files: %{
included: ["lib/", "test/", "config/"],
excluded: []
}
}
excluded_config = %Credo.Execution{
cli_options: %Credo.CLI.Options{path: "."},
files: %{
included: ["lib/", "test/", "config/"],
excluded: [
~r"/_build/",
~r"/deps/"
]
}
}
excluded_count = excluded_config |> Credo.Sources.find() |> Enum.count()
not_excluded_count = not_excluded_config |> Credo.Sources.find() |> Enum.count()
IO.puts("excluded count: #{excluded_count}\nnot excluded count: #{not_excluded_count}")
end
end
Test.run()
This yields the same result for me.
Originally posted by @iautom8things in https://github.com/elixir-tools/credo-language-server/issues/67#issuecomment-1609768926
@iautom8things I created a new issue.
Can you share your .credo.exs file?
Hey, thank you for this. It's actually the same config (and project) that John was working on, we're teammates 🤜 🤛
%{
configs: [
%{
name: "default",
files: %{
included: ["lib/", "test/", "config/"],
excluded: []
},
checks: [
{Credo.Check.Refactor.Nesting, max_nesting: 3},
{Credo.Check.Refactor.Apply, false},
{Credo.Check.Refactor.MapInto, false},
{Credo.Check.Warning.LazyLogging, false},
{Credo.Check.Design.TagTODO, exit_status: 0}
]
}
]
}
And I just confirmed with @barkerj that the same thing is true for him: if we don't include the excluded: [ ~r"/_build/", ~r"/deps/" ]
we get the timeout error
ahh gotcha, i'll double check tonight if i can reproduce.
credo-language-server uses these command line flags under the hood ["--strict", "--all", "--working-dir", dir]
, with dir
being the root of your project.
you might check if mix credo --strict --all --working-dir .
works with your config
It seems like "./"
is somehow being added to the list of included:
dirs. I thought I had found something with how credo-language-server calls credo (what you just mentioned) but the --working-dir
flag does not seem to cause the behavior of credo taking a long time to run. I can, however, make it take about a minute by explicitly adding "./"
to the included:
list. That credo run looks like this:
Which if this is somehow happening by default via the language server, then it makes sense why explicitly excluding the deps/
folder would appear to fix our problem.
Though, I haven't figured out why credo would be trying to search the top level of the repo when called by credo-language-server.
so technically the ls is doing dir = /absolute/path/to/your/project
, could you try that instead of the dot .
?
That still seems to work as expected (it runs in < 3 seconds)
Can you try running iex iex -S mix run --no-start
and then doing Application.ensure_all_started(:credo)
and ["--strict", "--all", "--working-dir", File.cwd!()] |> Credo.run()
and then see what the included_dirs field is
With .credo.exs
excluded
config left empty, and running your suggested code:
iex(4)> ["--strict", "--all", "--working-dir", File.cwd!()] |> Credo.run() |> Map.get(:files)
%{
excluded: [],
included: ["lib/**/*.{ex,exs}", "test/**/*.{ex,exs}", "config/**/*.{ex,exs}"]
}
Sorry, lost track of the state of this.
This issue still needs action, correct?