Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of completions (possibly because of definition in C file) #3115

Open
xbt573 opened this issue Jan 31, 2025 · 3 comments
Open

Lack of completions (possibly because of definition in C file) #3115

xbt573 opened this issue Jan 31, 2025 · 3 comments
Labels
bug Something isn't working pinned This issue or pull request is pinned and won't be marked as stale vscode This pull request should be included in the VS Code extension's release notes

Comments

@xbt573
Copy link

xbt573 commented Jan 31, 2025

Description

Ruby LSP Information

VS Code Version

1.96.2

Ruby LSP Extension Version

0.8.19

Ruby LSP Server Version

0.23.7

Ruby LSP Add-ons

Ruby Version

3.4.1

Ruby Version Manager

rbenv

Installed Extensions

Click to expand
  • LiveServer (5.7.9)
  • codetogether (2025.1.0)
  • go (0.44.0)
  • ruby-lsp (0.8.19)

Ruby LSP Settings

Click to expand
Workspace
{}
User
{
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": true,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": true,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": true,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": true,
    "codeLens": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "auto"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true,
  "featureFlags": {}
}

Reproduction steps

  1. Start the Ruby LSP using a certain editor
  2. Open a Ruby file
  3. Paste one of the examples
  4. See lack of completion

Code snippet or error message
Digest::SHA2.hexdigest example:

require 'digest'

Digest::SHA2.hexd # <- try to autocomplete 'hexdigest'

Zlib example:

require 'zli # <- try to autocomplete 'zlib'

Both zlib module and hexdigest functions are defined inside C files, but have definition in RBS files.

@xbt573 xbt573 added bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes labels Jan 31, 2025
@vinistock
Copy link
Member

Thank you for the report!

For anyone looking into this, the problem is that we currently don't use RBS for default gems. We index them directly from the Ruby installation. That means we can only index Ruby files and we miss definitions made in C.

We can't simply start indexing RBS because that will cause duplicate declarations to be inserted in the index, so we may need to look into dropping our indexing of the Ruby installation and rely on RBS only for default gems.

@vinistock vinistock added the pinned This issue or pull request is pinned and won't be marked as stale label Jan 31, 2025
@xbt573
Copy link
Author

xbt573 commented Jan 31, 2025

Is it possible to index first and then replace with existing RBS definitions?

@vinistock
Copy link
Member

That would degrade indexing performance because we'd essentially be indexing the same thing twice. Ideally, if we can completely avoid reaching for the Ruby installation, then we can make indexing faster in addition to fixing the missing declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned This issue or pull request is pinned and won't be marked as stale vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

No branches or pull requests

2 participants