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

Mon, 13 Feb 2023 21:25:15 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 13 Feb 2023 21:25:15 -0600
changeset 1019
7e42fd320166
parent 1015
21950cadff6b
child 1022
d509e282ae10
permissions
-rw-r--r--

Further nvim work

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,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 })
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 "hrsh7th/nvim-cmp",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 event = "InsertEnter",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 dependencies = {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 "hrsh7th/cmp-buffer",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 "hrsh7th/cmp-path",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 "hrsh7th/cmp-nvim-lsp",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 "hrsh7th/cmp-nvim-lsp-signature-help",
1019
7e42fd320166 Further nvim work
Meredith Howard <mhoward@roomag.org>
parents: 1015
diff changeset
26 "hrsh7th/cmp-nvim-lua",
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 opts = function()
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 local cmp = require("cmp")
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 return {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 completion = {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 completeopt = "menu,menuone,noinsert,noselect",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 mapping = cmp.mapping.preset.insert({
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 ["<C-b>"] = cmp.mapping.scroll_docs(-4),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 ["<C-f>"] = cmp.mapping.scroll_docs(4),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 ["<Tab>"] = cmp.mapping.select_next_item(),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
38 ["<S-Tab>"] = cmp.mapping.select_prev_item(),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39 ["<C-g>"] = cmp.mapping.abort(),
1015
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
40 -- FIXME: add extra space after in select case?
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41 ["<Space>"] = cmp.mapping.confirm({select = false}),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
42 ["<Right>"] = cmp.mapping.confirm({select = true}),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
43 }),
1015
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
44 sources = cmp.config.sources({
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
45 { name = "nvim_lsp" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
46 { name = "nvim_lsp_signature_help" },
1019
7e42fd320166 Further nvim work
Meredith Howard <mhoward@roomag.org>
parents: 1015
diff changeset
47 { name = "nvim_lua" },
1015
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
48 { name = "buffer" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
49 { name = "path" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
50 }),
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
51 experimental = {
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
52 ghost_text = {
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
53 hl_group = "LspCodeLens",
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
54 },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
55 },
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
56 }
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
57 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
58 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
59 }

mercurial