summaryrefslogtreecommitdiff
path: root/fnl/plugins/lsp
diff options
context:
space:
mode:
authoraktersnurra <gustaf@gustafrydholm.xyz>2026-04-16 15:10:52 +0200
committeraktersnurra <gustaf@gustafrydholm.xyz>2026-04-17 23:28:47 +0200
commit152fd9d787c7433cad95795992e444250cb83216 (patch)
tree0ae3b4a3b42005dc08b1400981cfc4c1f37297fe /fnl/plugins/lsp
parent83a7f3505a441f1c152229d50a3d6011951a82fc (diff)
Add fff and other nice things such as macros
Diffstat (limited to 'fnl/plugins/lsp')
-rw-r--r--fnl/plugins/lsp/diagnostics.fnl2
-rw-r--r--fnl/plugins/lsp/keymaps.fnl60
-rw-r--r--fnl/plugins/lsp/lspconfig.fnl25
-rw-r--r--fnl/plugins/lsp/mason-lspconfig.fnl7
-rw-r--r--fnl/plugins/lsp/mason.fnl14
-rw-r--r--fnl/plugins/lsp/servers.fnl6
6 files changed, 19 insertions, 95 deletions
diff --git a/fnl/plugins/lsp/diagnostics.fnl b/fnl/plugins/lsp/diagnostics.fnl
index b4aefa6..b8bf5cc 100644
--- a/fnl/plugins/lsp/diagnostics.fnl
+++ b/fnl/plugins/lsp/diagnostics.fnl
@@ -15,7 +15,7 @@
:float {:focusable false
:style :minimal
:border :single
- :source :always
+ :source true
:header ""
:prefix ""}})
diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl
index f312581..3477f0a 100644
--- a/fnl/plugins/lsp/keymaps.fnl
+++ b/fnl/plugins/lsp/keymaps.fnl
@@ -1,50 +1,22 @@
;; Key mappings for lsp.
-(local mappings
- [[:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>" {:desc :Declaration}]
- [:n
- :gd
- "<cmd>Telescope lsp_definitions theme=get_dropdown<cr>"
- {:desc :Definition}]
- [:n
- :gI
- "<cmd>Telescope lsp_implementations theme=get_dropdown<cr>"
- {:desc :Implementation}]
- [:n
- :gr
- "<cmd>Telescope lsp_references theme=get_dropdown<cr>"
- {:desc :References}]
- [:n
- :gl
- "<cmd>lua vim.diagnostic.open_float()<CR>"
- {:desc :Diagnostics}]
- [:n
- :gj
- "<cmd>Telescope diagnostics theme=get_dropdown<cr>"
- {:desc "Telescope Diagnostics"}]
- [:n
- :gw
- "<cmd>Telescope lsp_dynamic_workspace_symbols theme=get_dropdown<cr>"
- {:desc "Workspace Symbols"}]
- [:n
- :gE
- "<cmd>Telescope lsp_type_definitions theme=get_dropdown<cr>"
- {:desc "Type Definitions"}]
- [:n :gm "<cmd>lua vim.lsp.buf.signature_help()<CR>" {:desc :Signature}]
- [:n
- :gM
- "<cmd>Telescope lsp_document_symbols theme=get_dropdown<cr>"
- {:desc "Document Symbols"}]
- [:n :gh "<cmd>lua vim.lsp.buf.code_action()<cr>" {:desc "Code Action"}]
- [:n :gb "<cmd>lua vim.lsp.codelens.run()<cr>" {:desc "Code Lens"}]
- [:n :K "<cmd>lua vim.lsp.buf.hover()<cr>" {:desc "Hover documentation"}]
- [:n :<leader>li :<cmd>LspInfo<cr> {:desc "Lsp Info"}]])
+(import-macros {: keymaps} :macros)
(λ on-attach [buffer]
- (let [opts {:noremap true :silent true : buffer}]
- (each [_ mapping (ipairs mappings)]
- (match mapping
- [mode key cmd desc]
- (vim.keymap.set mode key cmd (vim.tbl_extend :force opts desc))))))
+ (keymaps
+ [:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>" {:desc :Declaration :buffer buffer}]
+ [:n :gd "<cmd>Telescope lsp_definitions theme=get_dropdown<cr>" {:desc :Definition :buffer buffer}]
+ [:n :gI "<cmd>Telescope lsp_implementations theme=get_dropdown<cr>" {:desc :Implementation :buffer buffer}]
+ [:n :gr "<cmd>Telescope lsp_references theme=get_dropdown<cr>" {:desc :References :buffer buffer}]
+ [:n :gl "<cmd>lua vim.diagnostic.open_float()<CR>" {:desc :Diagnostics :buffer buffer}]
+ [:n :gj "<cmd>Telescope diagnostics theme=get_dropdown<cr>" {:desc "Telescope Diagnostics" :buffer buffer}]
+ [:n :gw "<cmd>Telescope lsp_dynamic_workspace_symbols theme=get_dropdown<cr>" {:desc "Workspace Symbols" :buffer buffer}]
+ [:n :gE "<cmd>Telescope lsp_type_definitions theme=get_dropdown<cr>" {:desc "Type Definitions" :buffer buffer}]
+ [:n :gm "<cmd>lua vim.lsp.buf.signature_help()<CR>" {:desc :Signature :buffer buffer}]
+ [:n :gM "<cmd>Telescope lsp_document_symbols theme=get_dropdown<cr>" {:desc "Document Symbols" :buffer buffer}]
+ [:n :gh "<cmd>lua vim.lsp.buf.code_action()<cr>" {:desc "Code Action" :buffer buffer}]
+ [:n :gb "<cmd>lua vim.lsp.codelens.run()<cr>" {:desc "Code Lens" :buffer buffer}]
+ [:n :K "<cmd>lua vim.lsp.buf.hover()<cr>" {:desc "Hover documentation" :buffer buffer}]
+ [:n :<leader>li :<cmd>LspInfo<cr> {:desc "Lsp Info" :buffer buffer}]))
{: on-attach}
diff --git a/fnl/plugins/lsp/lspconfig.fnl b/fnl/plugins/lsp/lspconfig.fnl
deleted file mode 100644
index 192954c..0000000
--- a/fnl/plugins/lsp/lspconfig.fnl
+++ /dev/null
@@ -1,25 +0,0 @@
-;; Configuration for lsp clients.
-
-(λ on-attach []
- (vim.api.nvim_create_autocmd :LspAttach
- {:callback (λ [args]
- (let [{: on-attach} (require :plugins.lsp.keymaps)
- buffer (. args :buf)]
- (on-attach buffer)))}))
-
-(λ config []
- (on-attach)
- (let [diagnostics (require :plugins.lsp.diagnostics)
- mason-lspconfig (require :plugins.lsp.mason-lspconfig)
- ui (require :lspconfig.ui.windows)]
- (set ui.default_options.border :single)
- (diagnostics.setup)
- (mason-lspconfig.setup)))
-
-{1 :neovim/nvim-lspconfig
- :event :BufNew
- :dependencies [:mason.nvim
- :williamboman/mason-lspconfig.nvim
- :b0o/schemastore.nvim
- :saghen/blink.cmp]
- : config}
diff --git a/fnl/plugins/lsp/mason-lspconfig.fnl b/fnl/plugins/lsp/mason-lspconfig.fnl
index 48ea0b5..36b98c2 100644
--- a/fnl/plugins/lsp/mason-lspconfig.fnl
+++ b/fnl/plugins/lsp/mason-lspconfig.fnl
@@ -1,10 +1,6 @@
-;; A bridge plugin between mason and lspconfig, handles installation of lsp and
+;; A bridge plugin between mason and lspconfig, handles installation of lsp and
;; setup hooks for client configurations.
-(local textDocument-handlers
- {:textDocument/hover (vim.lsp.with vim.lsp.handlers.hover)
- :textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help)})
-
(λ capabilities []
(let [blink-cmp (require :blink.cmp)]
(blink-cmp.get_lsp_capabilities)))
@@ -15,7 +11,6 @@
(let [lspconfig (. lspconfigs server)
server-config (or (. servers server) {})]
(tset server-config :capabilities (capabilities))
- (tset server-config :handlers textDocument-handlers)
(lspconfig.setup server-config))))
(λ setup []
diff --git a/fnl/plugins/lsp/mason.fnl b/fnl/plugins/lsp/mason.fnl
deleted file mode 100644
index e9c59ea..0000000
--- a/fnl/plugins/lsp/mason.fnl
+++ /dev/null
@@ -1,14 +0,0 @@
-;; Mason manages external tooling, e.g. lsp, formatters, and linters.
-
-(local icons (require :settings.icons))
-
-(local opts {:ui {:border :single
- :icons {:package_installed (.. (. icons :checkmark) " ")
- :package_pending (.. (. icons :arrow-right) " ")
- :package_uninstalled (.. (. icons :close) " ")}}
- :max_concurrent_installers 10})
-
-{1 :williamboman/mason.nvim
- :cmd :Mason
- :keys [{1 :<leader>m 2 :<cmd>Mason<cr> :desc :Mason}]
- : opts}
diff --git a/fnl/plugins/lsp/servers.fnl b/fnl/plugins/lsp/servers.fnl
index 7d213a8..13c6c9e 100644
--- a/fnl/plugins/lsp/servers.fnl
+++ b/fnl/plugins/lsp/servers.fnl
@@ -10,11 +10,7 @@
:jsonls {:init_options {:providerFormatter false}
:settings {:json {:schemas (let [schemastore (require :schemastore)]
(schemastore.json.schemas))
- :validate {:enable true}}}
- :setup {:commands {:Format [(λ []
- (vim.lsp.buf.range_formatting [] [0 0]
- [(vim.fn.line "$"
- 0)]))]}}}
+ :validate {:enable true}}}}
:ocamllsp {}
:rust_analyzer {:settings {:rust-analyzer {:lens {:enable true}
:checkOnSave {:command :clippy}}}}