Skip to content

Commit 6bc98e3

Browse files
docs: update configs.md
skip-checks: true
1 parent 05d01a4 commit 6bc98e3

2 files changed

Lines changed: 212 additions & 28 deletions

File tree

doc/configs.md

Lines changed: 109 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,11 +2474,11 @@ Default config:
24742474
{
24752475
editorInfo = {
24762476
name = "Neovim",
2477-
version = "0.12.0-dev+g886efcb853"
2477+
version = "0.12.0-dev+g6b4ec2264e"
24782478
},
24792479
editorPluginInfo = {
24802480
name = "Neovim",
2481-
version = "0.12.0-dev+g886efcb853"
2481+
version = "0.12.0-dev+g6b4ec2264e"
24822482
}
24832483
}
24842484
```
@@ -3086,6 +3086,37 @@ vim.g.markdown_fenced_languages = {
30863086
}
30873087
```
30883088

3089+
Some care must be taken here to correctly infer whether a file is part of a Deno program, or a TS program that
3090+
expects to run in Node or Web Browsers. This supports having a Deno module that is a part of a mostly-not-Deno
3091+
monorepo. We do this by finding the nearest package manager lock file, and the nearest deno.json or deno.jsonc.
3092+
Note that this means that without a deno.json, deno.jsonc, or deno.lock file, this LSP client will not attach.
3093+
3094+
Example:
3095+
3096+
```
3097+
project-root
3098+
+-- node_modules/...
3099+
+-- package-lock.json
3100+
+-- package.json
3101+
+-- packages
3102+
+-- deno-module
3103+
| +-- deno.json
3104+
| +-- package.json <-- It's normal for Deno projects to have package.json files!
3105+
| +-- src
3106+
| +-- index.ts <-- this is a Deno file
3107+
+-- node-module
3108+
+-- package.json
3109+
+-- src
3110+
+-- index.ts <-- a non-Deno file (ie, should use ts_ls or tsgo)
3111+
```
3112+
3113+
From the file being edited, we walk up to find the nearest package manager lockfile. This is PROJECT ROOT.
3114+
From the file being edited, find the nearest deno.json or deno.jsonc. This is DENO ROOT.
3115+
From the file being edited, find the nearest deno.lock. This is DENO LOCK ROOT
3116+
If DENO LOCK ROOT is found, and PROJECT ROOT is missing or shorter, then this is a deno file, and we attach.
3117+
If DENO ROOT is found, and it's longer than or equal to PROJECT ROOT, then this is a Deno file, and we attach.
3118+
Otherwise, we abort, because this is a non-Deno TS file.
3119+
30893120
Snippet to enable the language server:
30903121
```lua
30913122
vim.lsp.enable('denols')
@@ -3114,8 +3145,8 @@ Default config:
31143145
["textDocument/typeDefinition"] = <function 1>
31153146
}
31163147
```
3117-
- `on_attach`: [../lsp/denols.lua:67](../lsp/denols.lua#L67)
3118-
- `root_dir`: [../lsp/denols.lua:67](../lsp/denols.lua#L67)
3148+
- `on_attach`: [../lsp/denols.lua:98](../lsp/denols.lua#L98)
3149+
- `root_dir`: [../lsp/denols.lua:98](../lsp/denols.lua#L98)
31193150
- `settings` :
31203151
```lua
31213152
{
@@ -4876,20 +4907,20 @@ Default config:
48764907
{
48774908
editorInfo = {
48784909
name = "Neovim",
4879-
version = "0.12.0-dev+g886efcb853"
4910+
version = "0.12.0-dev+g6b4ec2264e"
48804911
},
48814912
editorPluginInfo = {
48824913
name = "Neovim LSP",
4883-
version = "0.12.0-dev+g886efcb853"
4914+
version = "0.12.0-dev+g6b4ec2264e"
48844915
},
48854916
extension = {
48864917
name = "Neovim LSP Client",
4887-
version = "0.12.0-dev+g886efcb853"
4918+
version = "0.12.0-dev+g6b4ec2264e"
48884919
},
48894920
ide = {
48904921
name = "Neovim",
48914922
vendor = "Neovim",
4892-
version = "0.12.0-dev+g886efcb853"
4923+
version = "0.12.0-dev+g6b4ec2264e"
48934924
}
48944925
}
48954926
```
@@ -11150,7 +11181,7 @@ Default config:
1115011181
activateSnykIac = "true",
1115111182
activateSnykOpenSource = "true",
1115211183
integrationName = "Neovim",
11153-
integrationVersion = "0.12.0-dev+g886efcb853",
11184+
integrationVersion = "0.12.0-dev+g6b4ec2264e",
1115411185
token = vim.NIL,
1115511186
trustedFolders = {}
1115611187
}
@@ -13007,6 +13038,37 @@ This works without the need of spawning multiple instances of `ts_ls`, saving me
1300713038

1300813039
It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once.
1300913040

13041+
Some care must be taken here to correctly infer whether a file is part of a Deno program, or a TS program that
13042+
expects to run in Node or Web Browsers. This supports having a Deno module using the denols LSP as a part of a
13043+
mostly-not-Deno monorepo. We do this by finding the nearest package manager lock file, and the nearest deno.json
13044+
or deno.jsonc.
13045+
13046+
Example:
13047+
13048+
```
13049+
project-root
13050+
+-- node_modules/...
13051+
+-- package-lock.json
13052+
+-- package.json
13053+
+-- packages
13054+
+-- deno-module
13055+
| +-- deno.json
13056+
| +-- package.json <-- It's normal for Deno projects to have package.json files!
13057+
| +-- src
13058+
| +-- index.ts <-- this is a Deno file
13059+
+-- node-module
13060+
+-- package.json
13061+
+-- src
13062+
+-- index.ts <-- a non-Deno file (ie, should use ts_ls or tsgols)
13063+
```
13064+
13065+
From the file being edited, we walk up to find the nearest package manager lockfile. This is PROJECT ROOT.
13066+
From the file being edited, find the nearest deno.json or deno.jsonc. This is DENO ROOT.
13067+
From the file being edited, find the nearest deno.lock. This is DENO LOCK ROOT
13068+
If DENO LOCK ROOT is found, and PROJECT ROOT is missing or shorter, then this is a deno file, and we abort.
13069+
If DENO ROOT is found, and it's longer than or equal to PROJECT ROOT, then this is a Deno file, and we abort.
13070+
Otherwise, attach at PROJECT ROOT, or the cwd if not found.
13071+
1301013072
Snippet to enable the language server:
1301113073
```lua
1301213074
vim.lsp.enable('ts_ls')
@@ -13042,8 +13104,8 @@ Default config:
1304213104
hostInfo = "neovim"
1304313105
}
1304413106
```
13045-
- `on_attach`: [../lsp/ts_ls.lua:47](../lsp/ts_ls.lua#L47)
13046-
- `root_dir`: [../lsp/ts_ls.lua:47](../lsp/ts_ls.lua#L47)
13107+
- `on_attach`: [../lsp/ts_ls.lua:77](../lsp/ts_ls.lua#L77)
13108+
- `root_dir`: [../lsp/ts_ls.lua:77](../lsp/ts_ls.lua#L77)
1304713109

1304813110
---
1304913111

@@ -13115,18 +13177,49 @@ This works without the need of spawning multiple instances of `tsgo`, saving mem
1311513177

1311613178
It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once.
1311713179

13180+
Some care must be taken here to correctly infer whether a file is part of a Deno program, or a TS program that
13181+
expects to run in Node or Web Browsers. This supports having a Deno module using the denols LSP as a part of a
13182+
mostly-not-Deno monorepo. We do this by finding the nearest package manager lock file, and the nearest deno.json
13183+
or deno.jsonc.
13184+
13185+
Example:
13186+
13187+
```
13188+
project-root
13189+
+-- node_modules/...
13190+
+-- package-lock.json
13191+
+-- package.json
13192+
+-- packages
13193+
+-- deno-module
13194+
| +-- deno.json
13195+
| +-- package.json <-- It's normal for Deno projects to have package.json files!
13196+
| +-- src
13197+
| +-- index.ts <-- this is a Deno file
13198+
+-- node-module
13199+
+-- package.json
13200+
+-- src
13201+
+-- index.ts <-- a non-Deno file (ie, should use ts_ls or tsgols)
13202+
```
13203+
13204+
From the file being edited, we walk up to find the nearest package manager lockfile. This is PROJECT ROOT.
13205+
From the file being edited, find the nearest deno.json or deno.jsonc. This is DENO ROOT.
13206+
From the file being edited, find the nearest deno.lock. This is DENO LOCK ROOT
13207+
If DENO LOCK ROOT is found, and PROJECT ROOT is missing or shorter, then this is a deno file, and we abort.
13208+
If DENO ROOT is found, and it's longer than or equal to PROJECT ROOT, then this is a Deno file, and we abort.
13209+
Otherwise, attach at PROJECT ROOT, or the cwd if not found.
13210+
1311813211
Snippet to enable the language server:
1311913212
```lua
1312013213
vim.lsp.enable('tsgo')
1312113214
```
1312213215

1312313216
Default config:
13124-
- `cmd`: [../lsp/tsgo.lua:18](../lsp/tsgo.lua#L18)
13217+
- `cmd`: [../lsp/tsgo.lua:48](../lsp/tsgo.lua#L48)
1312513218
- `filetypes` :
1312613219
```lua
1312713220
{ "javascript", "javascriptreact", "typescript", "typescriptreact" }
1312813221
```
13129-
- `root_dir`: [../lsp/tsgo.lua:18](../lsp/tsgo.lua#L18)
13222+
- `root_dir`: [../lsp/tsgo.lua:48](../lsp/tsgo.lua#L48)
1313013223

1313113224
---
1313213225

@@ -14218,6 +14311,8 @@ This works without the need of spawning multiple instances of `vtsls`, saving me
1421814311

1421914312
It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once.
1422014313

14314+
This includes the same Deno-excluding logic from `ts_ls`. It is not recommended to enable both `vtsls` and `ts_ls` at the same time!
14315+
1422114316
Snippet to enable the language server:
1422214317
```lua
1422314318
vim.lsp.enable('vtsls')
@@ -14238,7 +14333,7 @@ Default config:
1423814333
hostInfo = "neovim"
1423914334
}
1424014335
```
14241-
- `root_dir`: [../lsp/vtsls.lua:69](../lsp/vtsls.lua#L69)
14336+
- `root_dir`: [../lsp/vtsls.lua:71](../lsp/vtsls.lua#L71)
1424214337

1424314338
---
1424414339

0 commit comments

Comments
 (0)