-
Notifications
You must be signed in to change notification settings - Fork 37.2k
Description
- VSCode Version:
Version: 1.51.1 (user setup)
Commit: e5a624b
Date: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0 - OS Version: Windows_NT x64 10.0.19041
- vscode-languageclient: 7.0.0-next.14
Location of buttons in $subject:

As a result of prepareCallHierarchy and/or outgoing/incomingCalls LSP calls I have this CallHierarchyItem:
{
"name": "СообщитьПользователю",
"detail": "CommonModule.ОбщегоНазначенияКлиентСервер",
"kind": 6,
"tags": [],
"uri": "file:///D:/git/accreditation/main/src/cf/CommonModules/ОбщегоНазначенияКлиентСервер/Ext/Module.bsl",
"range": {
"start": {
"line": 2603,
"character": 0
},
"end": {
"line": 2638,
"character": 14
}
},
"selectionRange": {
"start": {
"line": 2603,
"character": 10
},
"end": {
"line": 2603,
"character": 30
}
}
}note that selectionRange starts with character 10.
If I right click on this item and select "Show incoming/outgoing calls" vscode language client sends this prepareHierarchy call:
{
"textDocument": {
"uri": "file:///d%3A/git/accreditation/main/src/cf/CommonModules/%D0%9E%D0%B1%D1%89%D0%B5%D0%B3%D0%BE%D0%9D%D0%B0%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D1%8F%D0%9A%D0%BB%D0%B8%D0%B5%D0%BD%D1%82%D0%A1%D0%B5%D1%80%D0%B2%D0%B5%D1%80/Ext/Module.bsl"
},
"position": {
"line": 2603,
"character": 0
}
}As you can see client sends position as start of item's range and not selectionRange. I've checked several language servers, and most of them tries to find symbol (method or variable) by its selectionRange - in most cases method or variable name, and not full declaration line. E.g. typescript lang server bundled in vscode can't show incoming calls by right click on method either.
My proposal is to change "Show incoming/outgoing calls" commands' behavior to send in prepareHierarchy call start position of selectionRange as position param and not start of range.
P.S. I'm not sure if I should open this issue in microsoft/vscode or microsoft/vscode-languageserver-node. Looks like the implementation of this buttons are here, in workbanch package. But feel free to migrate this issue to another project.
Thanks in advance!