-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solargraph not using Rubocop reporter #2623
Comments
You will get better logs if you run |
Weird, I thought I did that. Sorry about that! Anyway, I tried to reproduce this on a minimal example in a github repo now, and this is my log when running New log: ~/.cache/helix/helix.log
(I tried on a different computer (one running Fedora Silverblue) now. No difference.) |
Okay, everything looks fine but it seems that solargraph needs a config option to enable diagnostics: Could you try adding this to your local helix config? [[language]]
name = "ruby"
config = { solargraph = { diagnostics = true, formatting = true } } If it works let me know and we'll add it to the built-in languages.toml |
I actually remember now having to set diagnostics true manually for coc-solargraph on nvim years ago, it didn't occur to me to check this, sorry! So I put those lines in languages.toml and here are my findings:
Thank you so much for your help! |
Can you tail the log in verbose mode and post what it says when you trigger formatting? |
Sure! .cache/helix/helix.log
EDIT: Updated with new log because the first one had some bundler errors that were red herrings. After rerunning bundle install, the bundler error is gone, but it still doesn't work. |
I don't see the formatting request happening. There should be a log that starts with something like
triggered by |
@evenreven I guess |
With |
@the-mikedavis It's the entire log. I've tried and retried and run here's another log that's more or less identical, just to prove to myself that I didn't do anything weird the last time
For comparison, here's the log when (successfully) running Log for hx -vvv test.js
|
But Helix doesn't show any error at all, that's the problem. It acts like everything is fine. Only Neovim (running the same Solargraph/Rubocop versions) shows the error. VS Code shows the error too, and I verified that it's running as Solargraph extension, i.e. with Rubocop running as a Solargraph reporter, not as a separate VS Code extension. The more I'm looking into this point, I think it might be a separate bug? Here's the helix log when opening the file with the missing end: .cache/helix/helix.log
Look at the last line in particular. The rubocop message is present in the log, but doesn't appear in the on-screen diagnostics in Helix. I don't know Rust or the innards of Helix, so I'm not sure what |
Yep, the diagnostic is discarded because the range given by Solargraph was considered out of document range by us. I'm taking a look. |
does the diagnostic appear if you add some more content at the end of the file? Is it incorrectly positioned in that case? |
Adding more content didn't help, but I managed to get the diagnostic to appear when I removed the blank newline at the end of the file. So it seems that's the problem. |
So to recap, this is actually three issues:
Thanks for the prompt and helpful responses so far, @archseer, @the-mikedavis and @danillos, I really appreciate it! |
I've been using Helix some more and I think my description of the issue(s) in the previous comment is correct. I'm sorry I don't know enough to help this along. If I can do any more by testing various stuff, let me know. |
Same issue here! Adding the config mentioned above to my languages.toml file enabled reporting from solargraph, but the :format command still doesn't seem to call the lsp formatting action. |
Y'all could use the new non-LSP formatter config, I just added instructions for Rubocop n StandardRB: https://github.com/helix-editor/helix/wiki/External-binary-formatter-configuration#rubocop |
I notice that when the formatter fails to reformat the code it returns 1 and you can't close a buffer with auto-format on.
|
Rad. You ought add that to the wiki page as well, anyone can edit it. |
If you've installed rubocop/standardrb/stree(SyntaxTree) globally, you should modify the formatter command.
|
Thanks @dhnaranjo and @lrgalego for the external formatter tip! That ended up solving the issue for me. I added the suggestion to include the LSP config to the wiki so others can benefit: https://github.com/helix-editor/helix/wiki/External-binary-formatter-configuration#rubocop (feel free to further clarify) Not sure if the other issues identified in this thread are still outstanding, but if not we might be able to close this. |
Is there an updated way to configure this? config is no longer supported under language:
|
This is my configuration at [language-server.solargraph]
command = "/Users/danillos/.rbenv/shims/solargraph"
args = ["stdio"]
config = { diagnostics = false, formatting = false }
[language-server.rubocop]
command = "/Users/danillos/.rbenv/shims/rubocop"
args = ["--lsp", "--stderr", "--fail-level", "fatal"]
timeout = 3
[[language]]
name = "ruby"
language-servers = ["rubocop", { name = "solargraph", except-features = [ "format", "diagnostics" ] }]
auto-format = true I'm using Rubocop not inside of Solargraph because it is faster. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Summary
My Solargraph config works with other editors, including Neovim. I just started using Helix today, so I might mistake whether or not a feature is from the LSP or not, but Solargraph itself seems to work. It can jump to references and autocomplete seems to work too. Then again, the line where
solargraph stdio
is invoked, is marked as error in the log, and I'm a bit confused as to how serious that is with no additional stdout output.Reproduction Steps
I tried this:
hx -v test.rb
Then pasted this deliberately unindented file content to trigger a rubocop warning:
Then
:w
I expected this to happen:
A diagnostic message like this
Use 2 (not 0) spaces for indentation. (Layout/IndentationWidth)
Instead, this happened:
Nothing
Helix log
~/.cache/helix/helix.log
Platform
Linux (WSL2)
Terminal Emulator
Windows Terminal 1.12.10983.0
Helix Version
helix 22.05 (27609f5)
The text was updated successfully, but these errors were encountered: