My nvim configuration
| 1 | ---@brief |
| 2 | --- |
| 3 | --- https://github.com/hrsh7th/vscode-langservers-extracted |
| 4 | --- |
| 5 | --- `vscode-html-language-server` can be installed via `npm`: |
| 6 | --- ```sh |
| 7 | --- npm i -g vscode-langservers-extracted |
| 8 | --- ``` |
| 9 | --- |
| 10 | --- Neovim does not currently include built-in snippets. `vscode-html-language-server` only provides completions when snippet support is enabled. |
| 11 | --- To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup. |
| 12 | --- |
| 13 | --- The code-formatting feature of the lsp can be controlled with the `provideFormatter` option. |
| 14 | --- |
| 15 | --- ```lua |
| 16 | --- --Enable (broadcasting) snippet capability for completion |
| 17 | --- local capabilities = vim.lsp.protocol.make_client_capabilities() |
| 18 | --- capabilities.textDocument.completion.completionItem.snippetSupport = true |
| 19 | --- |
| 20 | --- vim.lsp.config('html', { |
| 21 | --- capabilities = capabilities, |
| 22 | --- }) |
| 23 | --- ``` |
| 24 | |
| 25 | ---@type vim.lsp.Config |
| 26 | return { |
| 27 | cmd = { 'vscode-html-language-server', '--stdio' }, |
| 28 | filetypes = { 'html', 'templ' }, |
| 29 | root_markers = { 'package.json', '.git' }, |
| 30 | settings = {}, |
| 31 | init_options = { |
| 32 | provideFormatter = true, |
| 33 | embeddedLanguages = { css = true, javascript = true }, |
| 34 | configurationSection = { 'html', 'css', 'javascript' }, |
| 35 | }, |
| 36 | } |