From cf46ae2f4d69aa4a202357c3bd5fca5af852660d Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Sat, 24 May 2025 16:42:39 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-24 16:42:39 --- .config/kak/autoload/lsp.kak | 57 ++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/.config/kak/autoload/lsp.kak b/.config/kak/autoload/lsp.kak index a7fde5c4..fd09c006 100644 --- a/.config/kak/autoload/lsp.kak +++ b/.config/kak/autoload/lsp.kak @@ -15,24 +15,43 @@ map global object D 'lsp-diagnostic-object' -docstring 'LSP er # override the code actions icon in the modeline define-command -hidden -override lsp-show-code-actions -params 1.. %{ - set-option buffer lsp_modeline_code_actions "" + set-option buffer lsp_modeline_code_actions "" } define-command -hidden -override lsp-hide-code-actions %{ - set-option buffer lsp_modeline_code_actions "" + set-option buffer lsp_modeline_code_actions "" } # Server Config set-option global lsp_debug false -declare-option str-list lsp_filetypes python go rust bash fish typst yaml json jsonc +# list of filetypes for which LSP will be activated in the window scope +declare-option str-list lsp_filetypes python %{ + # programming + python + go + rust + bash + fish + c + cpp + # markup + typst + markdown + # config + yaml + json + jsonc +} + define-command -hidden lsp-filetype-hooks-update %{ - try %{ remove-hooks window lsp-filetypes } - # convert the str-list into regex of form (a|b|c|...) - hook -group lsp-filetypes global WinSetOption %exp~filetype=%sh{ - printf '%s' "(${kak_opt_lsp_filetypes// /|})" - }~ %{ - lsp-enable-window - lsp-inlay-hints-enable window - } + try %{ remove-hooks window lsp-filetypes } + # convert the str-list into regex of form (a|b|c|...) + hook -group lsp-filetypes global WinSetOption %exp~filetype=%sh{ + printf '%s' "(${kak_opt_lsp_filetypes// /|})" + }~ %{ + # commands to execute for lsp window settings + lsp-enable-window + lsp-inlay-hints-enable window + } } lsp-filetype-hooks-update @@ -52,18 +71,18 @@ hook -group lsp-filetype-python global BufSetOption filetype=python %{ args = ["--stdio"] settings_section = "basedpyright" [basedpyright-langserver.settings.basedpyright.analysis] - typeCheckingMode = "standard" - inlayHints.genericTypes = true + typeCheckingMode = "standard" + inlayHints.genericTypes = true } } # use our custom fish-lsp wrapper because it sets env vars hook -group lsp-filetype-fish global BufSetOption filetype=fish %{ - set-option buffer lsp_servers %{ - [fish-lsp] - root_globs = [".git"] - args = ["start"] - command = "/home/fic/.config/kak/scripts/fish-lsp.fish" - } + set-option buffer lsp_servers %{ + [fish-lsp] + root_globs = [".git"] + args = ["start"] + command = "/home/fic/.config/kak/scripts/fish-lsp.fish" + } }