summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fnl/config/lsp/init.fnl3
-rw-r--r--fnl/config/lsp/lsp-installer.fnl62
-rw-r--r--fnl/config/lsp/mason-lspconfig.fnl56
-rw-r--r--fnl/config/lsp/mason.fnl9
-rw-r--r--fnl/config/which-key.fnl5
-rw-r--r--fnl/plugins.fnl4
6 files changed, 72 insertions, 67 deletions
diff --git a/fnl/config/lsp/init.fnl b/fnl/config/lsp/init.fnl
index c20b93c..6c7f823 100644
--- a/fnl/config/lsp/init.fnl
+++ b/fnl/config/lsp/init.fnl
@@ -1,7 +1,8 @@
;; Loads the LSP functionality.
(module config.lsp.init {autoload {: util}})
-(require :config.lsp.lsp-installer)
+(require :config.lsp.mason)
+(require :config.lsp.mason-lspconfig)
(let [handlers (require :config.lsp.handlers)]
(handlers.setup))
diff --git a/fnl/config/lsp/lsp-installer.fnl b/fnl/config/lsp/lsp-installer.fnl
deleted file mode 100644
index 1ad0af7..0000000
--- a/fnl/config/lsp/lsp-installer.fnl
+++ /dev/null
@@ -1,62 +0,0 @@
-;; Loads default handlers and specific language settings.
-(module config.lsp.lsp-installer {autoload {: util}})
-
-(def- default-servers {:bashls true
- :clangd true
- :cssls true
- :dockerls true
- :html true
- :hls true
- :jsonls true
- :pyright true
- :rust_analyzer true
- :terraformls true
- :texlab true
- :tflint true
- :yamlls true
- :taplo true
- :zk true})
-
-(defn- merge [default-servers installed-servers]
- (let [servers default-servers]
- (each [_ server (ipairs installed-servers)]
- (if (not= (. servers server.name) true)
- (tset servers server.name true)))
- (icollect [k (pairs servers)]
- k)))
-
-(defn- handler-opts []
- (let [handlers (require :config.lsp.handlers)]
- {:on_attach handlers.on-attach :capabilities (handlers.capabilities)}))
-
-(defn- jsonls-opts []
- (let [jsonls-opts (require :config.lsp.settings.jsonls)]
- (vim.tbl_deep_extend :force jsonls-opts (handler-opts))))
-
-(defn- sumneko-lua-opts []
- (let [sumneko-lua (require :config.lsp.settings.sumneko-lua)]
- (vim.tbl_deep_extend :force sumneko-lua.opts (handler-opts))))
-
-(defn- pyright-opts []
- (let [pyright (require :config.lsp.settings.pyright)]
- (vim.tbl_deep_extend :force pyright.opts (handler-opts))))
-
-(defn- rust-opts []
- (let [rust (require :config.lsp.settings.rust)]
- (vim.tbl_deep_extend :force rust.opts (handler-opts))))
-
-(defn- get-server-opts [server]
- (match server
- :jsonls (jsonls-opts)
- :pyright (pyright-opts)
- :sumneko_lua (sumneko-lua-opts)
- :rust_analyzer (rust-opts)
- _ (handler-opts)))
-
-(let [lsp-installer (util.load-plugin :nvim-lsp-installer)
- lspconfig (util.load-plugin :lspconfig)]
- (let [servers (merge default-servers (lsp-installer.get_installed_servers))]
- (lsp-installer.setup {:ensure_installed servers})
- (each [_ server (ipairs servers)]
- (let [server-config (. lspconfig server)]
- (server-config.setup (get-server-opts server))))))
diff --git a/fnl/config/lsp/mason-lspconfig.fnl b/fnl/config/lsp/mason-lspconfig.fnl
new file mode 100644
index 0000000..704761d
--- /dev/null
+++ b/fnl/config/lsp/mason-lspconfig.fnl
@@ -0,0 +1,56 @@
+;; TBD
+(module config.lsp.mason-lspconfig {autoload {: util}})
+
+(def- servers [:bashls
+ :clangd
+ :cssls
+ :dockerls
+ :html
+ :hls
+ :jsonls
+ :pyright
+ :rust_analyzer
+ :taplo
+ :terraformls
+ :texlab
+ :sumneko_lua
+ :tflint
+ :yamlls
+ :zk])
+
+(defn- handler-opts []
+ (let [handlers (require :config.lsp.handlers)]
+ {:on_attach handlers.on-attach :capabilities (handlers.capabilities)}))
+
+(defn- jsonls-opts []
+ (let [jsonls-opts (require :config.lsp.settings.jsonls)]
+ (vim.tbl_deep_extend :force jsonls-opts (handler-opts))))
+
+(defn- sumneko-lua-opts []
+ (let [sumneko-lua (require :config.lsp.settings.sumneko-lua)]
+ (vim.tbl_deep_extend :force sumneko-lua.opts (handler-opts))))
+
+(defn- pyright-opts []
+ (let [pyright (require :config.lsp.settings.pyright)]
+ (vim.tbl_deep_extend :force pyright.opts (handler-opts))))
+
+(defn- rust-opts []
+ (let [rust (require :config.lsp.settings.rust)]
+ (vim.tbl_deep_extend :force rust.opts (handler-opts))))
+
+(defn- get-server-opts [server]
+ (match server
+ :jsonls (jsonls-opts)
+ :pyright (pyright-opts)
+ :sumneko_lua (sumneko-lua-opts)
+ :rust_analyzer (rust-opts)
+ _ (handler-opts)))
+
+(def- opts {:ensure_installed servers :automatic_installation true})
+
+(util.use-config :mason-lspconfig opts)
+
+(let [lspconfig (util.load-plugin :lspconfig)]
+ (each [_ server (ipairs servers)]
+ (let [server-config (. lspconfig server)]
+ (server-config.setup (get-server-opts server)))))
diff --git a/fnl/config/lsp/mason.fnl b/fnl/config/lsp/mason.fnl
new file mode 100644
index 0000000..66963cb
--- /dev/null
+++ b/fnl/config/lsp/mason.fnl
@@ -0,0 +1,9 @@
+;; Mason manages external tooling, e.g. lsp, formatters, and linters.
+(module config.lsp.mason {autoload {: util}})
+
+(def- opts {:ui {:icons {:package_installed "✓"
+ :package_pending "➜"
+ :package_uninstalled "✗"}}
+ :max_concurrent_installers 10})
+
+(util.use-config :mason opts)
diff --git a/fnl/config/which-key.fnl b/fnl/config/which-key.fnl
index 608c629..65997b3 100644
--- a/fnl/config/which-key.fnl
+++ b/fnl/config/which-key.fnl
@@ -81,9 +81,8 @@
"Workspace Diagnostics"]
:f ["<cmd>lua vim.lsp.buf.format { async = true }<cr>" :Format]
:i [:<cmd>LspInfo<cr> :Info]
- :I [:<cmd>LspInstallInfo<cr> "Installer Info"]
- :j ["<cmd>lua vim.lsp.diagnostic.goto_next()<CR>" "Next Diagnostic"]
- :k ["<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>" "Prev Diagnostic"]
+ :j ["<cmd>lua vim.lsp.diagnostic.goto_next({buffer=0})<CR>" "Next Diagnostic"]
+ :k ["<cmd>lua vim.lsp.diagnostic.goto_prev({buffer=0})<cr>" "Prev Diagnostic"]
:l ["<cmd>lua vim.lsp.codelens.run()<cr>" "CodeLens Action"]
:q ["<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>" :Quickfix]
:r ["<cmd>lua vim.lsp.buf.rename()<cr>" :Rename]
diff --git a/fnl/plugins.fnl b/fnl/plugins.fnl
index 3985c54..0e41dfb 100644
--- a/fnl/plugins.fnl
+++ b/fnl/plugins.fnl
@@ -14,7 +14,7 @@
:onsails/lspkind-nvim {}
:hrsh7th/cmp-nvim-lsp {}
:neovim/nvim-lspconfig {}
- :williamboman/nvim-lsp-installer {}
+ ;; :williamboman/nvim-lsp-installer {}
:tamago324/nlsp-settings.nvim {}
:jose-elias-alvarez/null-ls.nvim {}
:b0o/SchemaStore.nvim {}
@@ -53,4 +53,6 @@
:stevearc/aerial.nvim {}
:TimUntersberger/neogit {:requires :nvim-lua/plenary.nvim}
:aktersnurra/minibar.nvim {}
+ :williamboman/mason.nvim {:branch :alpha}
+ :williamboman/mason-lspconfig.nvim {}
:s1n7ax/nvim-window-picker {}}