AutoYADM commit: 2025-06-09 23:54:02
This commit is contained in:
parent
ad6b9f48b1
commit
66ed93369c
2 changed files with 17 additions and 7 deletions
|
@ -239,3 +239,11 @@ define-command -params 2 lsp-diag-query %{
|
|||
fi
|
||||
}
|
||||
}
|
||||
|
||||
hook global KakEnd .* %{
|
||||
nop %sh{
|
||||
printf 'exit\n' >"$kak_opt_diagpipe_in"
|
||||
read result < "$kak_opt_diagpipe_out"
|
||||
notify-send "killing"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# pyright: strict, reportUnusedCallResult=false
|
||||
# pyright: basic, reportUnusedCallResult=false
|
||||
|
||||
import atexit
|
||||
import subprocess
|
||||
|
@ -8,7 +8,7 @@ import sys
|
|||
import os
|
||||
import tempfile
|
||||
import signal
|
||||
from typing import Any
|
||||
import types
|
||||
|
||||
Position = tuple[int, int]
|
||||
SpecList = list[tuple[Position, Position]]
|
||||
|
@ -88,8 +88,8 @@ def daemonize(inp: str, outp: str, dir: str):
|
|||
os.dup2(dn.fileno(), sys.stderr.fileno())
|
||||
_ = atexit.register(lambda: cleanup(inp, outp, dir))
|
||||
|
||||
def on_exit(signum: Any, frame: Any):
|
||||
cleanup(inp, outp, dir)
|
||||
def on_exit(*_):
|
||||
# cleanup(inp, outp, dir)
|
||||
sys.exit(0)
|
||||
|
||||
signal.signal(signal.SIGTERM, on_exit)
|
||||
|
@ -113,12 +113,13 @@ def main():
|
|||
daemonize(in_path, out_path, fifo_dir)
|
||||
|
||||
with open(in_path, "r") as infile, open(out_path, "w") as outfile:
|
||||
diagnostics = []
|
||||
diagnostics: SpecList = []
|
||||
while True:
|
||||
line = infile.readline()
|
||||
if not line:
|
||||
continue
|
||||
assert isinstance(line, str)
|
||||
subprocess.run(["notify-send", f"Received command: {line}"])
|
||||
if line.startswith("set "):
|
||||
_, payload = line.split(" ", 1)
|
||||
diagnostics = parse_specs(payload)
|
||||
|
@ -130,8 +131,9 @@ def main():
|
|||
result = is_cursor_in_any((l, c), diagnostics)
|
||||
_ = outfile.write("true\n" if result else "false\n")
|
||||
outfile.flush()
|
||||
elif line == "exit":
|
||||
break
|
||||
elif line.startswith("exit"):
|
||||
subprocess.run(["notify-send", "exit received"])
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue