Skip to content

Commit 527ae77

Browse files
committed
docs: clarify merging LSP capabilities
Closes #1452
1 parent 60a571e commit 527ae77

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

doc/installation.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,39 @@ This can vary by config, but in general for nvim-lspconfig:
116116
}
117117
```
118118

119+
#### Merging LSP capabilities
120+
121+
Blink.cmp's `get_lsp_capabilities` function includes the built-in LSP capabilities by default. To merge with your own capabilities, use the first argument, which acts as an override.
122+
123+
```lua
124+
local capabilities = {
125+
textDocument = {
126+
foldingRange = {
127+
dynamicRegistration = false,
128+
lineFoldingOnly = true
129+
}
130+
}
131+
}
132+
133+
capabilities = require('blink.cmp').get_lsp_capabilities(capabilities)
134+
135+
-- or equivalently
136+
137+
local capabilities = vim.lsp.protocol.make_client_capabilities()
138+
139+
capabilities = vim.tbl_deep_extend('force', capabilities, require('blink.cmp').get_lsp_capabilities({}, false))
140+
141+
capabilities = vim.tbl_deep_extend('force', {
142+
textDocument = {
143+
foldingRange = {
144+
dynamicRegistration = false,
145+
lineFoldingOnly = true
146+
}
147+
}
148+
})
149+
150+
```
151+
119152
## `mini.deps`
120153

121154
The following section includes only the installation and, optionally, building of the fuzzy matcher. Check the [lazy.nvim](#lazy.nvim) section for recommended configuration options and setting up `nvim-lspconfig`.

0 commit comments

Comments
 (0)