Wed, 22 Feb 2023 12:40:24 -0600
add goneovim settings
1032
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
1 | local diag_virtual_min_threshold = "WARN" |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
2 | local diag_float_max_threshold = "INFO" |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
3 | |
1016 | 4 | vim.diagnostic.config({ |
1032
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
5 | severity_sort = true, |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
6 | underline = { severity = {min = diag_virtual_min_threshold} }, |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
7 | virtual_text = { true, severity = {min = diag_virtual_min_threshold} }, |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
8 | float = { source = "if_many" }, |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
9 | }) |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
10 | |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
11 | -- Some options are more chill in text mode, this unchills them if a LSP is in |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
12 | -- play. Note they're global |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
13 | vim.api.nvim_create_autocmd("LspAttach", { |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
14 | once = true, |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
15 | group = "lsp_attach", |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
16 | callback = function(args) |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
17 | vim.opt.number = true |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
18 | vim.opt.updatetime = 250 |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
19 | end, |
1016 | 20 | }) |
21 | ||
22 | vim.api.nvim_create_autocmd("LspAttach", { | |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
23 | group = "lsp_attach", |
1016 | 24 | callback = function(args) |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
25 | local bufnr = args.buf |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
26 | local client = vim.lsp.get_client_by_id(args.data.client_id) |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
27 | |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
28 | -- enable auto diags in message area for below threshold |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
29 | vim.api.nvim_create_augroup('lsp_diags', {clear = false}) |
1032
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
30 | vim.api.nvim_create_autocmd("CursorHold", { |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
31 | group = "lsp_diags", |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
32 | buffer = bufnr, |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
33 | callback = function(opts, bufnr, line_nr, client_id) |
1032
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
34 | vim.diagnostic.open_float(nil, { |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
35 | focusable = false, |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
36 | close_events = {"BufLeave", "CursorMoved", "InsertEnter", "FocusLost"}, |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
37 | scope = "line", |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
38 | severity = {max = diag_float_max_threshold}, |
b0497894f69b
Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents:
1031
diff
changeset
|
39 | }) |
1030
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
40 | end, |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
41 | }) |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
42 | |
03d507b3c122
Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents:
1022
diff
changeset
|
43 | end |
1016 | 44 | }) |