From 8079b4c5a5b00a24f408c72b839ad328c01f9258 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Thu, 26 Dec 2024 00:05:03 +0100 Subject: Fix blink.cmp opts --- fnl/plugins/cmp.fnl | 44 +++++++++++++++++++++++++++++-------- fnl/plugins/lsp/diagnostics.fnl | 4 +--- fnl/plugins/lsp/mason-lspconfig.fnl | 6 +++++ 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/fnl/plugins/cmp.fnl b/fnl/plugins/cmp.fnl index 9ba119f..d728b9d 100644 --- a/fnl/plugins/cmp.fnl +++ b/fnl/plugins/cmp.fnl @@ -1,13 +1,39 @@ ;; Configuration for completion plugin. -(local opts - {:keymap {:preset :default} - :appearance {:use_nvim_cmp_as_default true :nerd_font_variant :mono} - :sources {:default {:lsp :path :snippets :buffer}} - :menu {:border :single :scrollbar false} - :documentation {:window {:border :single :scrollbar false}} - :signature {:enabled true :window {:border :single :scrollbar false}}}) +(local opts {:keymap {:preset :default} + :appearance {:use_nvim_cmp_as_default true + :nerd_font_variant :mono} + :completion {:menu {:scrollbar false} + :documentation {:window {:scrollbar false}}} + :signature {:enabled false :window {:scrollbar false}} + :sources {:default [:lsp :path :snippets :buffer :luasnip :dadbod] + :providers {:lsp {:name :LSP + :module :blink.cmp.sources.lsp + :fallbacks [:snippets + :luasnip + :buffer] + :score_offset 80} + :luasnip {:name :Luasnip + :module :blink.cmp.sources.luasnip + :min_keyword_length 2 + :fallbacks [:snippets] + :score_offset 85} + :dadbod {:name :Dadbod + :module :vim_dadbod_completion.blink + :score_offset 80}}} + :snippets {:expand (λ [snippet] + (let [luasnip (require :luasnip)] + (luasnip.lsp_expand snippet))) + :active (fn [filter] + (let [luasnip (require :luasnip)] + (when (and filter filter.direction) + (luasnip.jumpable filter.direction)) + (luasnip.in_snippet))) + :jump (λ [direction] + (let [luasnip (require :luasnip)] + (luasnip.jump direction)))}}) -(local dependencies [:rafamadriz/friendly-snippets]) +(local dependencies [:rafamadriz/friendly-snippets + {1 :L3MON4D3/LuaSnip :version :v2.*}]) -{1 :saghen/blink.cmp :version :v0.* : dependencies :event :InsertEnter : opts} +{1 :saghen/blink.cmp :version "*" : dependencies :event :InsertEnter : opts} diff --git a/fnl/plugins/lsp/diagnostics.fnl b/fnl/plugins/lsp/diagnostics.fnl index 3c24b5c..b4aefa6 100644 --- a/fnl/plugins/lsp/diagnostics.fnl +++ b/fnl/plugins/lsp/diagnostics.fnl @@ -20,8 +20,6 @@ :prefix ""}}) (λ setup [] - (vim.diagnostic.config config) - (set vim.lsp.handlers.textDocument/hover false) - (set vim.lsp.handlers.textDocument/signatureHelp false)) + (vim.diagnostic.config config)) {: setup} diff --git a/fnl/plugins/lsp/mason-lspconfig.fnl b/fnl/plugins/lsp/mason-lspconfig.fnl index fbf3d1d..429e948 100644 --- a/fnl/plugins/lsp/mason-lspconfig.fnl +++ b/fnl/plugins/lsp/mason-lspconfig.fnl @@ -1,6 +1,11 @@ ;; A bridge plugin between mason and lspconfig, handles installation of lsp and ;; setup hooks for client configurations. +(local textDocument-handlers + {:textDocument/hover (vim.lsp.with vim.lsp.handlers.hover {:border :single}) + :textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help + {:border :single})}) + (λ capabilities [] (let [blink-cmp (require :blink.cmp)] (blink-cmp.get_lsp_capabilities))) @@ -11,6 +16,7 @@ (let [lspconfig (. lspconfigs server) server-config (or (. servers server) {})] (tset server-config :capabilities (capabilities)) + (tset server-config :handlers textDocument-handlers) (lspconfig.setup server-config)))) (λ setup [] -- cgit v1.2.3-70-g09d2