|
|
@ -6,118 +6,151 @@
|
|
|
|
;; $ rake init:local-nvim[DIR]
|
|
|
|
;; $ rake init:local-nvim[DIR]
|
|
|
|
|
|
|
|
|
|
|
|
(local lspconfig (require :lspconfig))
|
|
|
|
(local lspconfig (require :lspconfig))
|
|
|
|
(local {: lsp} vim)
|
|
|
|
(local {: iter : lsp} vim)
|
|
|
|
|
|
|
|
|
|
|
|
; (lsp.set_log_level :debug)
|
|
|
|
; (lsp.set_log_level :debug)
|
|
|
|
|
|
|
|
|
|
|
|
;; Use rounded borders for :LspInfo
|
|
|
|
;; rounded borders
|
|
|
|
(let [{: default_options} (require :lspconfig.ui.windows)]
|
|
|
|
|
|
|
|
(tset default_options :border :rounded))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(let [configs (require :lspconfig.configs)]
|
|
|
|
|
|
|
|
(tset configs :steep {:default_config {:cmd ["steep langserver"]
|
|
|
|
|
|
|
|
:filetypes [:ruby]
|
|
|
|
|
|
|
|
:root_dir #(lspconfig.util.find_git_ancestor $1)
|
|
|
|
|
|
|
|
:settings {}}}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; default hover windows to have borders
|
|
|
|
|
|
|
|
(let [{: hover} lsp.handlers]
|
|
|
|
(let [{: hover} lsp.handlers]
|
|
|
|
(tset lsp.handlers :textDocument/hover (lsp.with hover {:border :rounded}))
|
|
|
|
(tset lsp.handlers :textDocument/hover (lsp.with hover {:border :rounded}))
|
|
|
|
(tset lsp.handlers :textDocument/signatureHelp
|
|
|
|
(tset lsp.handlers :textDocument/signatureHelp
|
|
|
|
(lsp.with hover {:border :rounded})))
|
|
|
|
(lsp.with hover {:border :rounded})))
|
|
|
|
|
|
|
|
|
|
|
|
(let [opts {:noremap true :silent true}]
|
|
|
|
;; set up key mappings
|
|
|
|
(vim.keymap.set :n :<leader>e vim.diagnostic.open_float opts)
|
|
|
|
(let [{: nvim_create_autocmd} vim.api
|
|
|
|
(vim.keymap.set :n :<leader>q vim.diagnostic.setloclist opts))
|
|
|
|
opts {:noremap true :silent true}
|
|
|
|
|
|
|
|
callback (fn []
|
|
|
|
(fn on-attach [client bufnr]
|
|
|
|
(vim.keymap.set :n :<leader>e vim.diagnostic.open_float opts)
|
|
|
|
(vim.api.nvim_buf_set_option bufnr :omnifunc "v:lua.vim.lsp.omnifunc")
|
|
|
|
(vim.keymap.set :n :<leader>q vim.diagnostic.setloclist opts)
|
|
|
|
(let [bufopts {:noremap true :silent true :buffer bufnr}]
|
|
|
|
;; for back-compat - remove once muscle memory has been remapped gd to CTRL+]
|
|
|
|
(vim.keymap.set :n :gD lsp.buf.declaration bufopts)
|
|
|
|
(vim.keymap.set :n :gd lsp.buf.definition opts)
|
|
|
|
(vim.keymap.set :n :gd lsp.buf.definition bufopts)
|
|
|
|
;; switch out formatting a single line for formatting the whole file instead
|
|
|
|
(vim.keymap.set :n :gi lsp.buf.implementation bufopts)
|
|
|
|
(vim.keymap.set :n :gqq #(lsp.buf.format {:async true}) opts))]
|
|
|
|
(vim.keymap.set :n :<leader>D lsp.buf.type_definition bufopts)
|
|
|
|
(nvim_create_autocmd :LspAttach {: callback}))
|
|
|
|
(vim.keymap.set :n :<leader>lf #(lsp.buf.format {:async true}) bufopts)))
|
|
|
|
|
|
|
|
|
|
|
|
(lspconfig.pyright.setup {})
|
|
|
|
(fn on-attach-do [...]
|
|
|
|
(lspconfig.terraformls.setup {})
|
|
|
|
(let [fns [...]] ; https://benaiah.me/posts/everything-you-didnt-want-to-know-about-lua-multivals/
|
|
|
|
(lspconfig.yamlls.setup {:settings {:yaml {:schemas {"https://json.schemastore.org/github-workflow.json" :/.github/workflows/*}}}})
|
|
|
|
(fn [client bufnr]
|
|
|
|
|
|
|
|
(on-attach client bufnr)
|
|
|
|
;;; efm-langserver
|
|
|
|
(each [_ f (ipairs fns)]
|
|
|
|
|
|
|
|
(f client bufnr)))))
|
|
|
|
(let [fmt #{:formatCommand $1 :formatStdin true}
|
|
|
|
|
|
|
|
lint #{:lintCommand $1 :lintFormats $2 :lintStdin true}
|
|
|
|
(fn attach-navic [client bufnr]
|
|
|
|
fennel [(fmt "fnlfmt /dev/stdin")
|
|
|
|
((. (require :nvim-navic) :attach) client bufnr))
|
|
|
|
(lint (-> (iter [:fennel
|
|
|
|
|
|
|
|
:--globals
|
|
|
|
(fn disable-fmt [client]
|
|
|
|
"vim,hs,spoon"
|
|
|
|
(set client.resolved_capabilities.document_formatting false))
|
|
|
|
:--raw-errors
|
|
|
|
|
|
|
|
"$(realpath --relative-to . ${INPUT})"
|
|
|
|
(fn setup-lsp [lsp config]
|
|
|
|
:2>&1])
|
|
|
|
(let [{: setup} (. lspconfig lsp)]
|
|
|
|
(: :join " ")) ["%f:%l: %m"])]
|
|
|
|
(setup (or config {:on_attach on-attach}))))
|
|
|
|
yaml [(fmt "yamlfmt -in")]]
|
|
|
|
|
|
|
|
(lspconfig.efm.setup {:init_options {:documentFormatting true
|
|
|
|
;; efm-langserver things
|
|
|
|
:hover true
|
|
|
|
(local fmt #{:formatCommand $1 :formatStdin true})
|
|
|
|
:documentSymbol true
|
|
|
|
(local lint #{:lintCommand $1 :lintFormats $2 :lintStdin true})
|
|
|
|
:codeAction true
|
|
|
|
|
|
|
|
:completion true}
|
|
|
|
(local fennel-lint
|
|
|
|
:settings {:languages {: fennel : yaml}}
|
|
|
|
"fennel --globals vim,hs,spoon --raw-errors $(realpath --relative-to . ${INPUT}) 2>&1")
|
|
|
|
:filetypes [:fennel :yaml]}))
|
|
|
|
|
|
|
|
|
|
|
|
(local fennel [(fmt "fnlfmt /dev/stdin") (lint fennel-lint ["%f:%l: %m"])])
|
|
|
|
; :settings {:languages {: fennel
|
|
|
|
(local eslint
|
|
|
|
; : js
|
|
|
|
{:lintCommand "eslint -f visualstudio --stdin --stdin-filename ${INPUT}"
|
|
|
|
; :typescript js
|
|
|
|
:lintIgnoreExitCode true
|
|
|
|
; :typescriptreact js
|
|
|
|
:lintStdin true
|
|
|
|
; :vue [(fmt "prettier --stdin-filepath ${INPUT}")]
|
|
|
|
:lintFormats ["%f(%l,%c): %tarning %m" "%f(%l,%c): %rror %m"]})
|
|
|
|
; :yaml [(fmt "yamlfmt -in")]}
|
|
|
|
|
|
|
|
; :lintDebounce 1000000000}
|
|
|
|
(local prettier (fmt "prettier --stdin-filepath ${INPUT}"))
|
|
|
|
; :filetypes [:fennel
|
|
|
|
(local javascript [eslint prettier])
|
|
|
|
; :javascript
|
|
|
|
(local yamlfmt (fmt "yamlfmt -in"))
|
|
|
|
; :typescript
|
|
|
|
(local shellcheck {:lintCommand "shellcheck -f gcc -x"
|
|
|
|
; :typescriptreact
|
|
|
|
:lintSource :shellcheck
|
|
|
|
; :vue
|
|
|
|
:lintFormats ["%f:%l:%c: %trror: %m"
|
|
|
|
; :yaml]}))
|
|
|
|
"%f:%l:%c: %tarning: %m"
|
|
|
|
|
|
|
|
"%f:%l:%c: %tote: %m"]})
|
|
|
|
; (fn on-attach [_client bufnr])
|
|
|
|
|
|
|
|
|
|
|
|
(setup-lsp :efm {:on_attach on-attach
|
|
|
|
; (let [bufopts {:noremap true :silent true :buffer bufnr}]
|
|
|
|
:init_options {:documentFormatting true
|
|
|
|
; (vim.keymap.set :n :gd lsp.buf.definition bufopts) ; here for back-compat - remove once muscle memory has been remapped to CTRL+]
|
|
|
|
:hover true
|
|
|
|
; (vim.keymap.set :n :gqq #(lsp.buf.format {:async true}) bufopts)))
|
|
|
|
:documentSymbol true
|
|
|
|
|
|
|
|
:codeAction true
|
|
|
|
; (fn on-attach-do [...]
|
|
|
|
:completion true}
|
|
|
|
; (let [fns [...]] ; https://benaiah.me/posts/everything-you-didnt-want-to-know-about-lua-multivals/
|
|
|
|
:settings {:languages {: fennel
|
|
|
|
; (fn [client bufnr]
|
|
|
|
: javascript
|
|
|
|
; (on-attach client bufnr)
|
|
|
|
:sh [shellcheck]
|
|
|
|
; (each [_ f (ipairs fns)]
|
|
|
|
:typescript javascript
|
|
|
|
; (f client bufnr)))))
|
|
|
|
:typescriptreact javascript
|
|
|
|
;
|
|
|
|
:vue [prettier]
|
|
|
|
; (fn attach-navic [client bufnr]
|
|
|
|
:yaml [yamlfmt]}}
|
|
|
|
; ((. (require :nvim-navic) :attach) client bufnr))
|
|
|
|
:filetypes [:fennel
|
|
|
|
;
|
|
|
|
:javascript
|
|
|
|
; (fn enable-fmt [client bufnr]
|
|
|
|
:sh
|
|
|
|
; (let [bufopts {:noremap true :silent true :buffer bufnr}]
|
|
|
|
:typescript
|
|
|
|
; (vim.keymap.set :n :<leader>lf #(lsp.buf.format {:async true}) bufopts)))
|
|
|
|
:typescriptreact
|
|
|
|
;
|
|
|
|
:vue
|
|
|
|
; (fn disable-rename [client]
|
|
|
|
:yaml]})
|
|
|
|
; (set client.server_capabilities.rename false))
|
|
|
|
|
|
|
|
;
|
|
|
|
(setup-lsp :ansiblels)
|
|
|
|
; (fn setup-lsp [lsp config]
|
|
|
|
(setup-lsp :elmls)
|
|
|
|
; (let [{: setup} (. lspconfig lsp)]
|
|
|
|
(setup-lsp :fennel_ls {:settings {:fennel-ls {:extra-globals "hs spoon vim"}}})
|
|
|
|
; (setup (or config {:on_attach on-attach}))))
|
|
|
|
(setup-lsp :pyright
|
|
|
|
;
|
|
|
|
{:on_attach on-attach
|
|
|
|
; ;; efm-langserver things
|
|
|
|
:settings {:python {:analysis {:autoImportCompletions true}}}})
|
|
|
|
; (local fmt #{:formatCommand $1 :formatStdin true})
|
|
|
|
|
|
|
|
; (local lint #{:lintCommand $1 :lintFormats $2 :lintStdin true})
|
|
|
|
(setup-lsp :ruff)
|
|
|
|
;
|
|
|
|
(setup-lsp :ruby_lsp)
|
|
|
|
; (local fennel-lint
|
|
|
|
(setup-lsp :rust_analyzer
|
|
|
|
; "fennel --globals vim,hs,spoon --raw-errors $(realpath --relative-to . ${INPUT}) 2>&1")
|
|
|
|
{:on_attach on-attach
|
|
|
|
;
|
|
|
|
:cmd [:rustup :run :stable :rust-analyzer]
|
|
|
|
; (local eslint
|
|
|
|
:settings {:rust-analyzer {:checkOnSave {:command :clippy}}}})
|
|
|
|
; {:lintCommand "eslint -f visualstudio --stdin --stdin-filename ${INPUT}"
|
|
|
|
|
|
|
|
; :lintIgnoreExitCode true
|
|
|
|
(setup-lsp :terraformls)
|
|
|
|
; :lintStdin true
|
|
|
|
|
|
|
|
; :lintFormats ["%f(%l,%c): %tarning %m" "%f(%l,%c): %rror %m"]})
|
|
|
|
; (setup-lsp :tsserver {:on_attach (on-attach-do attach-navic disable-fmt)})
|
|
|
|
;
|
|
|
|
(setup-lsp :vuels {:on_attach (on-attach-do attach-navic disable-fmt)})
|
|
|
|
; (local eslintd-fmt
|
|
|
|
|
|
|
|
; (fmt "eslint_d --stdin --fix-to-stdout --stdin-filename=${INPUT}"))
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
; ;; setup efm
|
|
|
|
|
|
|
|
; (let [fennel [(fmt "fnlfmt /dev/stdin") (lint fennel-lint ["%f:%l: %m"])]
|
|
|
|
|
|
|
|
; js [eslint eslintd-fmt]]
|
|
|
|
|
|
|
|
; (setup-lsp :efm {:on_attach (on-attach-do enable-fmt)
|
|
|
|
|
|
|
|
; :init_options {:documentFormatting true
|
|
|
|
|
|
|
|
; :hover true
|
|
|
|
|
|
|
|
; :documentSymbol true
|
|
|
|
|
|
|
|
; :codeAction true
|
|
|
|
|
|
|
|
; :completion true}
|
|
|
|
|
|
|
|
; :settings {:languages {: fennel
|
|
|
|
|
|
|
|
; : js
|
|
|
|
|
|
|
|
; :typescript js
|
|
|
|
|
|
|
|
; :typescriptreact js
|
|
|
|
|
|
|
|
; :vue [(fmt "prettier --stdin-filepath ${INPUT}")]
|
|
|
|
|
|
|
|
; :yaml [(fmt "yamlfmt -in")]}
|
|
|
|
|
|
|
|
; :lintDebounce 1000000000}
|
|
|
|
|
|
|
|
; :filetypes [:fennel
|
|
|
|
|
|
|
|
; :javascript
|
|
|
|
|
|
|
|
; :typescript
|
|
|
|
|
|
|
|
; :typescriptreact
|
|
|
|
|
|
|
|
; :vue
|
|
|
|
|
|
|
|
; :yaml]}))
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
; (setup-lsp :ansiblels)
|
|
|
|
|
|
|
|
; (setup-lsp :elmls)
|
|
|
|
|
|
|
|
; (setup-lsp :fennel_ls {:settings {:fennel-ls {:extra-globals "hs spoon vim"}}})
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
; (setup-lsp :pyright
|
|
|
|
|
|
|
|
; {:on_attach on-attach
|
|
|
|
|
|
|
|
; :settings {:python {:analysis {:autoImportCompletions true}}}})
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
; (setup-lsp :ruby_lsp)
|
|
|
|
|
|
|
|
; (setup-lsp :ruff {:on_attach (on-attach-do enable-fmt)})
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
; (setup-lsp :rust_analyzer
|
|
|
|
|
|
|
|
; {:on_attach on-attach
|
|
|
|
|
|
|
|
; :cmd [:rustup :run :stable :rust-analyzer]
|
|
|
|
|
|
|
|
; :settings {:rust-analyzer {:checkOnSave {:command :clippy}}}})
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
; (setup-lsp :ts_ls {:on_attach (on-attach-do attach-navic)})
|
|
|
|
|
|
|
|
; (setup-lsp :vuels {:on_attach (on-attach-do attach-navic)})
|
|
|
|
|
|
|
|
|
|
|
|
;; TODO
|
|
|
|
;; TODO
|
|
|
|
;; https://github.com/Shopify/ruby-lsp/issues/188#issuecomment-1268932965
|
|
|
|
;; https://github.com/Shopify/ruby-lsp/issues/188#issuecomment-1268932965
|
|
|
@ -143,4 +176,3 @@
|
|
|
|
; (setup-lsp :ruby_ls {:on_attach (on-attach-do request-diagnostics)})))
|
|
|
|
; (setup-lsp :ruby_ls {:on_attach (on-attach-do request-diagnostics)})))
|
|
|
|
|
|
|
|
|
|
|
|
{: setup-lsp}
|
|
|
|
{: setup-lsp}
|
|
|
|
|
|
|
|
|
|
|
|