mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-01-28 11:29:56 -06:00
Neovim: move from lsp-installer to mason
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
u dotfiles.util
|
u dotfiles.util
|
||||||
nvim aniseed.nvim
|
nvim aniseed.nvim
|
||||||
lsp vim.lsp
|
lsp vim.lsp
|
||||||
|
lspconfig lspconfig
|
||||||
nu aniseed.nvim.util
|
nu aniseed.nvim.util
|
||||||
cmp_nvim_lsp cmp_nvim_lsp}})
|
cmp_nvim_lsp cmp_nvim_lsp}})
|
||||||
|
|
||||||
@@ -17,14 +18,14 @@
|
|||||||
(nvim.fn.sign_define sign-level
|
(nvim.fn.sign_define sign-level
|
||||||
{:texthl sign-level :text sign :numhl sign-level})))
|
{:texthl sign-level :text sign :numhl sign-level})))
|
||||||
|
|
||||||
; (define-sign :Error "☢️")
|
(define-sign :Error "☢️")
|
||||||
; (define-sign :Warn "⚠️")
|
(define-sign :Warn "⚠️")
|
||||||
; (define-sign :SignHint "🔎")
|
(define-sign :SignHint "🔎")
|
||||||
; (define-sign :Info "ℹ️")
|
(define-sign :Info "ℹ️")
|
||||||
(define-sign :Error :X)
|
; (define-sign :Error :X)
|
||||||
(define-sign :Warn "!")
|
; (define-sign :Warn "!")
|
||||||
(define-sign :SignHint "?")
|
; (define-sign :SignHint "?")
|
||||||
(define-sign :Info :i)
|
; (define-sign :Info :i)
|
||||||
|
|
||||||
(def core-nmappings
|
(def core-nmappings
|
||||||
{:gd "lua vim.lsp.buf.definition()"
|
{:gd "lua vim.lsp.buf.definition()"
|
||||||
@@ -86,6 +87,8 @@
|
|||||||
:ua [:unwind-all []]
|
:ua [:unwind-all []]
|
||||||
:uw [:unwind-thread []]}})
|
:uw [:unwind-thread []]}})
|
||||||
|
|
||||||
|
(def server-specific-opts {})
|
||||||
|
|
||||||
(defn bind-client-mappings [client]
|
(defn bind-client-mappings [client]
|
||||||
(let [client-name (a.get client :name)
|
(let [client-name (a.get client :name)
|
||||||
mappings (a.get client-nmappings client-name)
|
mappings (a.get client-nmappings client-name)
|
||||||
@@ -124,9 +127,17 @@
|
|||||||
; -- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(1), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
|
; -- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(1), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
|
||||||
(print "LSP Client Attached."))
|
(print "LSP Client Attached."))
|
||||||
|
|
||||||
(when-let [lspi (require :nvim-lsp-installer)]
|
(def base-server-opts
|
||||||
(let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
|
(let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
|
||||||
(defn lsp-execute-command [cmd ...]
|
{: on_attach : capabilities :flags {:debounce_text_changes 150}}))
|
||||||
|
|
||||||
|
(defn default-server-handler [server-name]
|
||||||
|
(let [specific-opts (a.get server-specific-opts server-name {})
|
||||||
|
server (a.get lspconfig server-name)
|
||||||
|
server-opts (a.merge base-server-opts server-opts)]
|
||||||
|
(server.setup server-opts)))
|
||||||
|
|
||||||
|
(defn lsp-execute-command [cmd ...]
|
||||||
(let [buf-uri (vim.uri_from_bufnr 0)
|
(let [buf-uri (vim.uri_from_bufnr 0)
|
||||||
cursor (vim.api.nvim_win_get_cursor 0)
|
cursor (vim.api.nvim_win_get_cursor 0)
|
||||||
r (- (a.first cursor) 1)
|
r (- (a.first cursor) 1)
|
||||||
@@ -134,26 +145,10 @@
|
|||||||
opts [buf-uri r c]
|
opts [buf-uri r c]
|
||||||
args (a.concat opts [...])]
|
args (a.concat opts [...])]
|
||||||
(vim.lsp.buf.execute_command {:command cmd :arguments args})))
|
(vim.lsp.buf.execute_command {:command cmd :arguments args})))
|
||||||
(defn setup-servers []
|
|
||||||
(lspi.on_server_ready (fn [server]
|
|
||||||
(let [opts {: on_attach
|
|
||||||
: capabilities
|
|
||||||
:flags {:debounce_text_changes 150}}]
|
|
||||||
(server:setup opts))))
|
|
||||||
;; (let [lspconfig (require :lspconfig)
|
|
||||||
;; servers (lspi.get_installed_servers)]
|
|
||||||
;; (each [_ server (pairs servers)]
|
|
||||||
;; (server.setup {:on_attach on_attach :flags {:debounce_text_changes 150} })))
|
|
||||||
)
|
|
||||||
(defn on-post-install [] (setup-servers) (nvim.ex.bufdo :e))
|
|
||||||
(setup-servers)
|
|
||||||
(set lspi.post_install_hook on-post-install)
|
|
||||||
(nu.fn-bridge :LspExecuteCommand :dotfiles.plugin.lspconfig
|
|
||||||
:lsp-execute-command {:return false})
|
|
||||||
(u.nnoremap :<leader>li :LspInfo)))
|
|
||||||
|
|
||||||
(comment (let [lspi (require :nvim-lsp-installer)
|
(when-let [mason-lspconfig (require :mason-lspconfig)] (mason-lspconfig.setup)
|
||||||
;lspconfig (require :lspconfig)
|
(mason-lspconfig.setup_handlers {1 default-server-handler}))
|
||||||
servers (lspi.get_installed_servers)]
|
|
||||||
(each [_ server (pairs servers)]
|
(u.nnoremap :<leader>li :LspInfo)
|
||||||
(a.pr server))))
|
(nu.fn-bridge :LspExecuteCommand :dotfiles.plugin.lspconfig
|
||||||
|
:lsp-execute-command {:return false})
|
||||||
|
|||||||
6
nvim/.config/nvim/fnl/dotfiles/plugin/mason.fnl
Normal file
6
nvim/.config/nvim/fnl/dotfiles/plugin/mason.fnl
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
(module dotfiles.plugin.mason
|
||||||
|
{autoload {nvim aniseed.nvim mason mason mason-lspconf mason-lspconfig}})
|
||||||
|
|
||||||
|
(mason.setup {:ui {:icons {:package_installed "✓"}}})
|
||||||
|
|
||||||
|
(mason-lspconf.setup {:ensure_installed [:sumneko_lua]})
|
||||||
@@ -77,7 +77,9 @@
|
|||||||
:tpope/vim-unimpaired {}
|
:tpope/vim-unimpaired {}
|
||||||
:tpope/vim-vinegar {}
|
:tpope/vim-vinegar {}
|
||||||
:wbthomason/packer.nvim {:mod :packer}
|
:wbthomason/packer.nvim {:mod :packer}
|
||||||
:williamboman/nvim-lsp-installer {}
|
;; :williamboman/nvim-lsp-installbuilder {}
|
||||||
|
:williamboman/mason.nvim {:mod :mason
|
||||||
|
:requires [:williamboman/mason-lspconfig.nvim]}
|
||||||
; NeoVim lsp server installs
|
; NeoVim lsp server installs
|
||||||
; :luochen1990/rainbow {}
|
; :luochen1990/rainbow {}
|
||||||
; :thecontinium/asyncomplete-conjure.vim {}
|
; :thecontinium/asyncomplete-conjure.vim {}
|
||||||
|
|||||||
Reference in New Issue
Block a user