.config/nvim/lua/config/lsp.lua

Mon, 26 Aug 2024 14:23:43 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 26 Aug 2024 14:23:43 -0500
changeset 1177
93b5d2db30bc
parent 1166
34bf03fa07e4
permissions
-rw-r--r--

more gopls config. add inlay hint toggle

1016
07d37da233ef Add lsp-specific config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 vim.diagnostic.config({
1099
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
2 float = {
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
3 close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
4 focusable = false,
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
5 header = "",
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
6 max_width = 72,
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
7 source = "if_many",
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
8 style = "minimal",
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
9 },
1032
b0497894f69b Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents: 1031
diff changeset
10 severity_sort = true,
1099
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
11 underline = true,
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
12 virtual_text = false,
1030
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
13 })
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
14
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
15 -- 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
16 -- play. Note they're global
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
17 vim.api.nvim_create_autocmd("LspAttach", {
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
18 once = true,
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
19 group = "lsp_attach",
1166
34bf03fa07e4 normalize config.util.autocmd
Meredith Howard <mhoward@roomag.org>
parents: 1163
diff changeset
20 callback = function(_)
1030
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
21 vim.opt.number = true
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
22 vim.opt.updatetime = 250
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
23 end,
1016
07d37da233ef Add lsp-specific config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 })
07d37da233ef Add lsp-specific config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25
07d37da233ef Add lsp-specific config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 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
27 group = "lsp_attach",
1016
07d37da233ef Add lsp-specific config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 callback = function(args)
1032
b0497894f69b Customize LSP float diags further
Meredith Howard <mhoward@roomag.org>
parents: 1031
diff changeset
29 vim.api.nvim_create_autocmd("CursorHold", {
1064
fcfa295076a8 Apply stylua
Meredith Howard <mhoward@roomag.org>
parents: 1062
diff changeset
30 group = vim.api.nvim_create_augroup("lsp_buf_diags", { clear = true }),
1099
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
31 buffer = args.buf,
1166
34bf03fa07e4 normalize config.util.autocmd
Meredith Howard <mhoward@roomag.org>
parents: 1163
diff changeset
32 callback = function(_) vim.diagnostic.open_float() end,
1030
03d507b3c122 Customize LSP more - diag behavior and symbol HL
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
33 })
1064
fcfa295076a8 Apply stylua
Meredith Howard <mhoward@roomag.org>
parents: 1062
diff changeset
34 end,
1016
07d37da233ef Add lsp-specific config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 })

mercurial