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

Wed, 15 May 2024 22:44:16 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 15 May 2024 22:44:16 -0500
changeset 1165
840f0fde07e2
parent 1163
40367220022e
child 1166
34bf03fa07e4
permissions
-rw-r--r--

set up nvim-dap etc

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",
1101
40419d8e3cbb cleanup
Meredith Howard <mhoward@roomag.org>
parents: 1099
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,
28f3c3900576 clean up diagnostic behavior
Meredith Howard <mhoward@roomag.org>
parents: 1083
diff changeset
32 callback = vim.diagnostic.open_float,
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