Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.39k stars 128 forks source link

Develop strategy for indexing declarations made in C / native extensions #1335

Open vinistock opened 5 months ago

vinistock commented 5 months ago

We currently index all Ruby files bundled with the Ruby installation, but that doesn't cover all declarations available. Core classes like Array or String are defined in C and thus we miss those declarations. We also miss gem declarations that are made in native extensions.

We need to consider the performance, accuracy and maintenance costs of a few different approaches to decide how we're going to handle this:


### Tasks
- [x] [Index Core classes using RBS](https://github.com/Shopify/ruby-lsp/pull/2132)
- [x] [Extract includes, prepends and extends and insert those as well](https://github.com/Shopify/ruby-lsp/pull/2148)
- [ ] Index Core methods using RBS https://github.com/Shopify/ruby-lsp/pull/2157
- [ ] Index Core constants using RBS
- [ ] [Provide basic RBS support](https://github.com/Shopify/ruby-lsp/issues/1206)
- [ ] Index return types using RBS
github-actions[bot] commented 3 months ago

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

andyw8 commented 1 month ago

As per the team discussion earlier today, we will move ahead with using RBS declarations for indexing core class (String, Integer, etc).

vinistock commented 1 month ago

This branch includes a super simple script for how to retrieve declarations which I paired on with Soutaro during RubyKaigi.

My understanding of it is that we can basically just iterate over the declarations that the code returns and then build our index's entries and push them.

andyw8 commented 4 weeks ago

I've updated the description with tasks related to RBS.