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

"Find All References" unnecessarily requires a word position #88413

Closed
matklad opened this issue Jan 8, 2020 · 4 comments
Closed

"Find All References" unnecessarily requires a word position #88413

matklad opened this issue Jan 8, 2020 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities references-viewlet verified Verification succeeded
Milestone

Comments

@matklad
Copy link

matklad commented Jan 8, 2020

If I invoke "find refrences" when the cursor is on a puncuation character, the editor seems to bypass the server and says "no results" without making any requests:

image

However, there are valid cases to invoke "find usages" on a punctuation character:

  • in languages with operator overloading, searching for usages of + is a pretty natural thing to do
  • In Kotlin, searching for ( in data class Point(val x, val y) will search for constructor calls (this is the feature we are trying to mimic in rust-analyzer)

I've tested and in Emacs I can ref-search punctuation. It's interesting that goto definition does not try to check if thing at point is an identifier.

@matklad matklad changed the title Referece search query does not triger on symbols Referece search query does not triger on punctuation characters Jan 8, 2020
@dbaeumer
Copy link
Member

Moving to VS Code since the LSP client library doesn't receive the call in the first place.

@dbaeumer dbaeumer transferred this issue from microsoft/vscode-languageserver-node Jan 10, 2020
@dbaeumer dbaeumer added the api label Jan 10, 2020
@jrieken jrieken added info-needed Issue requires more information from poster references-viewlet bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities and removed api info-needed Issue requires more information from poster labels Jan 10, 2020
@jrieken
Copy link
Member

jrieken commented Jan 10, 2020

Yeah, for peek this works but the viewlet is more strict because it wants to add a history entry like "foo - some/file.ts - references" and without a word this gets tricky... Tho, in that case we should just use the character at the position

@jrieken jrieken changed the title Referece search query does not triger on punctuation characters "Find All References" unnecessarily requires a word position Jan 10, 2020
@matklad
Copy link
Author

matklad commented Jan 10, 2020

Confirmed that peek references indeed work with rust-analyzer's implementation!

@jzyrobert
Copy link
Contributor

It looks like you'd have to implement a custom check or think of a regex to pass to getWordRangeAtPosition, about here

Should it allow any non whitespace character if its not a valid word?

@jrieken jrieken added this to the January 2020 milestone Jan 16, 2020
@connor4312 connor4312 added the verified Verification succeeded label Jan 30, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities references-viewlet verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants