ruby-lsp icon indicating copy to clipboard operation
ruby-lsp copied to clipboard

Introduce `.ruby-lsp.yml` config file

Open andyw8 opened this issue 1 year ago • 3 comments

Motivation

We want to have a general purpose configuration mechanism for Ruby LSP that not tied to a particular editor.

Also closes #1295 (but with a slightly different approach)

Implementation

As agreed with @vinistock, we will repurpose the current indexing configuration file, .index.yml.

There will be a new top-level key, indexing, but within that the structure was the same as before.

Automated Tests

Included

Manual Tests

  • Check out this branch
  • Ensure indexing is working (e.g. the Jump to Definition works for constants)
  • Edit .ruby-lsp.yml and rename the indexing key.
  • Restart the LSP and verify that error notification appears (the remaining LSP feature should continue working)
  • Copy .index.yml from main, and delete .ruby-lsp.yml.
  • Restart the LSP and ensure a deprecation warning about .index.yml shows in the output panel.
  • Ensure an error message is showing but otherwise everything works (e.g. formatting)
  • Delete .index.yml and restart the LSP (so now there are no config files)
  • Ensure indexing completes successfully (e.g. the Jump to Definition works for constants)

andyw8 avatar Feb 29 '24 15:02 andyw8

(looks like some tests need a slightl adjustment for Windows)

andyw8 avatar Mar 22 '24 17:03 andyw8

I think the changes are good, but I wonder if having the configuration file isn't deviating from the LSP approach. We might be better off getting rid of the .index.yml (with a deprecation warning first) and then start accepting all of the configuration from the editor.

After #1818 is shipped, we could have the indexing configuration be a part of the global state and gather the configuration from the initialization options.

I think it's worth ensuring we're following the LSP approach at this point, because otherwise we will have introduced two configuration files (.index.yml and .ruby-lsp.yml), both of which may be not following the standard.

Thoughts?

vinistock avatar Mar 25 '24 19:03 vinistock

TODO: update ruby-lsp-doctor to handle new config

andyw8 avatar Mar 25 '24 19:03 andyw8

This pull request is being marked as stale because there was no activity in the last 2 months

github-actions[bot] avatar May 25 '24 12:05 github-actions[bot]

(re-opening for now but really we should create a seperate issue/PR for @vinistock's suggestion).

andyw8 avatar Jun 10 '24 18:06 andyw8

Closing since we are planning a different approach: https://github.com/Shopify/ruby-lsp/issues/2156

andyw8 avatar Jun 11 '24 13:06 andyw8