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
|
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
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# pyright: strict, reportUnusedCallResult=false
|
# pyright: basic, reportUnusedCallResult=false
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -8,7 +8,7 @@ import sys
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import signal
|
import signal
|
||||||
from typing import Any
|
import types
|
||||||
|
|
||||||
Position = tuple[int, int]
|
Position = tuple[int, int]
|
||||||
SpecList = list[tuple[Position, Position]]
|
SpecList = list[tuple[Position, Position]]
|
||||||
|
@ -88,8 +88,8 @@ def daemonize(inp: str, outp: str, dir: str):
|
||||||
os.dup2(dn.fileno(), sys.stderr.fileno())
|
os.dup2(dn.fileno(), sys.stderr.fileno())
|
||||||
_ = atexit.register(lambda: cleanup(inp, outp, dir))
|
_ = atexit.register(lambda: cleanup(inp, outp, dir))
|
||||||
|
|
||||||
def on_exit(signum: Any, frame: Any):
|
def on_exit(*_):
|
||||||
cleanup(inp, outp, dir)
|
# cleanup(inp, outp, dir)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
signal.signal(signal.SIGTERM, on_exit)
|
signal.signal(signal.SIGTERM, on_exit)
|
||||||
|
@ -113,12 +113,13 @@ def main():
|
||||||
daemonize(in_path, out_path, fifo_dir)
|
daemonize(in_path, out_path, fifo_dir)
|
||||||
|
|
||||||
with open(in_path, "r") as infile, open(out_path, "w") as outfile:
|
with open(in_path, "r") as infile, open(out_path, "w") as outfile:
|
||||||
diagnostics = []
|
diagnostics: SpecList = []
|
||||||
while True:
|
while True:
|
||||||
line = infile.readline()
|
line = infile.readline()
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
assert isinstance(line, str)
|
assert isinstance(line, str)
|
||||||
|
subprocess.run(["notify-send", f"Received command: {line}"])
|
||||||
if line.startswith("set "):
|
if line.startswith("set "):
|
||||||
_, payload = line.split(" ", 1)
|
_, payload = line.split(" ", 1)
|
||||||
diagnostics = parse_specs(payload)
|
diagnostics = parse_specs(payload)
|
||||||
|
@ -130,8 +131,9 @@ def main():
|
||||||
result = is_cursor_in_any((l, c), diagnostics)
|
result = is_cursor_in_any((l, c), diagnostics)
|
||||||
_ = outfile.write("true\n" if result else "false\n")
|
_ = outfile.write("true\n" if result else "false\n")
|
||||||
outfile.flush()
|
outfile.flush()
|
||||||
elif line == "exit":
|
elif line.startswith("exit"):
|
||||||
break
|
subprocess.run(["notify-send", "exit received"])
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue