|
1 | 1 | local M = {} |
2 | 2 | local border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } |
3 | 3 | local signature_cfg = { |
4 | | - bind = true, -- This is mandatory, otherwise border config won't get registered. |
5 | | - -- If you want to hook lspsaga or other signature handler, pls set to false |
6 | | - doc_lines = 2, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); |
7 | | - -- set to 0 if you DO NOT want any API comments be shown |
8 | | - -- This setting only take effect in insert mode, it does not affect signature help in normal |
9 | | - -- mode, 10 by default |
| 4 | + bind = true, -- This is mandatory, otherwise border config won't get registered. |
| 5 | + -- If you want to hook lspsaga or other signature handler, pls set to false |
| 6 | + doc_lines = 2, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); |
| 7 | + -- set to 0 if you DO NOT want any API comments be shown |
| 8 | + -- This setting only take effect in insert mode, it does not affect signature help in normal |
| 9 | + -- mode, 10 by default |
10 | 10 |
|
11 | | - floating_window = true, -- show hint in a floating window, set to false for virtual text only mode |
12 | | - hint_enable = false, -- virtual hint enable |
13 | | - hint_prefix = "🐼 ", -- Panda for parameter |
14 | | - hint_scheme = "String", |
15 | | - use_lspsaga = false, -- set to true if you want to use lspsaga popup |
16 | | - hi_parameter = "Search", -- how your parameter will be highlight |
17 | | - max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down |
18 | | - -- to view the hiding contents |
19 | | - max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width |
20 | | - handler_opts = { |
21 | | - border = "single", -- double, single, shadow, none |
22 | | - }, |
23 | | - -- deprecate !! |
24 | | - -- decorator = {"`", "`"} -- this is no longer needed as nvim give me a handler and it allow me to highlight active parameter in floating_window |
| 11 | + floating_window = true, -- show hint in a floating window, set to false for virtual text only mode |
| 12 | + hint_enable = false, -- virtual hint enable |
| 13 | + hint_prefix = "🐼 ", -- Panda for parameter |
| 14 | + hint_scheme = "String", |
| 15 | + use_lspsaga = false, -- set to true if you want to use lspsaga popup |
| 16 | + hi_parameter = "Search", -- how your parameter will be highlight |
| 17 | + max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down |
| 18 | + -- to view the hiding contents |
| 19 | + max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width |
| 20 | + handler_opts = { |
| 21 | + border = "single", -- double, single, shadow, none |
| 22 | + }, |
| 23 | + -- deprecate !! |
| 24 | + -- decorator = {"`", "`"} -- this is no longer needed as nvim give me a handler and it allow me to highlight active parameter in floating_window |
25 | 25 | } |
26 | 26 |
|
27 | | - |
28 | 27 | local function set_signature_helper(client, bufnr) |
29 | | - local shp = client.server_capabilities.signatureHelpProvider |
30 | | - if shp == true or (type(shp) == "table" and next(shp) ~= nil) then |
31 | | - require("lsp_signature").on_attach(signature_cfg, bufnr) |
32 | | - end |
| 28 | + local shp = client.server_capabilities.signatureHelpProvider |
| 29 | + if shp == true or (type(shp) == "table" and next(shp) ~= nil) then |
| 30 | + require("lsp_signature").on_attach(signature_cfg, bufnr) |
| 31 | + end |
33 | 32 | end |
34 | 33 |
|
35 | 34 | local function set_hover_border(client) |
36 | | - local hp = client.server_capabilities.hoverProvider |
37 | | - if hp == true or (type(hp) == "table" and next(hp) ~= nil) then |
38 | | - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) |
39 | | - end |
| 35 | + local hp = client.server_capabilities.hoverProvider |
| 36 | + if hp == true or (type(hp) == "table" and next(hp) ~= nil) then |
| 37 | + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }) |
| 38 | + end |
40 | 39 | end |
41 | 40 |
|
42 | 41 | M.on_attach = function(client, bufnr) |
43 | | - set_signature_helper(client, bufnr) |
44 | | - set_hover_border(client) |
| 42 | + set_signature_helper(client, bufnr) |
| 43 | + set_hover_border(client) |
45 | 44 | end |
46 | 45 |
|
47 | 46 | M.capabilities = require("cmp_nvim_lsp").default_capabilities() |
48 | 47 | -- M.capabilities = require('coq').lsp_ensure_capabilities() |
| 48 | +-- M.capabilities = require("blink.cmp").get_lsp_capabilities() |
| 49 | + |
49 | 50 | return M |
0 commit comments