AutoYADM commit: 2025-06-17 20:47:57
This commit is contained in:
parent
1f952af0ed
commit
80c399ee03
16 changed files with 476 additions and 131 deletions
|
@ -40,6 +40,20 @@ define-command -override -hidden lsp-do-send-sync %{
|
|||
}
|
||||
}
|
||||
|
||||
define-command -override lsp-progress-disable %{
|
||||
# override to do nothing b/c it's annoying lol
|
||||
define-command -hidden -override lsp-handle-progress -params 6 nop
|
||||
}
|
||||
define-command -override lsp-progress-enable %{
|
||||
# identical to kak-lsp default
|
||||
define-command -hidden -override lsp-handle-progress -params 6 %{
|
||||
set-option global lsp_modeline_progress %sh{
|
||||
if ! "$6"; then
|
||||
echo "$kak_opt_lsp_progress_indicator"
|
||||
fi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -137,6 +151,15 @@ define-command -hidden lsp-filetype-hooks-update %{
|
|||
# commands to execute for lsp window settings
|
||||
lsp-enable-window
|
||||
inlay-on
|
||||
|
||||
# hooks to disable inline diagnostics while typing
|
||||
hook -group dynamic-inline-diags window ModeChange (push|pop):.*insert %{
|
||||
try inline-diagnostics-off
|
||||
}
|
||||
hook -group dynamic-inline-diags window ModeChange (push|pop):insert:.* %{
|
||||
try inline-diagnostics-on
|
||||
}
|
||||
|
||||
# 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 diagnostics' window ui d ': inlay-diagnostics-toggle<ret>'
|
||||
|
@ -329,59 +352,12 @@ hook -group lsp-filetype-toml global BufSetOption filetype=toml %{
|
|||
}
|
||||
}
|
||||
|
||||
# # can be empty, global, or file
|
||||
# declare-option -hidden str harper_add ""
|
||||
# define-command -hidden harper-add -params 1 %{
|
||||
# set-option window harper_add %arg{1}
|
||||
# lsp-code-actions -auto-single
|
||||
# }
|
||||
|
||||
# # can override this to customize what's rendered in the menu
|
||||
# # Each code action is two args: its name, and the corresponding command
|
||||
# define-command -override -hidden lsp-perform-code-action -params 1.. -docstring "Called on :lsp-code-actions" %{
|
||||
# evaluate-commands %sh{
|
||||
# # harper specific filtering
|
||||
# if printf '%s' "$kak_opt_lsp_servers" | grep -q 'harper-ls'; then
|
||||
# if [ "$kak_opt_harper_add" = "global" ]; then
|
||||
# # filter and keep only
|
||||
# echo "echo -debug 'harper adding global'"
|
||||
# fi
|
||||
# fi
|
||||
# echo "echo -debug dumping $# code actions args:"
|
||||
# echo "echo -debug %arg{@}"
|
||||
|
||||
# }
|
||||
# lsp-menu %arg{@}
|
||||
# }
|
||||
|
||||
define-command lsp-inlay-hint-raw %{
|
||||
evaluate-commands %sh{
|
||||
tmp=$(mktemp -d)
|
||||
pipe="${tmp}/fifo"
|
||||
mkfifo "$pipe" || { echo "fail failed to create fifo"; exit 1; }
|
||||
trap "rm -f \"$pipe\"; rmdir \"$tmp\"" EXIT INT QUIT
|
||||
|
||||
reg_a="$kak_session
|
||||
$kak_client
|
||||
true
|
||||
false
|
||||
$kak_buffile
|
||||
$kak_timestamp
|
||||
$kak_opt_filetype
|
||||
$kak_opt_lsp_language_id
|
||||
$kak_opt_lsp_servers
|
||||
$kak_opt_lsp_semantic_tokens
|
||||
$kak_opt_lsp_config
|
||||
$kak_opt_lsp_server_initialization_options
|
||||
map-end
|
||||
textDocument/inlayHint
|
||||
$kak_buf_line_count"
|
||||
|
||||
printf "%s '%s' " "$reg_a" "$pipe" > "$kak_opt_lsp_fifo"
|
||||
|
||||
raw=$(cat "$pipe")
|
||||
raw_escaped=$(printf %s "$raw" | sed "s/'/''/g")
|
||||
printf "set-register z '%s'\n" "$raw_escaped"
|
||||
}
|
||||
remove-hooks global lsp-filetype-sh
|
||||
hook -group lsp-filetype-sh global BufSetOption filetype=sh %{
|
||||
set-option buffer lsp_servers %{
|
||||
[bash-language-server]
|
||||
root_globs = [".git", ".hg"]
|
||||
args = ["start"]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue