Add back null-ls
This commit is contained in:
parent
7ae183d64b
commit
a6a553c6b0
@ -191,42 +191,48 @@
|
|||||||
:config
|
:config
|
||||||
(module-call! :plugin.lsp :configure))
|
(module-call! :plugin.lsp :configure))
|
||||||
|
|
||||||
|
;; null-ls.nvim
|
||||||
|
(use! :jose-elias-alvarez/null-ls.nvim
|
||||||
|
:after :nvim-lspconfig
|
||||||
|
:config
|
||||||
|
(module-call! :plugin.lsp :setup-null-ls))
|
||||||
|
|
||||||
;; nvim-jdtls
|
;; nvim-jdtls
|
||||||
(use! :mfussenegger/nvim-jdtls
|
(use! :mfussenegger/nvim-jdtls
|
||||||
:config
|
:config
|
||||||
(module-call! :plugin.jdtls :configure))
|
(module-call! :plugin.jdtls :configure))
|
||||||
|
|
||||||
;; formatter.nvim
|
;; formatter.nvim
|
||||||
(use! :mhartington/formatter.nvim
|
;(use! :mhartington/formatter.nvim
|
||||||
:cmd [ :Format :FormatWrite ]
|
; :cmd [ :Format :FormatWrite ]
|
||||||
:setup
|
; :setup
|
||||||
(bind! :n :<leader>o "<cmd>Format<cr>")
|
; (bind! :n :<leader>o "<cmd>Format<cr>")
|
||||||
(bind! :v :<leader>o ":Format<cr>")
|
; (bind! :v :<leader>o ":Format<cr>")
|
||||||
:config
|
; :config
|
||||||
(setup! :formatter
|
; (setup! :formatter
|
||||||
:logging true
|
; :logging true
|
||||||
:log_level _G.vim.log.levels.WARN
|
; :log_level _G.vim.log.levels.WARN
|
||||||
:filetype {
|
; :filetype {
|
||||||
:c [ (module-fn! :formatter.filetypes.c :astyle) ]
|
; :c [ (module-fn! :formatter.filetypes.c :astyle) ]
|
||||||
:cpp [ (module-fn! :formatter.filetypes.cpp :astyle) ]
|
; :cpp [ (module-fn! :formatter.filetypes.cpp :astyle) ]
|
||||||
:cmake [
|
; :cmake [
|
||||||
(module-fn! :formatter.filetypes.cmake :cmakeformat) ]
|
; (module-fn! :formatter.filetypes.cmake :cmakeformat) ]
|
||||||
:java [ (fn [] {:exe :astyle
|
; :java [ (fn [] {:exe :astyle
|
||||||
:stdin true
|
; :stdin true
|
||||||
:args [ :--mode=java ]}) ]
|
; :args [ :--mode=java ]}) ]
|
||||||
:sh [ (module-fn! :formatter.filetypes.sh :shfmt) ]
|
; :sh [ (module-fn! :formatter.filetypes.sh :shfmt) ]
|
||||||
:rust [ (module-fn! :formatter.filetypes.rust :rustfmt) ]
|
; :rust [ (module-fn! :formatter.filetypes.rust :rustfmt) ]
|
||||||
:tex [ (module-fn! :formatter.filetypes.latex :latexindent) ]
|
; :tex [ (module-fn! :formatter.filetypes.latex :latexindent) ]
|
||||||
:python [ (module-fn! :formatter.filetypes.python :yapf) ]
|
; :python [ (module-fn! :formatter.filetypes.python :yapf) ]
|
||||||
:json [ (module-fn! :formatter.filetypes.json :prettier) ]
|
; :json [ (module-fn! :formatter.filetypes.json :prettier) ]
|
||||||
:html [ (module-fn! :formatter.filetypes.html :prettier) ]
|
; :html [ (module-fn! :formatter.filetypes.html :prettier) ]
|
||||||
:css [ (module-fn! :formatter.filetypes.css :prettier) ]
|
; :css [ (module-fn! :formatter.filetypes.css :prettier) ]
|
||||||
:javascript [ (module-fn! :formatter.filetypes.javascript :prettier) ]
|
; :javascript [ (module-fn! :formatter.filetypes.javascript :prettier) ]
|
||||||
:markdown [
|
; :markdown [
|
||||||
(module-fn! :formatter.filetypes.markdown :prettier ) ]
|
; (module-fn! :formatter.filetypes.markdown :prettier ) ]
|
||||||
:fennel [ (fn [] {:exe :fnlfmt
|
; :fennel [ (fn [] {:exe :fnlfmt
|
||||||
:stdin true
|
; :stdin true
|
||||||
:args [ "-" ]})]}))
|
; :args [ "-" ]})]}))
|
||||||
|
|
||||||
;; Sync all packages on first launch
|
;; Sync all packages on first launch
|
||||||
(if _G.first_launch
|
(if _G.first_launch
|
||||||
|
@ -21,8 +21,13 @@
|
|||||||
(bind! :n :<leader>rn vim.lsp.buf.rename buf)
|
(bind! :n :<leader>rn vim.lsp.buf.rename buf)
|
||||||
(bind! :n :<leader>cn vim.lsp.buf.code_action buf)
|
(bind! :n :<leader>cn vim.lsp.buf.code_action buf)
|
||||||
; (bind! :n :gr vim.lsp.buf.references buf)
|
; (bind! :n :gr vim.lsp.buf.references buf)
|
||||||
(when (= client.name :rust_analyzer)
|
(bind! [ :n :v ] :<leader>o
|
||||||
(bind! [ :n :v ] :<leader>o #(vim.lsp.buf.format {:async true})))
|
#(vim.lsp.buf.format { :filter
|
||||||
|
;; use null-ls for formatting
|
||||||
|
(fn [client] (or
|
||||||
|
(= client.name :null-ls)
|
||||||
|
(= client.name :rust_analyzer)))
|
||||||
|
:async true }) buf)
|
||||||
|
|
||||||
;; Use builtin formatexpr
|
;; Use builtin formatexpr
|
||||||
(vim.api.nvim_buf_set_option buf :formatexpr "")
|
(vim.api.nvim_buf_set_option buf :formatexpr "")
|
||||||
@ -106,4 +111,38 @@
|
|||||||
:diagnostics {
|
:diagnostics {
|
||||||
:globals [ "vim" ] }}})))
|
:globals [ "vim" ] }}})))
|
||||||
|
|
||||||
{: configure : on-attach : get-data-dir }
|
(fn setup-null-ls []
|
||||||
|
(let [builtins (. (require :null-ls) :builtins)]
|
||||||
|
(setup! :null-ls
|
||||||
|
:on_attach (fn [client buf]
|
||||||
|
(bind! [ :n :v ]
|
||||||
|
:<leader>o
|
||||||
|
#(vim.lsp.buf.format
|
||||||
|
{ :filter
|
||||||
|
;; use null-ls for formatting
|
||||||
|
(fn [client]
|
||||||
|
(or
|
||||||
|
(= client.name :null-ls)
|
||||||
|
(= client.name :rust_analyzer)))
|
||||||
|
:async true }) buf)
|
||||||
|
(vim.api.nvim_buf_set_option buf :formatexpr ""))
|
||||||
|
:sources [
|
||||||
|
builtins.formatting.astyle
|
||||||
|
builtins.formatting.prettier
|
||||||
|
builtins.formatting.yapf
|
||||||
|
builtins.formatting.fnlfmt
|
||||||
|
builtins.formatting.shfmt
|
||||||
|
builtins.formatting.cmake_format
|
||||||
|
builtins.formatting.latexindent
|
||||||
|
builtins.formatting.stylua
|
||||||
|
builtins.code_actions.shellcheck
|
||||||
|
(builtins.completion.spell.with { :filetypes [ :text
|
||||||
|
:markdown
|
||||||
|
:tex ]})
|
||||||
|
builtins.diagnostics.cmake_lint
|
||||||
|
;;builtins.diagnostics.codespell
|
||||||
|
;;builtins.diagnostics.shellcheck
|
||||||
|
(builtins.diagnostics.glslc.with
|
||||||
|
{ :extra_args [ "--target-env=opengl" ]})])))
|
||||||
|
|
||||||
|
{: configure : on-attach : get-data-dir : setup-null-ls }
|
||||||
|
Reference in New Issue
Block a user