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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#12855](https://github.com/rubocop/rubocop/pull/12855): Set custom program name for the built-in LSP server. ([@koic][])
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/usage/lsp.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ Run `rubocop --lsp` command from LSP client.
When the language server is started, the command displays the language server's PID:

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

NOTE: `rubocop --lsp` is for starting LSP client, so users don't manually execute it.
Expand Down
2 changes: 2 additions & 0 deletions lib/rubocop/lsp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ module LSP
# @api private
class Server
def initialize(config_store)
$PROGRAM_NAME = "rubocop --lsp #{ConfigFinder.project_root}"

RuboCop::LSP.enable

@reader = LanguageServer::Protocol::Transport::Io::Reader.new($stdin)
Expand Down