Skip to content

Debugging

Silas Marvin edited this page Aug 11, 2024 · 2 revisions

Debugging can be enabled by setting the LSP_AI_LOG env variable.

For example to enable debug mode:

export LSP_AI_LOG=DEBUG

By default the level is set to ERROR.

We use the Rust tracing crate and tracing_subscriber to log function calls and parameters.

By default logs are out to stderr which is typically picked up by the editor using the language server. In the case of helix on Linux, logs for LSP-AI can be found in the ~/.cache/helix/helix.log file. You can tell LSP-AI to write to a separate log file by passing the command line parameter use-seperate-log-file. A complete example:

lsp-ai --use-seperate-log-file

When --use-seperate-log-file is passed, LSP-AI will write to its own log file in your cache dir which if your username is alice can be found in:

Linux:   /home/alice/.cache/lsp-ai/lsp-ai.log
Windows: C:\Users\Alice\AppData\Local\lsp-ai\lsp-ai.log
macOS:   /Users/Alice/Library/Caches/lsp-ai/lsp-ai.log

Some work still needs to be put into the debugging system. Please create new issues where applicable and feel free to contribute!

Clone this wiki locally