vscode 当ctrl悬停时,不为非单词标记(如++运算符)调用Definition Completion,

v6ylcynt  于 2个月前  发布在  Vscode
关注(0)|答案(3)|浏览(36)

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 = ['++', '--', '+', ... ]

cs7cruho

cs7cruho1#

你是指ctrl+hover吗?还是ctrl+click?
language-configuration.json设置"wordPattern"匹配时,才会调用ctrl+hover下划线(并悬停)。默认情况下,它是\w+

yh2wf1be

yh2wf1be2#

是的,我的意思是ctrl+悬停。

brccelvz

brccelvz3#

当前的cpp配置文件中,特定地忽略了所有非单词字符。在vscode/extensions/cpp/language-configuration.json文件的第27行,可以尝试修改"wordPattern",以解决这个问题。但是,"wordPattern"也用于符号高亮、基本的智能感知等功能。或许VSCode可以为definitionProvider()添加一个triggerRegex,以覆盖默认的"wordPattern"正则表达式,就像completionProvider()triggerCharacters一样。

相关问题