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

Doesn't have completion/docs for core Ruby modules/classes

Open avdi opened this issue 2 years ago • 4 comments

Operating System

Ubuntu

Ruby version

3.2

Project has a bundle

  • [X] Has bundle

Ruby version manager being used

rbenv

Description

Since I started trying to use it, I've never seen the Ruby-LSP extension have autocomplete or docs (as portrayed in the documentation) for core Ruby modules/classes. I recorded this screencast of setting up a brand new Hello World ruby project in a vanilla VSCode Ruby devcontainer to demonstrate:

https://app.screencast.com/nxu9LQIS0YUWO?conversation=RU4ol9HhxOHuW72wMGEoFh

Steps:

  1. Make a new directory
  2. open the directory in VSCode
  3. Create a new Ubuntu Ruby devcontainer for the project
  4. Ensure deprecated Ruby extensions are disabled and uninstalled
  5. Ensure Shopify Ruby and Ruby-LSP extensions are installed and enabled
  6. Create new Ruby file
  7. Attempt to use autocomplete/intellisense for core Ruby classes like IO, Kernel, File...

avdi avatar Nov 24 '23 21:11 avdi

I feel like I must be doing something wrong, but I've poked around in settings and in the documentation and for the life of me I can't figure out what it is.

avdi avatar Nov 24 '23 22:11 avdi

Our indexer doesn't handle classes defined in C code yet, which is why they are missing. Constants coming from stdlib should be present as long as they're defined in Ruby.

We are still exploring which path forward will lead to the best results. We can index RBS files, which contain all core definitions.

However, there are gems with native extensions in the ecosystem that do not export RBS files, which would cause us to miss their declarations. We can try indexing the C files from the native extensions using something similar to what RDoc does, but it may still require authors to include the call-seq comments that inform the indexer about declarations.

vinistock avatar Nov 27 '23 14:11 vinistock

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

github-actions[bot] avatar Jan 27 '24 12:01 github-actions[bot]

+1 for this feature. I was just about to create an issue ticket.

aamehedi avatar Feb 05 '24 08:02 aamehedi

Indexing classes and modules from the Core library via RBS has been shipped in v0.17.3.

Indexing Core methods and constants is next. You can follow the progress in https://github.com/Shopify/ruby-lsp/issues/1335.

vinistock avatar Jun 11 '24 19:06 vinistock