castwide / solargraph

A Ruby language server.
https://solargraph.org
MIT License
1.87k stars 154 forks source link

Formatting no longer works with Rubocop < 1.30 #652

Closed noniq closed 4 months ago

noniq commented 1 year ago

https://github.com/castwide/solargraph/commit/c195d3f237e0f6ca876bb90d6206181bcdd5d706 changed --auto-correct to --autocorrect to avoid deprecation warnings with recent versions of Rubocop. However, this broke formatting with Rubocop versions < 1.30, as those do not support --autocorrect.

Error message:

[Error - 20:06:28] Request textDocument/formatting failed.
  Message: [OptionParser::InvalidOption] invalid option: --autocorrect
Did you mean?  auto-correct
  Code: -32603 

A possible fix would be to simply use -a instead, this works in all Rubocop versions.