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

Respect user's intentions with workspace/executeCommand LSP method #12897

Merged

Conversation

koic
Copy link
Member

@koic koic commented May 12, 2024

Context: Shopify/ruby-lsp#1453 (comment)

The workspace/executeCommand is an LSP method triggered by intentional user actions, so the user's intention for autocorrection is respected.

It has not yet been implemented in RuboCop's built-in LSP, but the same could be said for textDocument/codeAction LSP method, which might be implemented in the future.

This change slightly alters the behavior of AutoCorrect: contextual when using LSP (or the --editor-mode option), and this has been documented accordingly.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

Context: Shopify/ruby-lsp#1453 (comment)

The `workspace/executeCommand` is an LSP method triggered by intentional user actions,
so the user's intention for autocorrection is respected.

It has not yet been implemented in RuboCop's built-in LSP, but the same could be said for `textDocument/codeAction` LSP method,
which might be implemented in the future.

This change slightly alters the behavior of `AutoCorrect: contextual` when using LSP (or the `--editor-mode` option),
and this has been documented accordingly.
@koic koic merged commit 730794e into rubocop:master May 16, 2024
33 checks passed
@koic koic deleted the update_workspace_execute_command_lsp_method branch May 16, 2024 16:48
@koic
Copy link
Member Author

koic commented May 16, 2024

@bbatsov Oops, I accidentally merged this PR. I think it may be logically sound, but if you notice any issues that might arise from the merge, please don't hesitate to let me know. I'm open to making corrections or reverting if necessary 🙇

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.

None yet

1 participant