docs: Add docs for CoC plugin with neovim (#61005)

When docs were moved from aio to adev, the directions for the CoC plugin
were mistakenly dropped.

This brings back the documentation from prior versions:

https://v17.angular.io/guide/language-service#neovim

PR Close #61005
This commit is contained in:
Andrew Miller 2025-04-25 21:59:24 -06:00 committed by Andrew Kushnir
parent 1e2a70c8db
commit f08f8844cb

View file

@ -131,7 +131,42 @@ Either directly install the "Eclipse IDE for Web and JavaScript developers" pack
### Neovim
Angular language service can be used with Neovim by using the [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) plugin.
#### Conquer of Completion with Node.js
The Angular Language Service uses the tsserver, which doesn't follow the LSP specifications exactly. Therefore if you are using neovim or vim with JavaScript or TypeScript or Angular you may find that [Conquer of Completion](https://github.com/neoclide/coc.nvim) (COC) has the fullest implementation of the Angular Language Service and the tsserver. This is because COC ports the VSCode implementation of the tsserver which accommodates the tsserver's implementation.
1. [Setup coc.nvim](https://github.com/neoclide/coc.nvim)
2. Configure the Angular Language Service
Once installed run the `CocConfig` vim command line command to open the config file `coc-settings.json` and add the angular property.
Make sure to substitute the correct paths to your global `node_modules` such that they go to directories which contain `tsserver` and the `ngserver` respectively.
<docs-code header="CocConfig example file coc-settings.json" language="json">
{
"languageserver": {
"angular": {
"command": "ngserver",
"args": [
"--stdio",
"--tsProbeLocations",
"/usr/local/lib/node_modules/typescript/lib/CHANGE/THIS/TO/YOUR/GLOBAL/NODE_MODULES",
"--ngProbeLocations",
"/usr/local/lib/node_modules/@angular/language-server/bin/CHANGE/THIS/TO/YOUR/GLOBAL/NODE_MODULES"
],
"filetypes": ["ts", "typescript", "html"],
"trace.server.verbosity": "verbose"
}
}
}
</docs-code>
HELPFUL: `/usr/local/lib/node_modules/typescript/lib` and `/usr/local/lib/node_modules/@angular/language-server/bin` above should point to the location of your global node modules, which may be different.
#### Built In Neovim LSP
Angular Language Service can be used with Neovim by using the [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) plugin.
1. [Install nvim-lspconfig](https://github.com/neovim/nvim-lspconfig?tab=readme-ov-file#install)
@ -155,4 +190,4 @@ The Angular Language Services then looks at `data.---` within its context, asks
## More information
* For more in-depth information on the implementation, see the [Angular Language Service source](https://github.com/angular/angular/blob/main/packages/language-service/src)
* For more on the design considerations and intentions, see [design documentation here](https://github.com/angular/vscode-ng-language-service/wiki/Design)
* For more on the design considerations and intentions, see [design documentation here](https://github.com/angular/vscode-ng-language-service/wiki/Design)