Volar doesn't provide any completions etc.
Bocom opened this issue · comments
System info
Windows 10 21H1
Sublime Text 4 (4113)
Node 14.17.6 (through Volta, but regular Node doesn't work either and other Node-based language servers (like LSP-vue and LSP-typescript) do work)
LSP 1.12.1
LSP-volar 1.0.3
Issue
Volar doesn't return any completions or much of anything, the only thing that works is formatting files.
When looking at the language server debug log, it just returns some combinations of empty arrays or None
regardless of what's being done (aside from formatting, as previously mentioned), as can bee seen in the attached language server log.
Of note, during initialization, a blank cmd.exe
window running node.exe
pops up for a split second before it's gone. This doesn't happen with the other Node-based language servers I use.
Logs
Here is the system log:
system.log
And here is the language server log:
langserver.log
Probably not related to your issue but I've noticed two weird things in the server log.
- The server sends a
workspace/configuration
request with this payload:
{
"items": [
{
"section": "js/ts.implicitProjectConfig"
},
{
"section": "javascript.implicitProjectConfig"
}
]
}
and receives nothing for both. Possibly it's not really required but not sure.
- The server dynamically registers the
workspace/didChangeConfiguration
capability but it never receives theworkspace/didChangeConfiguration
notification. I wonder if LSP should automatically trigger the notification when servers registers the capability. But then this server doesn't have any settings insettings
object so maybe that's the reason we don't send anything.
I compared your logs with mine, and they seem to look good.
Just to cross node.js as a potental problem,
can you try this?
From the command palette, select Preferences: LSP Utils settings
.
and paste this:
{
"nodejs_runtime": ["local"],
}
Restart ST.
You should see this window.
Select Install Node.js
. LSP will automatically install the Node Runtime locally(Node V14.17.6 will be installed at the time of writing). It won't install Node globally.
After Node is installed, restart ST just in case, (i don't think it is necessary but it will not hurt) :)
Open a vue file and see if it working?
I tried doing that just now and unfortunately, it didn't work, the results are the same (i.e. only formatting works).
Truncated system log (for posterity's sake)
LSP: Resolved Node Runtime for client LSP-volar: NodeRuntimeLocal(node: C:\Users\Bocom\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\14.17.6\node\node.exe, npm: C:\Users\Bocom\AppData\Local\Sublime Text\Package Storage\lsp_utils\node-runtime\14.17.6\node\node_modules\npm\bin\npm-cli.js, version: 14.17.6)
LSP: starting ['C:\\Users\\Bocom\\AppData\\Local\\Sublime Text\\Package Storage\\lsp_utils\\node-runtime\\14.17.6\\node\\node.exe', 'C:\\Users\\Bocom\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-volar\\14.17.6\\server\\node_modules\\@volar\\server\\out\\index.js', '--stdio'] in C:\Projekt\temp\volar-repro
LSP: LSP-volar: Supported execute commands: ['volar.server.executeConvertToKebabCase', 'volar.server.executeConvertToPascalCase']
LSP: LSP-volar: supported code action kinds: ['', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.fixAll', 'source.organizeImports']
LSP: LSP-volar: registering capability: didChangeConfigurationProvider
I have setup window 10 and I can reproduce the issue.
So I tried in VS Code where Volar works.
So here is the difference.
VS code sends these params to the server when requesting completions:
{
"textDocument": {"uri": "file:///c%3A/Users/PC/Documents/ee/index.vue"},
"position": {"line": 5, "character": 17 },
"context": {"triggerKind": 1 }
}
ST sends these:
{
"textDocument": {"uri": "file:///C:/Users/PC/Documents/ee/index.vue"},
"position": {"character": 17, "line": 5}
}
I would say that URI is the problem:
ST uses file:///C:/Users/PC/Documents/ee/index.vue
VS Code uses file:///c%3A/Users/PC/Documents/ee/index.vue
.
I don't know what is the correct URI representation. I would say file:///C:
, but I am not sure.
We had issues like this with other servers as well:
Ironically, that second issue (vuejs/vetur#2433) is based on an issue of mine for LSP-vue (sublimelsp/LSP-vue#83).
Figures that it's another silly Windows/VS Code interaction. 😅
I guess the solution in the case of Vetur was to modify upstream to make it work "properly", presumably that's what should happen here too?
FYI: @johnsoncodehk
The issue with handling Windows file paths was discussed in various places, including the LSP spec, and the conclusion was that it's not really responsibility of LSP to define that. So generally the servers would need to normalize the paths
I would say that URI is the problem:
ST usesfile:///C:/Users/PC/Documents/ee/index.vue
VS Code usesfile:///c%3A/Users/PC/Documents/ee/index.vue
.
Will try to mock it in vscode. 🤔
Please let me know if there are other cases that need attention.
Please try update to 0.28.10 for fix, thanks.
There is a new release of LSP-volar v1.0.5 that includes the upstream fix.
I do not have a Windows laptop near me, so I couldn't test this.
@Bocom please close this issue if it has been fixed? :)