summaryrefslogtreecommitdiff
path: root/dot_config/nvim/fnl/plugins/lsp/init.fnl
diff options
context:
space:
mode:
authorChloƩ Vulquin <code@toast.bunkerlabs.net>2024-07-24 19:19:26 +0200
committerChloƩ Vulquin <code@toast.bunkerlabs.net>2024-07-24 19:19:26 +0200
commit01586921b3d5f2ac1ccf8196d3ad9b4b3ddd31f3 (patch)
treed740ac5e8943e48ee4132efc4633051d6cdf1d48 /dot_config/nvim/fnl/plugins/lsp/init.fnl
parentnvim: ignore lazy-lock.json (diff)
nvim: rewrite config in fennel
One file isn't done, and there's also the question of ftplugin and co. One step at a time though, eh?
Diffstat (limited to '')
-rw-r--r--dot_config/nvim/fnl/plugins/lsp/init.fnl33
1 files changed, 33 insertions, 0 deletions
diff --git a/dot_config/nvim/fnl/plugins/lsp/init.fnl b/dot_config/nvim/fnl/plugins/lsp/init.fnl
new file mode 100644
index 0000000..10685d2
--- /dev/null
+++ b/dot_config/nvim/fnl/plugins/lsp/init.fnl
@@ -0,0 +1,33 @@
+(import-macros {: tbl : recc} :toast.macros)
+
+(fn gopts [plist]
+ {:clangd {}
+ :clojure_lsp {:root_dir (plist :project.clj :deps.edn :bb.edn :build.boot :shadow-cljs.edn :.git)}
+ :denols {:autostart false
+ :root_dir (plist :deno.json :deno.jsonc)}
+ :gopls {}
+ :ltex {}
+ :lua_ls {}
+ :texlab {:filetypes [:tex :plaintex :bib :latex]}
+ :tsserver {:autostart false
+ :root_dir (plist :tsconfig.json :package.json)}
+ :zls {}})
+
+(local attach (require :plugins.lsp.attach))
+(local caps (require :plugins.lsp.capabilities))
+
+[(tbl :neovim/nvim-lspconfig &
+ :config (fn [_ opts]
+ (each [k v (pairs opts)]
+ (set v.on_attach (or attach v.on_attach))
+ (when (= :table (type caps))
+ (set v.capabilities (or v.capabilities caps)))
+ (let [s (. (require :lspconfig) k)
+ c (or v.cmd s.document_config.default_config.cmd)]
+ (when (not= 0 (vim.fn.executable (. c 1)))
+ (s.setup v)))))
+ :opts (fn []
+ (let [plist (fn [...]
+ (local p (recc :lspconfig.util :root_pattern ...))
+ #(p $))]
+ (gopts plist))))]