Module: RubyLsp
- Defined in:
- lib/ruby_lsp/runar/hover.rb,
lib/ruby_lsp/runar/addon.rb,
lib/ruby_lsp/runar/indexing.rb,
lib/ruby_lsp/runar/completion.rb
Overview
Runar indexing enhancement for the Ruby LSP.
Teaches the LSP indexer about ‘prop :name, Type` declarations so that:
- The accessor method(s) generated by `prop` appear in completion lists.
- `@name` instance variables are indexed for go-to-definition.
How it works:
Ruby LSP calls on_call_node_enter for every method call found during
indexing. We intercept calls whose name is :prop and extract the
symbol argument (the property name) and the constant argument (the
Runar type). We then register:
1. A reader method via the public add_method API.
2. A writer method when the prop is not declared readonly.
3. The backing @name instance variable directly via the index.
File scoping:
Runar contract files use the .runar.rb extension. We skip indexing
for any file that does not match this pattern so that regular Ruby
files in the same project are unaffected.
Defined Under Namespace
Modules: Runar