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

"Go to definition" showing not relevant list #2994

Open
jonathan-anyword opened this issue Dec 19, 2024 · 1 comment · May be fixed by #3007
Open

"Go to definition" showing not relevant list #2994

jonathan-anyword opened this issue Dec 19, 2024 · 1 comment · May be fixed by #3007
Labels
bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes

Comments

@jonathan-anyword
Copy link

Description

Ruby LSP Information

Ruby LSP Information

VS Code Version

1.96.1

Ruby LSP Extension Version

0.8.16

Ruby LSP Server Version

0.17.2

Ruby LSP Addons

Ruby Version

3.2.2

Ruby Version Manager

rbenv

Installed Extensions

Click to expand
  • circleci (2.8.4)
  • code-spell-checker (4.0.21)
  • copilot (1.253.0)
  • copilot-chat (0.23.2)
  • encode (1.1.0)
  • even-better-toml (0.19.2)
  • git-graph (1.30.0)
  • githistory (0.6.20)
  • gitlens (16.0.5)
  • makefile-tools (0.11.13)
  • markdown-preview-enhanced (0.8.15)
  • metals (1.45.0)
  • remote-containers (0.394.0)
  • remote-explorer (0.4.3)
  • remote-server (1.5.2)
  • remote-ssh (0.116.1)
  • remote-ssh-edit (0.87.0)
  • ruby-extensions-pack (0.1.12)
  • ruby-lsp (0.8.16)
  • scala (0.5.8)
  • sorbet-vscode-extension (0.3.37)
  • test-adapter-converter (0.2.1)
  • vscode-docker (1.29.3)
  • vscode-env (0.1.0)
  • vscode-postgres (1.4.3)
  • vscode-pull-request-github (0.102.0)
  • vscode-rdbg (0.2.2)
  • vscode-remote-extensionpack (0.26.0)
  • vscode-test-explorer (2.22.1)
  • vscode-yaml (1.15.0)

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": "rbenv"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "indexing": {},
  "erbSupport": true,
  "featureFlags": {}
}

Reproduction steps

When using "Go to definition" for a common named method like "call" vscode open box that shows unrelated classes with this method.
For example:
ModuleA::SubModuleA::ClassNameA.new.call()
Also "Go to definition" the new method is returning non-relevant list.
Using the Ruby Solargraph seems to work well with the link jumps.

Did I configured the extension wrong?
I dont see any special configuration except the version manager

@jonathan-anyword jonathan-anyword added bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes labels Dec 19, 2024
@vinistock
Copy link
Member

Thank you for the bug report.

First, your Ruby LSP server version is quite outdated (v0.17.2 when we're already on v0.22.1). I recommend updating it and if you have any trouble, see the outdated version docs.

I created a PR to add inference for methods invoked directly on an object instantiation #3007, which is something we wanted to add, but hadn't done before.

However, I do want to point out that accuracy in editor functionality is tightly coupled with the adoption of a type system and corresponding type checker. The Ruby LSP doesn't require you to adopt any type systems, so when types cannot be determined we fall back to simpler behaviour, like listing all possible options. I say this because #3007 will solve the exact scenario you mentioned, but it will not guarantee accuracy in every situation - and that is not possible without a type system.

There are more discussions about this in our design docs, in this discussion and in this issue.

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

Successfully merging a pull request may close this issue.

2 participants