ruby-lsp-rails
ruby-lsp-rails copied to clipboard
A Ruby LSP addon for Rails
We can leverage Rails to provide completion for ActiveRecord fields. For example if the user has typed: `User.where(` then we should be able to provide completions based on the fields...
If we can add support for DocumentSymbol for tables in `schema.rb`, it provides several benefits: - Quick navigation using Go To Symbol - An outline view of the file's contents...
Currently, you can reveal a model's schema by hovering over it. It would be nice if you could also see this when hovering over an association, e.g. `belongs_to :user`,
Hopefully this is the right place, this is more of a Rails feature request. When typing `users(` in a test file, I would love if we could autocomplete the name...
For validations, we could offer completion on the model's fields. e.g. if you have a `User` model, and type `validates :`, we can offer to complete `name`, `password` etc.
We are seeing occasionally on Core: ``` 2024-03-14 14:51:11.636 [info] (shopify) Ruby LSP Rails failed to initialize server: /home/spin/.bundle/shopify/ruby-3.3.0/gems/spring-4.1.3/lib/spring/server.rb:84:in `getpgid': No such process (Errno::ESRCH) from /home/spin/.bundle/shopify/ruby-3.3.0/gems/spring-4.1.3/lib/spring/server.rb:84:in `set_pgid' from /home/spin/.bundle/shopify/ruby-3.3.0/gems/spring-4.1.3/lib/spring/server.rb:39:in `boot'...
I don't think there's any need to cache routes, since even on Core, withover 5000 routes, it takes only 1ms: > shopify(dev)> start=Time.now; Rails.application.routes.named_routes.helper_names.to_a; Time.now-start => 0.001078413 TODO: - [...
As reminded by https://github.com/Shopify/ruby-lsp-rails/pull/316, the current approach isn't very thorough since we are stubbing the runner responses.
Add a `SchemaCollector` class that expects `schema.rb` AST and stores the location for all the defined tables. For issue #52
Assume an user has a Rails app called `my_app`, which has in-app engines with the following file structure: ``` my_app ├── app ├── config ├── (other Rails app folders) └──...