Skip to content
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

Add support for Code Actions under Ruby LSP #636

Merged
merged 4 commits into from
Jun 24, 2024
Merged

Add support for Code Actions under Ruby LSP #636

merged 4 commits into from
Jun 24, 2024

Conversation

searls
Copy link
Contributor

@searls searls commented Jun 24, 2024

In order to support code actions (e.g. "Quick Fix" in VS Code), we need a more sophisticated way of invoking RuboCop than our kinda hacky stdin / stdout capture technique that invokes the CLI version. Ruby LSP provides a great way for doing this: extend the base runner and rely on instance variables of the runner to get at the actual RuboCop objects, then translate that to LSP types from the language_server_protocol gem's interfaces.

Lots of thoughts:

  1. This is an unacceptable and unsustainable amount of duplication from Ruby LSP, as @koic and I have both pointed out as being a risk, and a reason to figure out a consolidation strategy in the medium/long term
  2. I tried to maintain compatibility with the Standardizer object (which the Ruby LSP addon and the built-in server both depend on) is now returning diagnostic objects, whereas the built-in standard --lsp server is expecting JSON parsed from stdin. That needs to be translated appropriately before shipping anything Done
  3. I'm inclined to freeze/deprecate the built-in --lsp server in favor of pointing people to Ruby LSP and/or delegating to the RuboCop LSP
  4. I'm similarly inclined to gut the remaining Standard-specific code that went into this Ruby LSP add-on by either delegating to RuboCop or by seeing the add-on itself move into RuboCop in such a way as to be compatible with both Standard and RuboCop
  5. This already actually works under VS Code, which is neat

@searls searls force-pushed the add-code-actions branch from a7d0c18 to 3a27dcc Compare June 24, 2024 02:40
… an attribute definition. For some reason, this particular autofix will cause intermittent build failures and I can't figure out why
@searls searls merged commit baa5a2e into main Jun 24, 2024
4 checks passed
@searls searls deleted the add-code-actions branch June 24, 2024 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant