zellij: dropping
This commit is contained in:
parent
7cdf103de5
commit
fd3bfc1f0d
4 changed files with 0 additions and 112 deletions
|
|
@ -1,8 +1,3 @@
|
||||||
[".config/zellij/plugins/room.wasm"]
|
|
||||||
type = "file"
|
|
||||||
url = "https://github.com/rvcas/room/releases/latest/download/room.wasm"
|
|
||||||
refreshPeriod = "168h"
|
|
||||||
|
|
||||||
[".local/share/tree-sitter-prr"]
|
[".local/share/tree-sitter-prr"]
|
||||||
type = "git-repo"
|
type = "git-repo"
|
||||||
url = "ssh://git@git.thermokar.st/thermokarst/tree-sitter-prr.git"
|
url = "ssh://git@git.thermokar.st/thermokarst/tree-sitter-prr.git"
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
#!/usr/bin/env -S uv run --script
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import ast
|
|
||||||
import pathlib
|
|
||||||
|
|
||||||
|
|
||||||
def find_definition(fp, line):
|
|
||||||
symbols = {}
|
|
||||||
with fp.open() as fh:
|
|
||||||
tree = ast.parse(fh.read())
|
|
||||||
|
|
||||||
for node in ast.walk(tree):
|
|
||||||
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
|
|
||||||
start, end = compute_size(node)
|
|
||||||
symbols[node.name] = (start, end)
|
|
||||||
|
|
||||||
matches = []
|
|
||||||
for key, (start, end) in symbols.items():
|
|
||||||
if start <= line <= end:
|
|
||||||
matches.append(key)
|
|
||||||
|
|
||||||
return matches
|
|
||||||
|
|
||||||
|
|
||||||
def compute_size(node):
|
|
||||||
min_lineno = node.lineno
|
|
||||||
max_lineno = node.lineno
|
|
||||||
for node in ast.walk(node):
|
|
||||||
if hasattr(node, "lineno"):
|
|
||||||
min_lineno = min(min_lineno, node.lineno)
|
|
||||||
max_lineno = max(max_lineno, node.lineno)
|
|
||||||
return (min_lineno, max_lineno + 1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('filepath', type=pathlib.Path)
|
|
||||||
parser.add_argument('line', type=int)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
symbols = find_definition(args.filepath, args.line)
|
|
||||||
for symbol in symbols:
|
|
||||||
print(symbol)
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
tmpfile=$(mktemp)
|
|
||||||
zellij action dump-screen $tmpfile
|
|
||||||
status_line=$(cat $tmpfile | rg -e "(?:NOR|INS|SEL)\s+[\x{2800}-\x{28FF}]*\s+(\S*)\s[^│]* (\d+):*.*" -o --replace '$1 $2')
|
|
||||||
filename=$(echo $status_line | awk '{ print $1 }')
|
|
||||||
escaped_filename=$(echo "$filename" | sed 's/[\/&]/\\&/g')
|
|
||||||
line_number=$(echo $status_line | awk '{ print $2 }')
|
|
||||||
extension="${filename##*.}"
|
|
||||||
|
|
||||||
case "$extension" in
|
|
||||||
"py")
|
|
||||||
# this is pretty pytest-specific, but will probably be fine for the time being
|
|
||||||
test_runner=${PYTEST:-pytest}
|
|
||||||
cmd="get_python_function_at_position.py $filename $line_number | pytester.py - | sed 's/^/$test_runner /;s/$/ $escaped_filename/' | sh"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "uh oh!"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
full_cmd="echo \"running $cmd\" && $cmd"
|
|
||||||
|
|
||||||
zellij action new-pane --direction down -- zsh -c "$full_cmd"
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
#!/usr/bin/env -S uv run --script
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import pathlib
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument('symbols', type=argparse.FileType('r'))
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
symbols = args.symbols.read()
|
|
||||||
try:
|
|
||||||
symbols = symbols.strip()
|
|
||||||
symbols = symbols.split("\n")
|
|
||||||
expressions = " and ".join(symbols)
|
|
||||||
if expressions:
|
|
||||||
print(f"-k \"{expressions}\"")
|
|
||||||
else:
|
|
||||||
print("")
|
|
||||||
finally:
|
|
||||||
args.symbols.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
try:
|
|
||||||
main()
|
|
||||||
sys.stdout.flush()
|
|
||||||
except BrokenPipeError:
|
|
||||||
devnull = os.open(os.devnull, os.O_WRONLY)
|
|
||||||
os.dup2(devnull, sys.stdout.fileno())
|
|
||||||
sys.exit(1)
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue