diff --git a/.config/kak/autoload/lsp.kak b/.config/kak/autoload/lsp.kak index bb8c8296..f860134b 100644 --- a/.config/kak/autoload/lsp.kak +++ b/.config/kak/autoload/lsp.kak @@ -221,7 +221,7 @@ define-command lsp-diag-set %{ printf 'set %s\n' "$kak_opt_lsp_inline_diagnostics" >"$kak_opt_diagpipe_in" read result < "$kak_opt_diagpipe_out" if [ "$result" != "ok" ]; then - echo "info 'failed'" + echo "info 'lsp-diag failed to set'" else echo "nop" fi @@ -233,9 +233,9 @@ define-command -params 2 lsp-diag-query %{ printf 'query %s %s\n' "$1" "$2" >"$kak_opt_diagpipe_in" read result < "$kak_opt_diagpipe_out" if [ "$result" = "true" ]; then - echo "info 'true'" + echo "trigger-user-hook lsp-diag-hover-true" else - echo "info 'false'" + echo "trigger-user-hook lsp-diag-hover-false" fi } } @@ -244,6 +244,21 @@ hook global KakEnd .* %{ nop %sh{ printf 'exit\n' >"$kak_opt_diagpipe_in" read result < "$kak_opt_diagpipe_out" - notify-send "killing" } -} +} + +hook global User lsp-diag-hover-false %{ + info 'false detected' +} + +hook global User lsp-diag-hover-true %{ + info 'true detected' +} + +hook global NormalIdle .* %{ + lsp-diag-query %val{cursor_line} %val{cursor_column} +} + +hook global WinSetOption lsp_inline_diagnostics=.* %{ + lsp-diag-set +} diff --git a/.config/kak/scripts/lsp-diags.py b/.config/kak/scripts/lsp-diags.py index 80cfc642..2980e5a8 100755 --- a/.config/kak/scripts/lsp-diags.py +++ b/.config/kak/scripts/lsp-diags.py @@ -57,7 +57,7 @@ def test(): def cleanup(inp: str, outp: str, dir: str): - subprocess.run(["notify-send", "cleanup runs"]) + # subprocess.run(["notify-send", "cleanup runs"]) try: os.remove(inp) os.remove(outp) @@ -97,7 +97,7 @@ def daemonize(inp: str, outp: str, dir: str): def main(): - subprocess.run(["notify-send", "begin loop"]) + # subprocess.run(["notify-send", "begin loop"]) # create unique directory and names fifo_dir = tempfile.mkdtemp(prefix="diagpipe-") in_path = os.path.join(fifo_dir, "in") @@ -119,8 +119,9 @@ def main(): if not line: continue assert isinstance(line, str) - subprocess.run(["notify-send", f"Received command: {line}"]) + # # subprocess.run(["notify-send", f"Received command: {line}"]) if line.startswith("set "): + # subprocess.run(["notify-send", f"Received set: {line}"]) _, payload = line.split(" ", 1) diagnostics = parse_specs(payload) _ = outfile.write("ok\n") @@ -132,7 +133,7 @@ def main(): _ = outfile.write("true\n" if result else "false\n") outfile.flush() elif line.startswith("exit"): - subprocess.run(["notify-send", "exit received"]) + # subprocess.run(["notify-send", "exit received"]) sys.exit(0)