AutoYADM commit: 2025-05-26 20:02:54

This commit is contained in:
Daniel Fichtinger 2025-05-26 20:02:54 -04:00
parent f3c7108572
commit 4769181f99
2 changed files with 22 additions and 4 deletions

View file

@ -48,6 +48,25 @@ define-command -hidden inlay-toggle %{
} }
} }
declare-option -hidden bool diagnostics_enabled false
define-command -hidden diagnostics-on %{
lsp-inlay-diagnostics-enable window
set-option window diagnostics_enabled true
}
define-command -hidden diagnostics-off %{
lsp-inlay-diagnostics-disable window
set-option window diagnostics_enabled false
}
define-command -hidden diagnostics-toggle %{
evaluate-commands %sh{
if [ "$kak_opt_diagnostics_enabled" = "true" ]; then
echo "diagnostics-off"
else
echo "diagnostics-on"
fi
}
}
define-command -hidden lsp-filetype-hooks-update %{ define-command -hidden lsp-filetype-hooks-update %{
try %{ remove-hooks global lsp-filetypes } try %{ remove-hooks global lsp-filetypes }
# convert the str-list into regex of form (a|b|c|...) # convert the str-list into regex of form (a|b|c|...)
@ -60,8 +79,10 @@ define-command -hidden lsp-filetype-hooks-update %{
try %{ try %{
# only map to UI mode if that module is available # only map to UI mode if that module is available
map -docstring 'toggle inlay hints' window ui h ': inlay-toggle<ret>' map -docstring 'toggle inlay hints' window ui h ': inlay-toggle<ret>'
map -docstring 'toggle inlay diagnostics' window ui d ': diagnostics-toggle<ret>'
} catch %{ } catch %{
map -docstring 'toggle inlay hints' window lsp <a-h> ': inlay-toggle<ret>' map -docstring 'toggle inlay hints' window lsp <a-h> ': inlay-toggle<ret>'
map -docstring 'toggle inlay diagnostics' window lsp <a-d> ': diagnostics-toggle<ret>'
} }
} }
} }
@ -71,10 +92,6 @@ hook global WinSetOption lsp_filetypes=.* lsp-filetype-hooks-update
hook global BufSetOption lsp_filetypes=.* lsp-filetype-hooks-update hook global BufSetOption lsp_filetypes=.* lsp-filetype-hooks-update
hook global GlobalSetOption lsp_filetypes=.* lsp-filetype-hooks-update hook global GlobalSetOption lsp_filetypes=.* lsp-filetype-hooks-update
# TODO: set up toggle binding for this
# or even better, show them on hover...?
# lsp-inlay-diagnostics-enable global
remove-hooks global lsp-filetype-python remove-hooks global lsp-filetype-python
hook -group lsp-filetype-python global BufSetOption filetype=python %{ hook -group lsp-filetype-python global BufSetOption filetype=python %{
set-option buffer lsp_servers %{ set-option buffer lsp_servers %{

View file

@ -1,5 +1,6 @@
# module provides utils for toggling stuff lol # module provides utils for toggling stuff lol
provide-module toggle %~ provide-module toggle %~
# define-command register-toggle -params
~ ~