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

Wed, 25 Sep 2024 15:03:13 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 25 Sep 2024 15:03:13 -0500
changeset 1179
b0a0ba3240b5
parent 1178
8993dc4128de
permissions
-rw-r--r--

No LSP autostart when read-only

I think nvim actually threw out 'view' argc detection, I just use -R and alias
view to it.

1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 return {
1084
76588dcdb04a Add neodev.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1068
diff changeset
2 -- mason is nonlazy so my executable tests work
1064
fcfa295076a8 Apply stylua
Meredith Howard <mhoward@roomag.org>
parents: 1059
diff changeset
3 { "williamboman/mason.nvim", config = true },
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 {
1068
537a428597b5 tweak lazy loading
Meredith Howard <mhoward@roomag.org>
parents: 1064
diff changeset
6 "neovim/nvim-lspconfig",
1131
f3044a1658fc nvim: switch to preferring last symver tag / add exceptions
Meredith Howard <mhoward@roomag.org>
parents: 1128
diff changeset
7 branch = "master",
1068
537a428597b5 tweak lazy loading
Meredith Howard <mhoward@roomag.org>
parents: 1064
diff changeset
8 event = { "BufReadPre", "BufNewFile" },
537a428597b5 tweak lazy loading
Meredith Howard <mhoward@roomag.org>
parents: 1064
diff changeset
9 dependencies = {
1096
8bb51fcd6f2a clean up lsp config
Meredith Howard <mhoward@roomag.org>
parents: 1084
diff changeset
10 { "williamboman/mason-lspconfig.nvim", config = true },
1068
537a428597b5 tweak lazy loading
Meredith Howard <mhoward@roomag.org>
parents: 1064
diff changeset
11 },
1084
76588dcdb04a Add neodev.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1068
diff changeset
12 config = function(_, _)
1179
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
13 local lspconfig = require("lspconfig")
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
14
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
15 lspconfig.util.default_config.capabilities = vim.tbl_deep_extend("force",
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
16 lspconfig.util.default_config.capabilities,
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
17 require("cmp_nvim_lsp").default_capabilities()
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
18 )
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
19
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
20 -- allow view / -R to also stop autostart. no other global flag for this.
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
21 lspconfig.util.default_config.autostart = not vim.list_contains(vim.v.argv, "-R")
1096
8bb51fcd6f2a clean up lsp config
Meredith Howard <mhoward@roomag.org>
parents: 1084
diff changeset
22
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 require("mason-lspconfig").setup_handlers({
1179
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
24 function(server) lspconfig[server].setup({}) end,
1064
fcfa295076a8 Apply stylua
Meredith Howard <mhoward@roomag.org>
parents: 1059
diff changeset
25 gopls = function()
1179
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
26 lspconfig.gopls.setup({
1177
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
27 settings = {
1178
8993dc4128de add assign types gopls hint too
Meredith Howard <mhoward@roomag.org>
parents: 1177
diff changeset
28 -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
1177
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
29 gopls = {
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
30 analyses = {
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
31 unusedvariable = true,
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
32 useany = true,
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
33 },
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
34 hints = {
1178
8993dc4128de add assign types gopls hint too
Meredith Howard <mhoward@roomag.org>
parents: 1177
diff changeset
35 assignVariableTypes = true,
1177
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
36 constantValues = true,
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
37 rangeVariableTypes = true,
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
38 },
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
39 vulncheck = "Imports",
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
40 gofumpt = true,
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
41 staticcheck = true,
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
42 },
93b5d2db30bc more gopls config. add inlay hint toggle
Meredith Howard <mhoward@roomag.org>
parents: 1174
diff changeset
43 },
1022
d509e282ae10 More nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1019
diff changeset
44 })
1059
dc0095e5bbc8 disable rubocop and formatting in solargraph, add standardrb glue
Meredith Howard <mhoward@roomag.org>
parents: 1055
diff changeset
45 end,
1064
fcfa295076a8 Apply stylua
Meredith Howard <mhoward@roomag.org>
parents: 1059
diff changeset
46 solargraph = function()
1179
b0a0ba3240b5 No LSP autostart when read-only
Meredith Howard <mhoward@roomag.org>
parents: 1178
diff changeset
47 lspconfig.solargraph.setup({
1064
fcfa295076a8 Apply stylua
Meredith Howard <mhoward@roomag.org>
parents: 1059
diff changeset
48 init_options = { formatting = false },
1059
dc0095e5bbc8 disable rubocop and formatting in solargraph, add standardrb glue
Meredith Howard <mhoward@roomag.org>
parents: 1055
diff changeset
49 })
dc0095e5bbc8 disable rubocop and formatting in solargraph, add standardrb glue
Meredith Howard <mhoward@roomag.org>
parents: 1055
diff changeset
50 end,
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
51 })
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
52 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
53 },
1128
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
54
1146
2c9d3c1940a4 Add catlee/pull_diags.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1135
diff changeset
55 { "j-hui/fidget.nvim", event = "LspAttach", config = true },
2c9d3c1940a4 Add catlee/pull_diags.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1135
diff changeset
56
1128
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
57 {
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
58 "aznhe21/actions-preview.nvim",
1152
59d9ca2ec2fd Match LSP maps to neovim 0.10 defs
Meredith Howard <mhoward@roomag.org>
parents: 1149
diff changeset
59 event = "LspAttach",
1128
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
60 opts = {
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
61 nui = {
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
62 keymap = { close = { "<ESC>", "<C-c>", "q" } },
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
63 },
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
64 },
30d81fbc6a7b add actions-preview.nvim
Meredith Howard <mhoward@roomag.org>
parents: 1120
diff changeset
65 },
1148
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
66
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
67 {
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
68 "ray-x/lsp_signature.nvim",
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
69 branch = "master",
1154
dc04a7db1e83 Fix signature_help toggle
Meredith Howard <mhoward@roomag.org>
parents: 1152
diff changeset
70 event = "VeryLazy",
1148
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
71 opts = {
1154
dc04a7db1e83 Fix signature_help toggle
Meredith Howard <mhoward@roomag.org>
parents: 1152
diff changeset
72 toggle_key = "<C-S>",
1149
4af7c8156683 One more lsp_signature change
Meredith Howard <mhoward@roomag.org>
parents: 1148
diff changeset
73 select_signature_key = "<M-n>",
1148
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
74 toggle_key_flip_floatwin_setting = true,
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
75 doc_lines = 0,
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
76 floating_window = true,
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
77 fix_pos = true,
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
78 hint_enable = false,
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
79 },
bca491e2be91 Fix lsp_signature.nvim behavior
Meredith Howard <mhoward@roomag.org>
parents: 1146
diff changeset
80 },
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
81 }

mercurial