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

Definition Completion is not invoked for non-word tokens (like ++ operators) when ctrl-hovering #202024

Open
LordOfDragons opened this issue Jan 8, 2024 · 3 comments
Assignees
Labels
editor-symbols definitions, declarations, references feature-request Request for new features or functionality
Milestone

Comments

@LordOfDragons
Copy link

See microsoft/vscode-languageserver-node#1383 .

In language server onDefinition() is not called. According to the above issue this is because VS-Code does only call definition completion on word tokens. I would like though to also show definition completion for operators like "++" and so forth.

Would it be possible to add somehow the support to call onDefinition also on non-operators?

It would be fine enough if there is added a new language server property which allows to declare a list of tokens that should trigger definition completion although they are not text tokens. Maybe something like:

additionalDefinitionTokens = ['++', '--', '+', ... ]

@RedCMD
Copy link
Contributor

RedCMD commented Jan 8, 2024

are you talking about ctrl+hover? or ctrl+click?
the ctrl+hover underline (and hover) is only invoked when the language-configuration.json setting "wordPattern" matches
which by default is \w+

@jrieken jrieken added editor-symbols definitions, declarations, references feature-request Request for new features or functionality labels Jan 9, 2024
@jrieken jrieken changed the title Definition Completion is not invoked for non-word tokens (like ++ operators) Definition Completion is not invoked for non-word tokens (like ++ operators) when ctrl-hovering Jan 9, 2024
@jrieken jrieken added this to the Backlog milestone Jan 9, 2024
@LordOfDragons
Copy link
Author

Yes, I mean ctrl+hover

@RedCMD
Copy link
Contributor

RedCMD commented Jan 9, 2024

currently cpp specifically ignores all non-word chars

"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)",

changing it would fix this
but "wordPattern" is also used for symbol highlighting, basic intellisense and a few others

maybe VSCode could add a triggerRegex to the definitionProvider(), that would overwrite the default "wordPattern" regex
same as how the completionProvider() has triggerCharacters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-symbols definitions, declarations, references feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants