Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Debug language server

Heyward Fann edited this pageSep 2, 2024 ·22 revisions

Contents

Checkout server stats

Use command:CocList services to open services list, you will haveidstate andfiletypes for each service.

list of running services

If a service id starts withlanguageserver, it comes fromlanguageserver configuration in coc-settings.json, if not, it's from an extension of coc.nvim.

The service does not start when a buffer's filetype does not match, use:CocCommand document.echoFiletype to get the detected filetype of the current buffer used by coc.nvim.

Using output channel

The same as VS Code, each language server has its own output channel, the output channel can be opened by:

:CocCommand workspace.showOutput

To make an output channel track all LSP communication, settrace.server toverbose in yourcoc-settings.json.

For example, to maketsserver fromcoc-tsserver extension track LSP communication, use:

"tsserver.trace.server":"verbose",

To make a user defined language server track LSP communication, add atrace.server section in your language server configuration:

"languageserver":{"ccls": {"command":"ccls","filetypes": ["c","cpp","objc","objcpp"],"trace.server":"verbose","initializationOptions": {"cacheDirectory":"/tmp/ccls"    }  }}

However, the output of LSP communication is very terse. You can useLSP Log Parser to parse/view/filter the logs:

LSP Log Parser

Using Chrome Developer Tools

You can use Google Chrome to debug a language server which is using node IPC (the language server has to be implemented by JavaScript like CSS language server fromcoc-css) for communication.

First, addexecArgv to the language server settings:

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

After thecss service starts, open Chrome with the urlchrome://inspect.

Make sure theDiscover network targets option is checked and you have the address added toTarget discovery settings, and then you will have the debugging target.

Note it's recommended you installcoc-json for automatic JSON completion.

REPL

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp