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

Sun, 19 Feb 2023 22:48:58 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 19 Feb 2023 22:48:58 -0600
changeset 1037
47dae3972ee0
parent 1035
e46ff6e45c96
child 1043
e55463fb35e2
permissions
-rw-r--r--

include nvim files

1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 return {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 "neovim/nvim-lspconfig",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 {"williamboman/mason.nvim", config = true},
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 {"j-hui/fidget.nvim", config = true},
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 "williamboman/mason-lspconfig.nvim",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 config = function(plugin, opts)
1019
7e42fd320166 Further nvim work
Meredith Howard <mhoward@roomag.org>
parents: 1015
diff changeset
9 require("mason-lspconfig").setup()
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 require("mason-lspconfig").setup_handlers({
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 function(server)
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 require("lspconfig")[server].setup({})
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 end,
1022
d509e282ae10 More nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1019
diff changeset
14 gopls = function ()
d509e282ae10 More nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1019
diff changeset
15 require("lspconfig").gopls.setup({
d509e282ae10 More nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1019
diff changeset
16 settings = { gopls = { gofumpt = true } }
d509e282ae10 More nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1019
diff changeset
17 })
d509e282ae10 More nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1019
diff changeset
18 end
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 })
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 "hrsh7th/nvim-cmp",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 event = "InsertEnter",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 dependencies = {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 "hrsh7th/cmp-buffer",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 "hrsh7th/cmp-path",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 "hrsh7th/cmp-nvim-lsp",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 "hrsh7th/cmp-nvim-lsp-signature-help",
1019
7e42fd320166 Further nvim work
Meredith Howard <mhoward@roomag.org>
parents: 1015
diff changeset
31 "hrsh7th/cmp-nvim-lua",
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 opts = function()
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 local cmp = require("cmp")
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 return {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 completion = {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 completeopt = "menu,menuone,noinsert,noselect",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
38 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39 mapping = cmp.mapping.preset.insert({
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
40 ["<C-b>"] = cmp.mapping.scroll_docs(-4),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41 ["<C-f>"] = cmp.mapping.scroll_docs(4),
1033
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
42 ["<Tab>"] = function(fallback)
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
43 if cmp.visible() then
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
44 cmp.select_next_item()
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
45 else
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
46 cmp.complete()
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
47 end
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
48 end,
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
49 ["<S-Tab>"] = cmp.mapping.select_prev_item(),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
50 ["<C-g>"] = cmp.mapping.abort(),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
51 ["<Right>"] = cmp.mapping.confirm({select = true}),
1033
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
52 ["<Space>"] = function(fallback)
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
53 if cmp.visible() then
1035
e46ff6e45c96 Fix space completion
Meredith Howard <mhoward@roomag.org>
parents: 1033
diff changeset
54 cmp.confirm({select = false}, function()
e46ff6e45c96 Fix space completion
Meredith Howard <mhoward@roomag.org>
parents: 1033
diff changeset
55 vim.api.nvim_feedkeys(" ", "n", false)
e46ff6e45c96 Fix space completion
Meredith Howard <mhoward@roomag.org>
parents: 1033
diff changeset
56 end)
1033
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
57 end
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
58 fallback()
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
59 end,
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
60 }),
1015
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
61 sources = cmp.config.sources({
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
62 { name = "nvim_lsp" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
63 { name = "nvim_lsp_signature_help" },
1019
7e42fd320166 Further nvim work
Meredith Howard <mhoward@roomag.org>
parents: 1015
diff changeset
64 { name = "nvim_lua" },
1033
589244a349f6 tweak completion
Meredith Howard <mhoward@roomag.org>
parents: 1022
diff changeset
65 }, {
1015
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
66 { name = "buffer" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
67 { name = "path" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
68 }),
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
69 experimental = {
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
70 ghost_text = {
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
71 hl_group = "LspCodeLens",
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
72 },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
73 },
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
74 }
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
75 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
76 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
77 }

mercurial