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

Set custom program name for the built-in LSP server #12855

Conversation

koic
Copy link
Member

@koic koic commented Apr 19, 2024

This PR sets custom program name for the built-in LSP server.

Before:

$ ps aux | grep rubocop
user  17414  0.0  0.2  5557716 144376  ??  Ss  4:48PM  0:02.13 /Users/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bin/rubocop --lsp

After:

$ ps aux | grep 'rubocop'
user  17414  0.0  0.2  5557716 144376  ??  Ss  4:48PM  0:02.13 rubocop --lsp /Users/user/src/github.com/rubocop/rubocop

When searching for the LSP server process, it is helpful to display the path to the project root instead of the Ruby command path. This approach is already being implemented in server mode: https://github.com/rubocop/rubocop/blob/v1.63.2/lib/rubocop/server/core.rb#L31


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.

This PR sets custom program name for the built-in LSP server.

Before:

```console
$ ps aux | grep rubocop
user  17414  0.0  0.2  5557716 144376  ??  Ss  4:48PM  0:02.13 /Users/user/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/bin/rubocop --lsp
```

After:

```console
$ ps aux | grep 'rubocop'
user  17414  0.0  0.2  5557716 144376  ??  Ss  4:48PM  0:02.13 rubocop --lsp /Users/user/src/github.com/rubocop/rubocop
```

When searching for the LSP server process, it is helpful to display the path to the project root instead of the Ruby command path.
This approach is already being implemented in server mode:
https://github.com/rubocop/rubocop/blob/v1.63.2/lib/rubocop/server/core.rb#L31
@koic koic force-pushed the set_custom_program_name_for_the_builtin_lsp_server branch from 9a87b78 to c819a2d Compare April 19, 2024 05:16
@bbatsov bbatsov merged commit 74037d9 into rubocop:master Apr 19, 2024
33 checks passed
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 19, 2024

Nice change!

@koic koic deleted the set_custom_program_name_for_the_builtin_lsp_server branch April 19, 2024 06:35
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

2 participants