summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-01-07 01:28:22 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-01-07 01:28:22 +0100
commit81b0fdd14fab1dfdd5b43fd5dc520709800d78a0 (patch)
treef4a7b8b050c4ed359133ac183053194c0773d96d
parentf005ce541335fb936a85e9997513e94067ef07ae (diff)
Refactor lspconfig
-rw-r--r--fnl/plugins/lsp/lspconfig.fnl32
-rw-r--r--fnl/plugins/lsp/servers.fnl7
-rw-r--r--lazy-lock.json26
3 files changed, 35 insertions, 30 deletions
diff --git a/fnl/plugins/lsp/lspconfig.fnl b/fnl/plugins/lsp/lspconfig.fnl
index cca52a4..84c460f 100644
--- a/fnl/plugins/lsp/lspconfig.fnl
+++ b/fnl/plugins/lsp/lspconfig.fnl
@@ -11,32 +11,34 @@
(let [cmp-lsp (require :cmp_nvim_lsp)]
(cmp-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities))))
+(fn handlers [server]
+ (let [servers (require :plugins.lsp.servers)
+ lspconfig (require :lspconfig)]
+ (let [config (. lspconfig server)
+ opts (or (. servers server) {})]
+ (tset opts :capabilities (capabilities))
+ (config.setup opts))))
+
(fn mason-opts [servers]
- {:ensure_installed (vim.tbl_keys servers) :automatic_installation true})
+ (let [servers (require :plugins.lsp.servers)]
+ {:ensure_installed (vim.tbl_keys servers)
+ :automatic_installation true
+ :handlers [handlers]}))
(fn config []
+ (on-attach)
(let [diagnostics (require :plugins.lsp.diagnostics)
- lspconfig (require :lspconfig)
lspconfig-win (require :lspconfig.ui.windows)
- mason-lspconfig (require :mason-lspconfig)
- servers (require :plugins.lsp.servers)]
+ mason-lspconfig (require :mason-lspconfig)]
(diagnostics.setup)
- (on-attach)
(set lspconfig-win.default_options.border :single)
- (mason-lspconfig.setup (mason-opts servers))
- (mason-lspconfig.setup_handlers [(fn [server-name]
- (let [server-config (. lspconfig
- server-name)
- opts (or (. servers server-name)
- {})]
- (tset opts :capabilities
- (capabilities))
- (server-config.setup opts)))])))
+ (mason-lspconfig.setup (mason-opts))
+ (mason-lspconfig.setup_handlers [setup-handler])))
{1 :neovim/nvim-lspconfig
:event :BufReadPost
:dependencies [:mason.nvim
:williamboman/mason-lspconfig.nvim
- :b0o/SchemaStore.nvim
+ :b0o/schemastore.nvim
:hrsh7th/cmp-nvim-lsp]
: config}
diff --git a/fnl/plugins/lsp/servers.fnl b/fnl/plugins/lsp/servers.fnl
index d5a47fb..ab8cad6 100644
--- a/fnl/plugins/lsp/servers.fnl
+++ b/fnl/plugins/lsp/servers.fnl
@@ -8,7 +8,8 @@
:html {}
:jsonls {:init_options {:providerFormatter false}
:settings {:json {:schemas (let [schemastore (require :schemastore)]
- (schemastore.json.schemas))}}
+ (schemastore.json.schemas))
+ :validate {:enable true}}}
:setup {:commands {:Format [(fn []
(vim.lsp.buf.range_formatting [] [0 0]
[(vim.fn.line "$"
@@ -24,4 +25,6 @@
:taplo {}
:texlab {}
:vale_ls {:filetypes [:markdown :text :org]}
- :yamlls {}}
+ :yamlls {:settings {:yaml {:schemastore {:enable false :url ""}
+ :schemas (let [schemastore (require :schemastore)]
+ (schemastore.yaml.schemas))}}}}
diff --git a/lazy-lock.json b/lazy-lock.json
index e5c18ce..c24e5e4 100644
--- a/lazy-lock.json
+++ b/lazy-lock.json
@@ -1,9 +1,8 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
- "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
- "SchemaStore.nvim": { "branch": "main", "commit": "bdf477a9d30e26881c971bf4b061f0f7b18ce67e" },
+ "LuaSnip": { "branch": "master", "commit": "68153ebb03e65d8a437c6240553645c57f17cf99" },
"alpha-nvim": { "branch": "main", "commit": "29074eeb869a6cbac9ce1fbbd04f5f5940311b32" },
- "better-escape.nvim": { "branch": "master", "commit": "2d75c375e93ce58b07826a0575a5a33fd2cebbda" },
+ "better-escape.nvim": { "branch": "master", "commit": "d62cf3c04163a46f3895c70cc807f5ae68dd8ca1" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-git": { "branch": "main", "commit": "8d8993680d627c8f13bd85094eba84604107dbdd" },
@@ -11,7 +10,7 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-spell": { "branch": "master", "commit": "32a0867efa59b43edbb2db67b0871cfad90c9b66" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
- "conform.nvim": { "branch": "master", "commit": "c4b2efb8aee4af0ef179a9b49ba401de3c4ef5d2" },
+ "conform.nvim": { "branch": "master", "commit": "0e61fc88f725b4411e63b43470a397c6102534c7" },
"dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"dressing.nvim": { "branch": "master", "commit": "94b0d24483d56f3777ee0c8dc51675f21709318c" },
@@ -25,35 +24,36 @@
"hotpot.nvim": { "branch": "master", "commit": "0d0f414682a3e7d1561beac1f1545d8f8541599f" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"leap-spooky.nvim": { "branch": "main", "commit": "45736ee4cd7584204ff5367ef47b4337bdb03aa9" },
- "leap.nvim": { "branch": "main", "commit": "2253ff8e75776a5fc6046d06a68346a97cea40e4" },
+ "leap.nvim": { "branch": "main", "commit": "b63f14d7474002573710d10f02f1af33a4910490" },
"lspkind-nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" },
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
- "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
- "mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" },
+ "mason-lspconfig.nvim": { "branch": "main", "commit": "0989bdf4fdf7b5aa4c74131d7ffccc3f399ac788" },
+ "mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
"minibar.nvim": { "branch": "master", "commit": "353ca4efaf7fff1566bb02e0d7cb51133c41f660" },
- "neogit": { "branch": "master", "commit": "93bf00cd5db1e88ea0ca9105e83f7e97896a7cd2" },
+ "neogit": { "branch": "master", "commit": "760d6d74c328ce2a38b02677bf5161999b992da2" },
"no-clown-fiesta.nvim": { "branch": "master", "commit": "ecf3e186d336e03b5ce7ed4e8f7f72ad983947df" },
"nvim-bqf": { "branch": "main", "commit": "bdc2a4e5bb670b3c0e33ada9c0eec636d93a0748" },
"nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-lint": { "branch": "master", "commit": "d44185d3e57e00c164485a454174294b36ef7067" },
- "nvim-lspconfig": { "branch": "master", "commit": "ce0e625df61be77abe1340fbc9afe9ad39b31dd8" },
+ "nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" },
"nvim-spectre": { "branch": "master", "commit": "d8906855f1949ac97b1e77aaf8d3fe12ed158ddc" },
"nvim-surround": { "branch": "main", "commit": "633a0ab03159569a66b65671b0ffb1a6aed6cf18" },
- "nvim-treesitter": { "branch": "master", "commit": "9288d9b5059e6b409b5077399dc0b377a112d9f2" },
+ "nvim-treesitter": { "branch": "master", "commit": "5032f9952ad2a3a7f7792ac438c4f9e2bd53e0b9" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
- "nvim-various-textobjs": { "branch": "main", "commit": "3d5fe55e79a7d7b64cd715e37b5db7252379f573" },
- "nvim-web-devicons": { "branch": "master", "commit": "3e24abe1ae66532135cec911562f553fe247cb56" },
+ "nvim-various-textobjs": { "branch": "main", "commit": "ec1b756d20ea78895d89a1fb2903b9e121da4e67" },
+ "nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" },
"nvim-window-picker": { "branch": "main", "commit": "2c8200c5cbcdaac01dfe2c049997a1ca178506d8" },
"oil.nvim": { "branch": "master", "commit": "a128e6f75c6a71b7b9ac7ea663949a5209771cd5" },
"org-bullets.nvim": { "branch": "main", "commit": "6e0d60e901bb939eb526139cb1f8d59065132fd9" },
- "orgmode": { "branch": "master", "commit": "9ada64e05c1d0ea5c373c2d69cf2e5b5017b311c" },
+ "orgmode": { "branch": "master", "commit": "c60cf77031a5a9a3c590c6f7b876bc7117603e57" },
"persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
+ "schemastore.nvim": { "branch": "main", "commit": "7ccffe69a8c24fcd8637788955e13d7fd8aa2f46" },
"sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" },
"stay-in-place.nvim": { "branch": "main", "commit": "0628b6db8970fc731abf9608d6f80659b58932c9" },
"telescope-frecency.nvim": { "branch": "master", "commit": "9c18474d0a4b82435ce141c2a21d9bd7b9189272" },