eee3d36

Branches > main > eee3d36 > files

Improve Clojure LSP

Grahp, 2026-10-25

Commit: eee3d369fb20e670b282ba2a288aa6a036586430
Parent: 1795cd4

1 changed file:

nvim/lua/lsp.lua modified (view file)

@@ -12,6 +12,9 @@ local function config(opts)   local name = opts.name +  --- Skip servers that aren't installed, otherwise every buffer logs an error+  if vim.fn.executable(name) == 0 then return end+   opts.cmd = {name}   opts.on_attach = on_attach @@ -19,9 +22,20 @@   lsp.enable(name) end +local clojure_root_markers = {"project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", ".git", "bb.edn"}+ config({name = "clojure-lsp",         filetypes = {"clojure"},-        root_markers = {"project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", ".git", "bb.edn"}})+        --- gd into a library opens a zipfile:// buffer, reuse the project's client+        --- for it instead of starting a new one with no root (which errors)+        root_dir = function(bufnr, on_dir)+          if vim.api.nvim_buf_get_name(bufnr):match("^zipfile:") then+            local client = lsp.get_clients({name = "clojure-lsp"})[1]+            if client then on_dir(client.root_dir) end+            return+          end+          on_dir(vim.fs.root(bufnr, clojure_root_markers))+        end})  config({name = "kotlin-language-server",         filetypes = {"kotlin"},