Allow RuboCop hints for non-ruby files
This feature is VS Code specific
- [X] VS Code specific
Use case
Somewhat recently RuboCop introduced 3rd-party templating support, where extensions can extract ruby code from files that RuboCop would normally not understand. https://github.com/rubocop/rubocop/pull/10839
A few examples are
- https://github.com/r7kamura/rubocop-erb
- https://github.com/r7kamura/rubocop-haml
- https://github.com/r7kamura/rubocop-slim
- https://github.com/rubocop/rubocop-md (this one predates the extension api and does its own thing, though still relevant)
- https://github.com/bobf/rubocop-rspec-documentation
Description
I want inline RuboCop hints for non-ruby files.
Implementation
I'm not sure how this works, currently there is no request fired when opening an erb file for example. So the extension probably needs to advertise on which extensions it can function. I'm not sure how that would work with arbitrary extensions.
Transfering to the other repo since I don't think this is specific to VS Code.
This is an interesting idea and highly related with ERB support https://github.com/Shopify/ruby-lsp/issues/1055.
The challenge here is that the server needs to know how to process all of these different file extensions properly.
We will need to explore ways in which addons can register for handling a specific file type.
In addition to handling the embedded Ruby portions of the code, we also need to delegate requests that occur outside of it to their respective LSP. For example, for HTML, we would only want to handle Ruby related features, but we still want the HTML features to be available.