[kak-lsp] Tips for correctly setting up Deno LSP?

I have these settings in ~/.config/kak-lsp/kak-lsp.toml:

filetypes = ["typescript", "javascript"]
roots = [".git"]
command = "deno"
args = ["lsp"]

filetypes = ["typescript"]
roots = ["package.json", "tsconfig.json"]
command = "typescript-language-server"
args = ["--stdio"]

I also set the following options at the end of kakrc:

set-option global lsp_server_configuration deno.enable="true"

When I open a TypeScript file, the TypeScript LSP overrides Deno’s and displays invalid errors. If I disable the TypeScript LSP, Deno LSP doesn’t appear to work. Any tips for making the two play nice with each other?

PS: Excuse my ignorance if I’m doing something wrong, I’m very new to Kakoune.

Edit: lsp-capabilities shows a list of supported commands, but none actually work.

deno requires some extra initialization options in the kak-lsp config.

Add this extra block in kak-lsp.toml and it should start working.

enable = true
lint = true

Thanks. It does work, but how do I set it up per-project? I don’t want Deno to enable itself in all TypeScript projects.

How do you distinguish Deno projects from other TypeScript projects? kak-lsp tries to base it on Kakoune’s filetype option, but that’s not enough because filetype=typescript could be either. If there’s some other way, maybe kak-lsp can be taught to recognise it, or maybe Kakoune can be taught to use a different filetype value for TypeScript-in-Deno files, and then kak-lsp can key off that.

I guess you can differentiate based on project root in the kak-lsp config?

.git for deno and package.json for node-based projects?

That is, if you don’t use node in deno projects, of course.

VSCode and Vim CoC allow overriding initialization options via a separate configuration file placed in the project directory. I guess kak-lsp doesn’t have that feature yet.

1 Like