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

**URL:** <https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685>\
**Category:** Help\
**Tags:** lsp, plugins\
**Created:** [April 12, 2021, 5:08pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685 "2021-04-12T17:08:54Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![arafatamim](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/a/7ba0ec/32.png) [@arafatamim](https://discuss.kakoune.com/u/arafatamim)\
**Post date:** [April 12, 2021, 5:08pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/1 "2021-04-12T17:08:54Z")

</div>

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

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

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

```

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![kkga](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/kkga/32/849_2.png) [@kkga](https://discuss.kakoune.com/u/kkga)\
**Post date:** [April 12, 2021, 9:15pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/2 "2021-04-12T21:15:21Z")

</div>

deno requires some [extra initialization options](https://github.com/denoland/deno/pull/9989/files) in the kak-lsp config.

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

```
[language.deno.initialization_options]
enable = true
lint = true
```

---

<div class="post-metadata">

**Author:** ![arafatamim](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/a/7ba0ec/32.png) [@arafatamim](https://discuss.kakoune.com/u/arafatamim)\
**Post date:** [April 13, 2021, 6:28am UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/3 "2021-04-13T06:28:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [April 13, 2021, 7:13am UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/4 "2021-04-13T07:13:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kkga](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/kkga/32/849_2.png) [@kkga](https://discuss.kakoune.com/u/kkga)\
**Post date:** [April 13, 2021, 9:25am UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/5 "2021-04-13T09:25:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![arafatamim](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/a/7ba0ec/32.png) [@arafatamim](https://discuss.kakoune.com/u/arafatamim)\
**Post date:** [April 13, 2021, 11:07am UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/6 "2021-04-13T11:07:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![schickm](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/schickm/32/79_2.png) [@schickm](https://discuss.kakoune.com/u/schickm)\
**Post date:** [September 17, 2021, 9:07pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/7 "2021-09-17T21:07:36Z")

</div>

Has anyone experienced kak-lsp successfully connecting to Deno’s LSP server, but then Deno just returns `null` whenever an lsp command is sent? I can confirm that VSCode on my machine can communicate with Deno’s language server just fine, but not kak-lsp.

Here’s an except from a log file (configured using [kak-lsp’s recommended method for logging out lang server interactions](https://github.com/kak-lsp/kak-lsp#troubleshooting)). You can see that Deno is responding back to kak-lsp (I’ve bolded the part where you can see it’s deno):

> [@](#):
>
> Sep 17 13:48:37.486 DEBG From server: {“jsonrpc”:“2.0”,“result”:{“capabilities”:{“textDocumentSync”:{“openClose”:true,“change”:2,“save”:{}},“selectionRangeProvider”:true,“hoverProvider”:true,“completionProvider”:{“resolveProvider”:true,“triggerCharacters”:[“.”,“"”,“'”,“`”,“/”,“@”,“\<”,“#”],“allCommitCharacters”:[“.”,“,”,“;”,“(”]},“signatureHelpProvider”:{“triggerCharacters”:[“,”,“(”,“\<”],“retriggerCharacters”:[“)”]},“definitionProvider”:true,“implementationProvider”:true,“referencesProvider”:true,“documentHighlightProvider”:true,“documentSymbolProvider”:true,“codeActionProvider”:{“codeActionKinds”:[“quickfix”,“refactor”,“refactor.extract.function”,“refactor.extract.constant”,“refactor.extract.type”,“refactor.extract.interface”,“refactor.move.newFile”,“refactor.rewrite.import”,“refactor.rewrite.export”,“refactor.rewrite.arrow.braces”,“refactor.rewrite.parameters.toDestructured”,“refactor.rewrite.property.generateAccessors”],“resolveProvider”:true},“codeLensProvider”:{“resolveProvider”:true},“documentFormattingProvider”:true,“renameProvider”:true,“foldingRangeProvider”:true,“workspace”:{“workspaceFolders”:{“supported”:true}},“callHierarchyProvider”:true,“semanticTokensProvider”:{“legend”:{“tokenTypes”:[“class”,“enum”,“interface”,“namespace”,“typeParameter”,“type”,“parameter”,“variable”,“enumMember”,“property”,“function”,“method”],“tokenModifiers”:[“declaration”,“static”,“async”,“readonly”,“defaultLibrary”,“local”]},“range”:true,“full”:true}},“serverInfo”:**{“name”:“deno-language-server”,“version”:“1.14.0 (release, x86\_64-apple-darwin)”}**},“id”:0}, module: kak\_lsp::language\_server\_transport:151

So, you’d think everything would be fine…but when Deno’s language server gets any request sent to it, it just responds with null. Here’s what I’m seeing in the log file when I move my cursor with lsp-auto-hover enabled:

> [@](#):
>
> Sep 17 13:55:20.065 DEBG From editor:  
> session = “24703”  
> client = “client0”  
> buffile = “/Users/mattschick/vc/encoding-tools/hello-world.ts”  
> filetype = “typescript”  
> version = 1  
> method = “textDocument/hover”  
> [params.position]  
> line = 1  
> column = 24  
> , module: kak\_lsp::editor\_transport:129  
> Sep 17 13:55:20.065 DEBG Searching for vars starting with KAK\_LSP\_PROJECT\_ROOT\_DENO, module: kak\_lsp::project\_root:46  
> Sep 17 13:55:20.065 DEBG Routing editor request to Route { session: “24703”, language: “deno”, root: “/Users/mattschick/vc/encoding-tools” }, module: kak\_lsp::session:94  
> Sep 17 13:55:20.066 DEBG To server: {“jsonrpc”:“2.0”,“method”:“textDocument/hover”,“params”:{“position”:{“character”:23,“line”:0},“textDocument”:{“uri”:“file:///Users/mattschick/vc/encoding-tools/hello-world.ts”}},“id”:15}, module: kak\_lsp::language\_server\_transport:177  
> Sep 17 13:55:20.066 DEBG From server: **{“jsonrpc”:“2.0”,“result”:null,“id”:15}** , module: kak\_lsp::language\_server\_transport:151

Toggle below if you wanted to see the entire log output for the interaction of opening up kakoune, moving the cursor once (with auto hover enabled), and then quitting.

> **Full log output for opening up a typescript file**
>
> > [@](#):
> >
> > Sep 17 14:01:32.215 INFO Starting main event loop, module: kak\_lsp::session:28  
> > Sep 17 14:01:32.217 DEBG Searching for vars starting with KAK\_LSP\_PROJECT\_ROOT\_DENO, module: kak\_lsp::project\_root:46  
> > Sep 17 14:01:32.217 DEBG Routing editor request to Route { session: “27684”, language: “deno”, root: “/Users/mattschick/vc/encoding-tools” }, module: kak\_lsp::session:94  
> > Sep 17 14:01:32.217 DEBG Spawning a new controller for Route { session: “27684”, language: “deno”, root: “/Users/mattschick/vc/encoding-tools” }, module: kak\_lsp::session:116  
> > Sep 17 14:01:32.218 INFO Starting Language server `deno lsp`, module: kak\_lsp::language\_server\_transport:20  
> > Sep 17 14:01:32.224 DEBG To server: {“jsonrpc”:“2.0”,“method”:“initialize”,“params”:{“capabilities”:{“general”:{“markdown”:{“parser”:“kak-lsp”,“version”:“11.0.1”}},“offsetEncoding”:[“utf-16”],“textDocument”:{“codeAction”:{“codeActionLiteralSupport”:{“codeActionKind”:{“valueSet”:[“quickfix”,“refactor”,“refactor.extract”,“refactor.inline”,“refactor.rewrite”,“source”,“source.organizeImports”]}},“dynamicRegistration”:false,“isPreferredSupport”:false},“codeLens”:{“dynamicRegistration”:false},“colorProvider”:{“dynamicRegistration”:false},“completion”:{“completionItem”:{“commitCharactersSupport”:false,“deprecatedSupport”:false,“documentationFormat”:[“markdown”,“plaintext”],“preselectSupport”:false,“snippetSupport”:false},“completionItemKind”:{“valueSet”:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},“contextSupport”:false,“dynamicRegistration”:false},“declaration”:{“dynamicRegistration”:false,“linkSupport”:false},“definition”:{“dynamicRegistration”:false,“linkSupport”:false},“documentHighlight”:{“dynamicRegistration”:false},“documentLink”:{“dynamicRegistration”:false,“tooltipSupport”:false},“documentSymbol”:{“dynamicRegistration”:false},“formatting”:{“dynamicRegistration”:false},“hover”:{“contentFormat”:[“markdown”,“plaintext”],“dynamicRegistration”:false},“implementation”:{“dynamicRegistration”:false,“linkSupport”:false},“onTypeFormatting”:{“dynamicRegistration”:false},“publishDiagnostics”:{“relatedInformation”:false},“rangeFormatting”:{“dynamicRegistration”:false},“references”:{“dynamicRegistration”:false},“rename”:{“dynamicRegistration”:false,“prepareSupport”:false},“semanticTokens”:{“dynamicRegistration”:false,“formats”:[“relative”],“requests”:{“full”:true,“range”:false},“tokenModifiers”:,“tokenTypes”:},“signatureHelp”:{“contextSupport”:false,“dynamicRegistration”:false,“signatureInformation”:{“documentationFormat”:[“plaintext”],“parameterInformation”:{“labelOffsetSupport”:false}}},“synchronization”:{“didSave”:true,“dynamicRegistration”:false,“willSave”:false,“willSaveWaitUntil”:false},“typeDefinition”:{“dynamicRegistration”:false,“linkSupport”:false}},“window”:{“workDoneProgress”:false},“workspace”:{“applyEdit”:false,“configuration”:true,“didChangeConfiguration”:{“dynamicRegistration”:false},“executeCommand”:{“dynamicRegistration”:false},“symbol”:{“dynamicRegistration”:false,“symbolKind”:{“valueSet”:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},“workspaceEdit”:{“changeAnnotationSupport”:{},“documentChanges”:true,“failureHandling”:“abort”,“normalizesLineEndings”:false,“resourceOperations”:[“create”,“delete”,“rename”]},“workspaceFolders”:false}},“clientInfo”:{“name”:“kak-lsp”,“version”:“11.0.1”},“processId”:27840,“rootPath”:“/Users/mattschick/vc/encoding-tools”,“rootUri”:“file:///Users/mattschick/vc/encoding-tools”,“trace”:“off”},“id”:0}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:32.261 DEBG From editor:  
> > session = “27684”  
> > client = “client0”  
> > buffile = “/Users/mattschick/vc/encoding-tools/hello-world.ts”  
> > filetype = “typescript”  
> > version = 1  
> > method = “textDocument/hover”  
> > [params.position]  
> > line = 1  
> > column = 1  
> > , module: kak\_lsp::editor\_transport:129  
> > Sep 17 14:01:32.261 DEBG Searching for vars starting with KAK\_LSP\_PROJECT\_ROOT\_DENO, module: kak\_lsp::project\_root:46  
> > Sep 17 14:01:32.261 DEBG Routing editor request to Route { session: “27684”, language: “deno”, root: “/Users/mattschick/vc/encoding-tools” }, module: kak\_lsp::session:94  
> > Sep 17 14:01:32.261 DEBG Language server is not initialized, parking request, module: kak\_lsp::controller:98  
> > Sep 17 14:01:32.361 DEBG From server: {“jsonrpc”:“2.0”,“result”:{“capabilities”:{“textDocumentSync”:{“openClose”:true,“change”:2,“save”:{}},“selectionRangeProvider”:true,“hoverProvider”:true,“completionProvider”:{“resolveProvider”:true,“triggerCharacters”:[“.”,“"”,“'”,“`”,“/”,“@”,“\<”,“#”],“allCommitCharacters”:[“.”,“,”,“;”,“(”]},“signatureHelpProvider”:{“triggerCharacters”:[“,”,“(”,“\<”],“retriggerCharacters”:[“)”]},“definitionProvider”:true,“implementationProvider”:true,“referencesProvider”:true,“documentHighlightProvider”:true,“documentSymbolProvider”:true,“codeActionProvider”:{“codeActionKinds”:[“quickfix”,“refactor”,“refactor.extract.function”,“refactor.extract.constant”,“refactor.extract.type”,“refactor.extract.interface”,“refactor.move.newFile”,“refactor.rewrite.import”,“refactor.rewrite.export”,“refactor.rewrite.arrow.braces”,“refactor.rewrite.parameters.toDestructured”,“refactor.rewrite.property.generateAccessors”],“resolveProvider”:true},“codeLensProvider”:{“resolveProvider”:true},“documentFormattingProvider”:true,“renameProvider”:true,“foldingRangeProvider”:true,“workspace”:{“workspaceFolders”:{“supported”:true}},“callHierarchyProvider”:true,“semanticTokensProvider”:{“legend”:{“tokenTypes”:[“class”,“enum”,“interface”,“namespace”,“typeParameter”,“type”,“parameter”,“variable”,“enumMember”,“property”,“function”,“method”],“tokenModifiers”:[“declaration”,“static”,“async”,“readonly”,“defaultLibrary”,“local”]},“range”:true,“full”:true}},“serverInfo”:{“name”:“deno-language-server”,“version”:“1.14.0 (release, x86\_64-apple-darwin)”}},“id”:0}, module: kak\_lsp::language\_server\_transport:151  
> > Sep 17 14:01:32.361 DEBG To server: {“jsonrpc”:“2.0”,“method”:“initialized”,“params”:{}}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:32.361 DEBG lsp\_config:  
> > , module: kak\_lsp::settings:58  
> > Sep 17 14:01:32.361 DEBG To server: {“jsonrpc”:“2.0”,“method”:“textDocument/didOpen”,“params”:{“textDocument”:{“languageId”:“deno”,“text”:“console.log(Deno.args);\n”,“uri”:“file:///Users/mattschick/vc/encoding-tools/hello-world.ts”,“version”:1}}}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:32.362 DEBG To server: {“jsonrpc”:“2.0”,“method”:“workspace/didChangeConfiguration”,“params”:{“settings”:{“deno”:{“enable”:“true”}}}}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:32.362 DEBG To server: {“jsonrpc”:“2.0”,“method”:“textDocument/hover”,“params”:{“position”:{“character”:0,“line”:0},“textDocument”:{“uri”:“file:///Users/mattschick/vc/encoding-tools/hello-world.ts”}},“id”:1}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:32.362 DEBG From server: {“jsonrpc”:“2.0”,“method”:“workspace/configuration”,“params”:{“items”:[{“scopeUri”:“file:///Users/mattschick/vc/encoding-tools/hello-world.ts”,“section”:“deno”}]},“id”:0}, module: kak\_lsp::language\_server\_transport:151  
> > Sep 17 14:01:32.362 DEBG From server: {“jsonrpc”:“2.0”,“method”:“workspace/configuration”,“params”:{“items”:[{“section”:“deno”}]},“id”:1}, module: kak\_lsp::language\_server\_transport:151  
> > Sep 17 14:01:32.364 DEBG To editor `27684`: lsp-get-config ‘/var/folders/hf/36kd4h793mj7p8qx4jqjnjnm1rct9m/T/kak-lsp/mattschick/315a5f966f6437a1’, module: kak\_lsp::editor\_transport:84  
> > Sep 17 14:01:32.368 DEBG lsp\_config:  
> > , module: kak\_lsp::settings:58  
> > Sep 17 14:01:32.368 DEBG To server: {“jsonrpc”:“2.0”,“result”:[null],“id”:0}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:32.371 DEBG To editor `27684`: lsp-get-config ‘/var/folders/hf/36kd4h793mj7p8qx4jqjnjnm1rct9m/T/kak-lsp/mattschick/ff8262842e5521c5’, module: kak\_lsp::editor\_transport:84  
> > Sep 17 14:01:32.376 DEBG lsp\_config:  
> > , module: kak\_lsp::settings:58  
> > Sep 17 14:01:32.376 DEBG To server: {“jsonrpc”:“2.0”,“result”:[null],“id”:1}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:32.376 DEBG From server: {“jsonrpc”:“2.0”,“method”:“workspace/configuration”,“params”:{“items”:},“id”:2}, module: kak\_lsp::language\_server\_transport:151  
> > Sep 17 14:01:32.377 DEBG From server: {“jsonrpc”:“2.0”,“result”:null,“id”:1}, module: kak\_lsp::language\_server\_transport:151  
> > Sep 17 14:01:32.379 DEBG To editor `27684`: lsp-get-config ‘/var/folders/hf/36kd4h793mj7p8qx4jqjnjnm1rct9m/T/kak-lsp/mattschick/cea31525fb2d8723’, module: kak\_lsp::editor\_transport:84  
> > Sep 17 14:01:32.384 DEBG lsp\_config:  
> > , module: kak\_lsp::settings:58  
> > Sep 17 14:01:32.384 DEBG To server: {“jsonrpc”:“2.0”,“result”:,“id”:2}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:35.807 DEBG From editor:  
> > session = “27684”  
> > client = “client0”  
> > buffile = “/Users/mattschick/vc/encoding-tools/hello-world.ts”  
> > filetype = “typescript”  
> > version = 1  
> > method = “textDocument/hover”  
> > [params.position]  
> > line = 1  
> > column = 2  
> > , module: kak\_lsp::editor\_transport:129  
> > Sep 17 14:01:35.807 DEBG Searching for vars starting with KAK\_LSP\_PROJECT\_ROOT\_DENO, module: kak\_lsp::project\_root:46  
> > Sep 17 14:01:35.807 DEBG Routing editor request to Route { session: “27684”, language: “deno”, root: “/Users/mattschick/vc/encoding-tools” }, module: kak\_lsp::session:94  
> > Sep 17 14:01:35.808 DEBG To server: {“jsonrpc”:“2.0”,“method”:“textDocument/hover”,“params”:{“position”:{“character”:1,“line”:0},“textDocument”:{“uri”:“file:///Users/mattschick/vc/encoding-tools/hello-world.ts”}},“id”:2}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:35.808 DEBG From server: {“jsonrpc”:“2.0”,“result”:null,“id”:2}, module: kak\_lsp::language\_server\_transport:151  
> > Sep 17 14:01:39.579 DEBG From editor:  
> > session = “27684”  
> > client = “”  
> > buffile = “”  
> > filetype = “”  
> > version = 0  
> > method = “stop”  
> > [params]  
> > , module: kak\_lsp::editor\_transport:129  
> > Sep 17 14:01:39.579 INFO Shutting down language servers and exiting, module: kak\_lsp::session:180  
> > Sep 17 14:01:39.579 INFO Exit deno in project /Users/mattschick/vc/encoding-tools, module: kak\_lsp::session:185  
> > Sep 17 14:01:39.580 INFO Waiting for Controller to finish…, module: kak\_lsp::thread\_worker:19  
> > Sep 17 14:01:39.580 DEBG To server: {“jsonrpc”:“2.0”,“method”:“exit”,“params”:null}, module: kak\_lsp::language\_server\_transport:177  
> > Sep 17 14:01:39.580 DEBG Received signal to stop language server, closing pipe, module: kak\_lsp::language\_server\_transport:188  
> > Sep 17 14:01:39.580 DEBG Waiting for language server process end, module: kak\_lsp::language\_server\_transport:87  
> > Sep 17 14:01:39.581 INFO Waiting for Messages to language server to finish…, module: kak\_lsp::thread\_worker:19  
> > Sep 17 14:01:39.584 DEBG From editor:  
> > session = “27684”  
> > client = “”  
> > buffile = “/Users/mattschick/vc/encoding-tools/hello-world.ts”  
> > filetype = “typescript”  
> > version = 1  
> > method = “textDocument/didClose”  
> > [params]  
> > , module: kak\_lsp::editor\_transport:129  
> > Sep 17 14:01:41.581 INFO … Messages to language server terminated with ok, module: kak\_lsp::thread\_worker:21  
> > Sep 17 14:01:41.582 INFO Waiting for Messages from language server to finish…, module: kak\_lsp::thread\_worker:19  
> > Sep 17 14:01:41.589 ERRO Language server error: Starting Deno language server…  
> > version: 1.14.0 (release, x86\_64-apple-darwin)  
> > executable: /usr/local/bin/deno  
> > Connected to “kak-lsp” 11.0.1  
> > language server initialized  
> > Server ready.  
> > Unsupported language id “deno” received for document “file:///Users/mattschick/vc/encoding-tools/hello-world.ts”.  
> > Error converting specifier settings: invalid type: null, expected struct SpecifierSettings  
> > failed to update settings: invalid type: null, expected struct WorkspaceSettings  
> > exit notification received, stopping  
> > , module: kak\_lsp::language\_server\_transport:58  
> > Sep 17 14:01:41.589 DEBG Language server closed pipe, stopping reading, module: kak\_lsp::language\_server\_transport:129  
> > Sep 17 14:01:41.589 INFO … Messages from language server terminated with ok, module: kak\_lsp::thread\_worker:21  
> > Sep 17 14:01:41.590 INFO Waiting for Language server errors to finish…, module: kak\_lsp::thread\_worker:19  
> > Sep 17 14:01:41.590 INFO … Language server errors terminated with ok, module: kak\_lsp::thread\_worker:21  
> > Sep 17 14:01:41.590 INFO … Controller terminated with ok, module: kak\_lsp::thread\_worker:21  
> > Sep 17 14:01:41.590 INFO Waiting for Messages to editor to finish…, module: kak\_lsp::thread\_worker:19  
> > Sep 17 14:01:41.591 INFO … Messages to editor terminated with ok, module: kak\_lsp::thread\_worker:21

Here’s all the versioning info that I think would be relevant:

> [@](#):
>
> ➜ kak -version  
> Kakoune v2021.08.28  
> ➜ kak-lsp --version  
> kak-lsp 11.0.1  
> ➜ deno --version  
> deno 1.14.0 (release, x86\_64-apple-darwin)  
> v8 9.4.146.15  
> typescript 4.4.2

And here’s my kak-lsp.toml:

> [@](#):
>
> verbosity = 2
> 
> [server]  
> timeout = 1800 # seconds = 30 minutes
> 
> [language.deno]  
> filetypes = [“typescript”, “javascript”]  
> roots = [“.git”]  
> command = “deno”  
> args = [“lsp”]
> 
> [language.deno.settings]  
> enable = true  
> lint = true

Sorry…that was a ton of text…anybody got any ideas as too what might be going on? Or any additional troubleshooting ideas?

I should note that o experienced this with Deon 1.13 too

---

<div class="post-metadata">

**Author:** ![krobelus](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/krobelus/32/616_2.png) [@krobelus](https://discuss.kakoune.com/u/krobelus)\
**Post date:** [September 20, 2021, 4:20pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/8 "2021-09-20T16:20:55Z")

</div>

Unfortunately, the new `settings` parameter is not a drop-in replacement for `initialization_options`. We added `settings` to work around [`workspace/configuration` is impossible to implement on the client side · Issue #972 · microsoft/language-server-protocol · GitHub](https://github.com/microsoft/language-server-protocol/issues/972) Essentially it allows us to send server configuration both during initialization, and as response to `workspace/configuration`.

Your log does not contain `lint`, that immediately hints at a configuration issue (because we should send `"lint":true` to deno).  
The log does however contain

```json
{"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"section":"deno"}]},"id":1}, module: kak_lsp::language_server_transport:151 Sep 17

```

This means that the language server is asking for the configuration section `deno`, but there is none in your settings. If you’re ever unsure of how this should look like, you can check the corresponding VSCode configuration. This can help because kak-lsp’s `settings` use exactly the same structure, only with TOML syntax instead of JSON.  
A valid VSCode configuration probably looks something like

```json
{
  "deno": {
    "enable": true,
    "lint": true
  }
}

```

To match that structure, let’s just wrap the options in a `deno` section.

```toml
[language.typescript.settings.deno]
enable = true
lint = true

```

or, equivalently

```toml
[language.typescript.settings]
deno.enable = true
deno.lint = true

```

> **Extra info (not relevant for deno)**
>
> For some other servers it’s also necessary to add something like `settings_section = "deno"`. The kak-lsp documentation states that
> 
> > During server initialization, kak-lsp sends the section specified by `settings_section`
> 
> this means that during initialization, it will send `{"enable":true,"lint":true}`. Without setting `settings_section`, kak-lsp will send no parameters during initialization. Additionally, this is used for `workspace/didChangeConfiguration`
> 
> `settings_section` is mainly needed for servers that don’t implement `workspace/configuration`.

> [language.deno]

“deno” should probably be “typescript”; this is the LSP languageId that is sent to the server. Without that change I got this error in kak-lsp’s log

```
Unsupported language id "deno" received for document "file:///home/johannes/git/kak-lsp/t/test.ts"

```

This config works for me:

```toml
[language.typescript]
filetypes = ["typescript"]
roots = [".git"]
command = "deno"
args = ["lsp"]
[language.typescript.settings.deno]
enable = true
lint = true

```

Improvements to the default config/docs/wiki are always welcome 😉

> How do you distinguish Deno projects from other TypeScript projects?

My proposal would be to extend the dynamic server configuration thing, so users can write something like

```kak
# Dynamically activate deno config
set-option global lsp_config %{
    [language.typescript]
    filetypes = ["typescript"]
    roots = [".git"]
    command = "deno"
    args = ["lsp"]
    [language.typescript.settings.deno]
    enable = true
    lint = true
}
# Dynamically activate typescript config
set-option global lsp_config %{
    [language.typescript]
    filetypes = ["typescript"]
    roots = [".git"]
    command = "typescript-language-server"
    args = ["--stdio"]
}

```

this doesn’t work yet - only the `language.typescript.settings.deno` part is supported.

For now, I recommend starting separate Kakoune sessions, and starting kak-lsp with different config files depending on whether it’s a deno project or not.

---

<div class="post-metadata">

**Author:** ![krobelus](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/krobelus/32/616_2.png) [@krobelus](https://discuss.kakoune.com/u/krobelus)\
**Post date:** [September 20, 2021, 4:28pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/9 "2021-09-20T16:28:10Z")

</div>

> VSCode and Vim CoC allow overriding initialization options via a separate configuration file placed in the project directory.

This can be done by setting the `lsp_config` option depending on the project, see [GitHub - kak-lsp/kak-lsp: Kakoune Language Server Protocol Client](https://github.com/kak-lsp/kak-lsp#configuring-kakoune). The deprecated alternative `lsp_server_configuration` is still supported but less powerful.

This currently only supports toggling server options, but not switching between servers yet (see the end of my previous comment).

---

<div class="post-metadata">

**Author:** ![schickm](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/schickm/32/79_2.png) [@schickm](https://discuss.kakoune.com/u/schickm)\
**Post date:** [September 21, 2021, 12:48pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/10 "2021-09-21T12:48:07Z")

</div>

First and foremost, thank you for taking so much time to provide such a detailed response to all of these little issues. It’s very generous of you! I really appreciated the window into understanding the complexities of this new world of language servers.

The example toml you gave was spot on - everything is working perfectly locally for me now with Deno!

In regards to your proposal of extending dynamic config support beyond a single `language.<foo>.settings`, would it be helpful if I wrote up a ticket on the kak-lsp issue tracker as a feature request? Regretfully I don’t know Rust (yet!), but I’m happy to help in at least writing up an issue to document the use-case.

For those that need guidance on how to setup the “dynamic toml switching” that @krobelus proposes above, here’s how I went about doing it:

my main `kakrc` file:

```auto
eval %sh{kak-lsp --kakoune -s $kak_session}

declare-option str lsp_toml_path 'path/to/my/usual/kak-lsp.toml' 

hook global WinSetOption filetype=(typescript) %{
    set global lsp_cmd "kak-lsp -s %val{session} --config %opt{lsp_toml_path}"
    lsp-enable-window
}

# Look for a file named .kakrc.local in working directory on kakoune startup  
evaluate-commands %sh{
    if [-f .kakrc.local]; then
        printf "source .kakrc.local"
    fi
}

```

Then, for any directory that I want to override my standard `kak-lsp.toml` I drop a file in there named `.kakrc.local` and then throw in the override:

```auto
set-option global lsp_toml_path 'path/to/my/special/kak-lsp-deno.toml'

```

NOTE: It’s very important that you start kakoune from the directory that contains `.kakrc.local`, not from a subdirectory!

---

<div class="post-metadata">

**Author:** ![krobelus](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/krobelus/32/616_2.png) [@krobelus](https://discuss.kakoune.com/u/krobelus)\
**Post date:** [October 14, 2021, 4:28pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/11 "2021-10-14T16:28:07Z")

</div>

Regarding the per-project server selection I opened [Recommended way to select language servers depending on project · Issue #537 · kak-lsp/kak-lsp · GitHub](https://github.com/kak-lsp/kak-lsp/issues/537) - it’s not super important but it can’t hurt to gather ideas there.

---

<div class="post-metadata">

**Author:** ![schickm](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/schickm/32/79_2.png) [@schickm](https://discuss.kakoune.com/u/schickm)\
**Post date:** [February 9, 2022, 1:53am UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/12 "2022-02-09T01:53:59Z")

</div>

I updated kak-lsp today and found out that there’s a new option required to send the settings. A full configuration for Deno now would look like the following:

```auto
[language.typescript]
filetypes = ["typescript"]
roots = [".git"]
command = "deno"
args = ["lsp"]
offset_encoding = "utf-8"
settings_section = "deno" # THIS IS THE NEW CONFIG PROPERTY

[language.typescript.settings.deno]
enable = true
lint = true
unstable = true

```

More details can be found here:

> **[GitHub - kak-lsp/kak-lsp: Kakoune Language Server Protocol Client](https://github.com/kak-lsp/kak-lsp#server-specific-configuration)**
>
> Kakoune Language Server Protocol Client. Contribute to kak-lsp/kak-lsp development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![aWildThorp](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/awildthorp/32/1220_2.png) [@aWildThorp](https://discuss.kakoune.com/u/aWildThorp)\
**Post date:** [December 27, 2023, 4:41pm UTC](https://discuss.kakoune.com/t/kak-lsp-tips-for-correctly-setting-up-deno-lsp/1685/13 "2023-12-27T16:41:10Z")

</div>

Only slightly more robust, but I modified your example to work with plug.kak and so that it works inside subdirectories. Though it’s slightly less generic. Thanks for the working example @schickm!

```auto
plug "ul/kak-lsp" do %{
    [...]
} config %{
    declare-option str lsp_toml_path '$HOME/.config/kak-lsp/kak-lsp.toml'

    evaluate-commands %sh{
        ROOT_DIR="$(git rev-parse --show-toplevel 2>/dev/null)"
        if [-f "${ROOT_DIR:-.}/deno.json"]; then
            printf "set-option global lsp_toml_path '$HOME/.config/kak-lsp/kak-lsp-deno.toml'"
        fi
    }

    set global lsp_cmd "kak-lsp -s %val{session} --config %opt{lsp_toml_path}" 

    [...]
}

```
