larperCord Buy Me a Coffee at ko-fi.com Português

Code diagnostics

While you type a fenced code block in the message box, larperCord can show the errors a language server finds in it. Nothing is built into the app and nothing is downloaded: the server is a program of yours, and it only runs for a language you turned on. With everything off (the default) there is no thread, no child process and no extra memory in use.

Turning it on

Settings → Code diagnostics. Each language has a command and a switch:

Block tagRow
zigZig
python, py, py3Python
rust, rsRust
c, h, cpp, c++, cc, cxx, hppC / C++
go, golangGo
typescript, ts, tsx, javascript, js, jsxTypeScript / JavaScript
luaLua

The server has to speak LSP over stdin and stdout, so the command is usually something like zls, ruff server, pyright-langserver --stdio, rust-analyzer, clangd, gopls, typescript-language-server --stdio or lua-language-server.

The page also searches your PATH for those well-known names and offers what it finds. It only checks that the file exists and is executable; it does not run it. Clicking Use … and turn on stores the full path as the command, which is what you are agreeing to run.

While typing

Put the cursor inside a block:

`

const a: u32 = "text";

About 300 ms after you stop typing, the block goes to the server. Up to three problems show up above the message box (line, severity, message), and they are underlined in the text. If the text has grown enough to scroll inside the box, only the list is shown. Line numbers count from the start of the message, not from the start of the block.

What the server gets

The app holds your Discord token, so a server runs with as little as possible:

This is not a sandbox. A language server is a normal program running as you, and it could read your files, including where the app stores its token. Only turn on servers you trust.

From a plugin

A Lua plugin can propose a server, for example for a language the app doesn't list:

lua
larper.lsp("haskell", {"haskell-language-server-wrapper", "--lsp"})

The proposal shows up on the same Settings page with its full command, off. It only runs after you turn it on, and that decision is tied to that plugin, language and exact command: if the plugin changes the command, it goes back to off. See plugins.md.

If a language has both, your own command wins.

Limits worth knowing

Source of this page on GitHub