Skip to content

Commit 2e74354

Browse files
docs: update configs.md
skip-checks: true
1 parent c136663 commit 2e74354

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

doc/configs.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,17 +562,12 @@ Default config:
562562
https://github.com/angular/vscode-ng-language-service
563563
`angular-language-server` can be installed via npm `npm install -g @angular/language-server`.
564564

565-
Note, that if you override the default `cmd`, you must also update `on_new_config` to set `new_config.cmd` during startup.
566-
567565
```lua
568566
local project_library_path = "/path/to/project/lib"
569567
local cmd = {"ngserver", "--stdio", "--tsProbeLocations", project_library_path , "--ngProbeLocations", project_library_path}
570568

571569
vim.lsp.config('angularls', {
572570
cmd = cmd,
573-
on_new_config = function(new_config,new_root_dir)
574-
new_config.cmd = cmd
575-
end,
576571
})
577572
```
578573

@@ -12613,10 +12608,10 @@ vim.lsp.config('volar', {
1261312608
tsdk = '/path/to/node_modules/typescript/lib'
1261412609
}
1261512610
},
12616-
on_new_config = function(new_config, new_root_dir)
12611+
before_init = function(params, config)
1261712612
local lib_path = vim.fs.find('node_modules/typescript/lib', { path = new_root_dir, upward = true })[1]
1261812613
if lib_path then
12619-
new_config.init_options.typescript.tsdk = lib_path
12614+
config.init_options.typescript.tsdk = lib_path
1262012615
end
1262112616
end
1262212617
})

doc/configs.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,12 @@ angularls
172172

173173
https://github.com/angular/vscode-ng-language-service
174174
`angular-language-server` can be installed via npm `npm install -g @angular/language-server`.
175-
176-
Note, that if you override the default `cmd`, you must also update `on_new_config` to set `new_config.cmd` during startup.
177175
>lua
178176
local project_library_path = "/path/to/project/lib"
179177
local cmd = {"ngserver", "--stdio", "--tsProbeLocations", project_library_path , "--ngProbeLocations", project_library_path}
180178

181179
vim.lsp.config('angularls', {
182180
cmd = cmd,
183-
on_new_config = function(new_config,new_root_dir)
184-
new_config.cmd = cmd
185-
end,
186181
})
187182

188183
Snippet to enable the language server: >lua
@@ -9362,10 +9357,10 @@ e.g. when working on a [monorepo](https://monorepo.tools/). The alternatives are
93629357
tsdk = '/path/to/node_modules/typescript/lib'
93639358
}
93649359
},
9365-
on_new_config = function(new_config, new_root_dir)
9360+
before_init = function(params, config)
93669361
local lib_path = vim.fs.find('node_modules/typescript/lib', { path = new_root_dir, upward = true })[1]
93679362
if lib_path then
9368-
new_config.init_options.typescript.tsdk = lib_path
9363+
config.init_options.typescript.tsdk = lib_path
93699364
end
93709365
end
93719366
})

0 commit comments

Comments
 (0)