Skip to content

Debug language server

Qiming zhao edited this page Jul 20, 2018 · 22 revisions

Contents

Using output channel

The same as VSCode, each language server have a output channel itself, the output channel could be opened by

:call CocAction('runCommand', 'workspace.showOutput')

Or

:Denite coc-command

to get command list and run command by type <enter>.

To make output channel track LSP communication, set [languageserverId].trace.server to true in your coc-settings.json.

For example, to make cssserver track LSP communication, use:

  "cssserver.trace.server": "verbose",

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:

screen shot 2018-07-20 at 12 15 10 pm

Using Chrome developer tools

You can use Chrome to debug language server which using node IPC for communication.

First, add execArgv to the language server settings like:

 "cssserver.execArgv": ["--nolazy", "--inspect-brk=6045"]

After the cssserver started, open Chrome with url chrome://inspect

Make sure Discover network targets option is checked, and then you will the debugging target.

REPL

Clone this wiki locally