Closed barkerja closed 1 year ago
Can you try it with normal vscode? It looks like you are using the insiders build
also, how long does running mix credo --all --strict
take from the command line?
Also what version of OTP?
Also is that all of the output? You said it finished compiling your project, did it ever emit any output about the runtime starting?
Can you try it with normal vscode?
I will try this shortly.
also, how long does running
mix credo --all --strict
take from the command line?
________________________________________________________
Executed in 2.87 secs fish external
usr time 16.25 secs 0.25 millis 16.25 secs
sys time 1.59 secs 1.88 millis 1.59 secs
Also what version of OTP?
24.3.4.8
Also is that all of the output?
That is all that output I see from the credo output in VSCode.
You said it finished compiling your project, did it ever emit any output about the runtime starting?
Not that I noticed. If it was output somewhere else, I may have missed it.
Same exact issue in VSCode 1.79.2
I installed those elixir and otp versions and got
** (RuntimeError) no shell process input given for yes?/2
(mix 1.14.2) lib/mix/shell/process.ex:148: Mix.Shell.Process.yes?/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:256: Mix.Tasks.Deps.Compile.handle_rebar_not_found/1
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:218: Mix.Tasks.Deps.Compile.do_rebar3/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:96: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:80: Mix.Tasks.Deps.Compile.compile/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:84: Mix.Tasks.Deps.Loadpaths.deps_check/2
[Error - 3:35:19 PM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:35:19 PM] Connection to server got closed. Server will restart.
true
[Error - 3:35:19 PM] Credo client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
** (RuntimeError) no shell process input given for yes?/2
(mix 1.14.2) lib/mix/shell/process.ex:148: Mix.Shell.Process.yes?/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:256: Mix.Tasks.Deps.Compile.handle_rebar_not_found/1
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:218: Mix.Tasks.Deps.Compile.do_rebar3/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:96: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:80: Mix.Tasks.Deps.Compile.compile/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:84: Mix.Tasks.Deps.Loadpaths.deps_check/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:43: Mix.Tasks.Deps.Loadpaths.run/1
[Error - 3:35:19 PM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:35:19 PM] Connection to server got closed. Server will restart.
true
[Error - 3:35:19 PM] Credo client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
** (RuntimeError) no shell process input given for yes?/2
(mix 1.14.2) lib/mix/shell/process.ex:148: Mix.Shell.Process.yes?/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:256: Mix.Tasks.Deps.Compile.handle_rebar_not_found/1
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:218: Mix.Tasks.Deps.Compile.do_rebar3/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:96: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:80: Mix.Tasks.Deps.Compile.compile/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:84: Mix.Tasks.Deps.Loadpaths.deps_check/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:43: Mix.Tasks.Deps.Loadpaths.run/1
[Error - 3:35:19 PM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:35:19 PM] Connection to server got closed. Server will restart.
true
[Error - 3:35:19 PM] Credo client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:35:19 PM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
** (RuntimeError) no shell process input given for yes?/2
(mix 1.14.2) lib/mix/shell/process.ex:148: Mix.Shell.Process.yes?/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:256: Mix.Tasks.Deps.Compile.handle_rebar_not_found/1
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:218: Mix.Tasks.Deps.Compile.do_rebar3/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:96: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:80: Mix.Tasks.Deps.Compile.compile/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:84: Mix.Tasks.Deps.Loadpaths.deps_check/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:43: Mix.Tasks.Deps.Loadpaths.run/1
[Error - 3:35:19 PM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 3:35:19 PM] Connection to server got closed. Server will restart.
true
[Error - 3:35:19 PM] Credo client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:35:19 PM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
** (RuntimeError) no shell process input given for yes?/2
(mix 1.14.2) lib/mix/shell/process.ex:148: Mix.Shell.Process.yes?/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:256: Mix.Tasks.Deps.Compile.handle_rebar_not_found/1
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:218: Mix.Tasks.Deps.Compile.do_rebar3/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:96: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
(elixir 1.14.2) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(mix 1.14.2) lib/mix/tasks/deps.compile.ex:80: Mix.Tasks.Deps.Compile.compile/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:84: Mix.Tasks.Deps.Loadpaths.deps_check/2
(mix 1.14.2) lib/mix/tasks/deps.loadpaths.ex:43: Mix.Tasks.Deps.Loadpaths.run/1
[Error - 3:35:20 PM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:35:20 PM] The Credo server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 3:35:20 PM] Credo client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:35:20 PM] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
Probably related to https://github.com/elixir-tools/credo-language-server/issues/66
can you try running mix local.rebar --force
in the terminal and then restart vscode?
can you try running
mix local.rebar --force
in the terminal and then restart vscode?
After doing that, and watching the credo
output, I saw this:
[Credo] LSP Initialized!
[Credo] Booting runtime...
... (compile stuff) ...
Then that output was cleared and the errors listed in my initial post occurred again.
I tried clearing out .elixir-tools/_build
-- but after initialization/compile, results in the issue.
okay, umbrella project?
does your project use any custom checks? any credo plugins or 3rd party checks?
what version of credo?
also, it would help if you could share the full output.
okay, umbrella project?
Negative
does your project use any custom checks? any credo plugins or 3rd party checks?
.credo.exs
configuration:
%{
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}
]
}
]
}
what version of credo?
1.6.4
also, it would help if you could share the full output.
Which full output are you referring to? The initial LSP initialization bit, or...?
If it's the former, I'm not sure what the best way to capture that is, as those logs are cleared immediately as I begin to receive the Stopping server failed
logs.
Are you saying that the scrollback doesn't go far enough? hmm
Can you try making the following change to your credo config? normally the default config has these exclude patterns in them.
%{
configs: [
%{
name: "default",
files: %{
included: ["lib/", "test/", "config/"],
- excluded: []
+ excluded: [~r"/_build/", ~r"/deps/"]
},
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}
]
}
]
}
Okay, i was able to reproduce the problem by copying your credo config into a project and using the same credo, elixir, and otp versions.
I will test later tonight to get an exact reason.
Thanks for your patience!
And i saw the output log clear itself as well, I understand what you meant now.
Thanks @mhanberg. Appreciate your work on these tools.
Can you try making the following change to your credo config? normally the default config has these exclude patterns in them.
%{ configs: [ %{ name: "default", files: %{ included: ["lib/", "test/", "config/"], - excluded: [] + excluded: [~r"/_build/", ~r"/deps/"] }, 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} ] } ] }
I just gave this a try, and had a successful start. So that does seem to be our issue here.
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:
1.79.2
elixir-tools.vscode
: v0.2.2
24.3.4.8
1.14.2-otp-24
1.6.4
and 1.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.
Can you make sure you are running credo-language-server 0.2.0? It should print what version it is in the output panel before you see the timeout errors.
It should auto update if you restart vscode, but I want to make sure.
Hmm ... Maybe I wasn't because now it's working. and I do see the credo-language-server 0.2.0
message.
Is the language server doing something different than what credo does, out-of-the-box? It doesn't make sense to me that the _build
and deps
folders need to be ignored since they weren't included via the included:
attribute. The elixir script I included shows what I'm talking about. Credo doesn't attempt to source files from those folders if they aren't included in the included:
attribute.
That was just a hypothesis.
The fix that I found last night was a timeout. Credo took longer than the configured timeout so I set it to infinity. Unrelated to the config thing.
Gotchya! Okay.
So you'd expect this to work with 0.2.0 without the changes to exclude _build
and deps
?
I am still getting a timeout error if I don't include that change.
I just installed v0.2.2. Watching the output for Credo, after my application fully compiles, I see the following error:
The connection to server is erroring. error continues to repeat indefinitely.
Environment:
Elixir 1.14.2 (compiled with Erlang/OTP 24)
If there is more info I can provide, please let me know how to do so! 🙏🏻