mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 21:52:23 +00:00
fix autocompletion
This commit is contained in:
parent
ba10fd7e89
commit
d9a92bb735
3 changed files with 39 additions and 30 deletions
|
@ -207,13 +207,18 @@
|
|||
|
||||
;:ms-jpq/coq.artifacts {:branch "artifacts"}
|
||||
|
||||
(abuse use :hrsh7th/vim-vsnip {})
|
||||
|
||||
(abuse use :hrsh7th/cmp-vsnip {})
|
||||
(abuse use :hrsh7th/cmp-nvim-lsp {})
|
||||
(abuse use :hrsh7th/cmp-buffer {})
|
||||
(abuse
|
||||
use
|
||||
:hrsh7th/nvim-cmp
|
||||
{:opt false
|
||||
:requires [:hrsh7th/cmp-nvim-lsp :hrsh7th/cmp-buffer]
|
||||
:requires [:hrsh7th/cmp-nvim-lsp
|
||||
:hrsh7th/cmp-buffer
|
||||
:hrsh7th/cmp-vsnip]
|
||||
:config #(require "dots.plugins.cmp")})
|
||||
|
||||
|
||||
|
@ -222,6 +227,7 @@
|
|||
use
|
||||
:tami5/lspsaga.nvim {:after "vim-gruvbox8"
|
||||
:opt false
|
||||
:commit "373bc031b39730cbfe492533c3acfac36007899a"
|
||||
:config #(require "dots.plugins.lspsaga")})
|
||||
|
||||
(abuse
|
||||
|
@ -303,9 +309,7 @@
|
|||
:requires ["mattn/webapi-vim"]
|
||||
:opt false :config #(do (set vim.g.rustfmt_fail_silently 1))})
|
||||
|
||||
(abuse
|
||||
use
|
||||
:simrat39/rust-tools.nvim {:requires ["nvim-lua/popup.nvim" "nvim-lua/plenary.nvim"]})
|
||||
(abuse use :simrat39/rust-tools.nvim {:requires ["nvim-lua/popup.nvim" "nvim-lua/plenary.nvim"]})
|
||||
|
||||
; (use
|
||||
; :Saecki/crates.nvim {:requires ["nvim-lua/plenary.nvim"]
|
||||
|
|
|
@ -2,12 +2,27 @@
|
|||
{autoload {a aniseed.core
|
||||
cmp cmp}})
|
||||
|
||||
|
||||
(cmp.setup
|
||||
{:mapping {:<C-d> (cmp.mapping.scroll_docs -4)
|
||||
{:snippet {:expand (fn [args]
|
||||
((. vim.fn :vsnip#anonymous) args.body))}
|
||||
:mapping {:<C-d> (cmp.mapping.scroll_docs -4)
|
||||
:<C-f> (cmp.mapping.scroll_docs 4)
|
||||
:<C-space> (cmp.mapping.complete)
|
||||
:<esc> #(do (cmp.mapping.close) (vim.cmd "stopinsert"))
|
||||
:<CR> (cmp.mapping.confirm {:select true})}
|
||||
:sources [{:name "nvim_lsp"}
|
||||
{:name "buffer"}]})
|
||||
:sources [{:name "nvim_lsp"
|
||||
:priority 5}
|
||||
{:name "vsnip"
|
||||
:priority 3}]
|
||||
;{:name "buffer"}]
|
||||
:sorting {:comparators [#(do
|
||||
;(print ($1:get_kind) $1.completion_item.label "--" ($2:get_kind) $2.completion_item.label)
|
||||
(if (= 15 ($1:get_kind)) false nil)) ; 15 means "SNIPPET", see https://github.com/hrsh7th/nvim-cmp/blob/main/lua/cmp/types/lsp.lua
|
||||
cmp.config.compare.offset
|
||||
cmp.config.compare.exact
|
||||
cmp.config.compare.score
|
||||
cmp.config.compare.kind
|
||||
cmp.config.compare.sort_text
|
||||
cmp.config.compare.length
|
||||
cmp.config.compare.order]}})
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
require-macros [macros]})
|
||||
|
||||
|
||||
; TODO check https://github.com/neovim/nvim-lspconfig/blob/master/ADVANCED_README.md for default config for all of them
|
||||
|
||||
(tset vim.lsp.handlers :textDocument/publishDiagnostics
|
||||
|
@ -52,23 +51,13 @@
|
|||
(def default-capabilities
|
||||
(let [capabilities (vim.lsp.protocol.make_client_capabilities)]
|
||||
(set capabilities.textDocument.completion.completionItem.snippetSupport true)
|
||||
(cmp_nvim_lsp.update_capabilities capabilities)
|
||||
capabilities))
|
||||
|
||||
(print cmp_nvim_lsp)
|
||||
(cmp_nvim_lsp.update_capabilities capabilities)))
|
||||
|
||||
(fn init-lsp [lsp-name ?opts]
|
||||
"initialize a language server with defaults"
|
||||
(let [merged-opts (a.merge {:on_attach on_attach :capabilities default-capabilities} (or ?opts {}))]
|
||||
((. lsp lsp-name :setup) merged-opts)))
|
||||
|
||||
; Added capabilities for rust-analyzer with nvim-compe
|
||||
;(let [capabilities (vim.lsp.protocol.make_client_capabilities)]
|
||||
;(set capabilities.textDocument.completion.completionItem.snippetSupport true)
|
||||
;(set capabilities.textDocument.completion.completionItem.resolveSupport
|
||||
;{:properties ["documentation" "detail" "additionalTextEdits"]})
|
||||
;(init-lsp :rust_analyzer {:capabilities capabilities}))
|
||||
|
||||
(init-lsp :jsonls {:commands {:Format [ #(vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0])]}})
|
||||
(init-lsp :denols {:root_dir (better_root_pattern [".git"] ["package.json"])})
|
||||
(init-lsp :hls {:settings {:languageServerHaskell {:formattingProvider "stylish-haskell"}}})
|
||||
|
@ -85,14 +74,15 @@
|
|||
;(init-lsp :ccls)
|
||||
|
||||
|
||||
;(when (not lsp.ewwls)
|
||||
;(set lsp-configs.ewwls
|
||||
;{:default_config {:cmd [ "/home/leon/coding/projects/ls-eww/crates/ewwls/target/debug/ewwls"]
|
||||
;:filetypes ["yuck"]
|
||||
;:root_dir (fn [fname] (or (lsp.util.find_git_ancestor fname) (vim.loop.os_homedir)))
|
||||
;:settings {}}}))
|
||||
|
||||
(init-lsp :ewwls)
|
||||
(let [ewwls-path "/home/leon/coding/projects/ls-eww/crates/ewwls/target/debug/ewwls"]
|
||||
(when (vim.fn.filereadable ewwls-path)
|
||||
(when (not lsp.ewwls)
|
||||
(set lsp-configs.ewwls
|
||||
{:default_config {:cmd [ewwls-path]
|
||||
:filetypes ["yuck"]
|
||||
:root_dir (fn [fname] (or (lsp.util.find_git_ancestor fname) (vim.loop.os_homedir)))
|
||||
:settings {}}}))
|
||||
(init-lsp :ewwls)))
|
||||
|
||||
|
||||
(init-lsp :cssls {:filestypes ["css" "scss" "less" "stylus"]
|
||||
|
@ -110,8 +100,8 @@
|
|||
(let [rust-tools (require "rust-tools")]
|
||||
(rust-tools.setup {:tools {:inlay_hints {:show_parameter_hints false}
|
||||
:autoSetHints false}
|
||||
:server {:on_attach on_attach}}))
|
||||
;:capabilities default-capabilities}}))
|
||||
:server {:on_attach on_attach
|
||||
:capabilities default-capabilities}}))
|
||||
;:cmd ["/home/leon/coding/prs/rust-analyzer/target/release/rust-analyzer"]}}))
|
||||
|
||||
(let [sumneko_root_path (.. vim.env.HOME "/.local/share/lua-language-server")
|
||||
|
|
Loading…
Reference in a new issue