-
-
Notifications
You must be signed in to change notification settings - Fork 959
Debug language server
The same as VSCode, each language server have a output channel itself, the output channel could be opened by
:CocCommand workspace.showOutput
To make output channel track all LSP communication, set [languageserverId].trace.server
to verbose
in your coc-settings.json
.
For example, to make tsserver
track LSP communication, use:
"tsserver.trace.server": "verbose",
to make custom language server to track LSP communication, add trace.server
section in language server configuration, like:
"languageserver":{
"ccls": {
"command": "ccls",
"filetypes": ["c", "cpp", "objc", "objcpp"],
"trace.server": "verbose",
"initializationOptions": {
"cacheDirectory": "/tmp/ccls"
}
}
}
However, the output of LSP communication is difficult for human to read, you can upload the content to LSP inspector: https://microsoft.github.io/language-server-protocol/inspector/, which would be looks like:
You can use Chrome to debug language server which using node IPC for communication.
First, add execArgv
to the language server settings like:
"css.execArgv": ["--nolazy", "--inspect-brk=6045"]
After the css
service started, open Chrome with url chrome://inspect
Make sure Discover network targets
option is checked and you have the address added to Target discovery settings
, and then you will have the debugging target.