Kmpl: use /complete endpoint and $OLLIE_TOOLS_PATH for LSP

This commit is contained in:
Levi Neely 2026-07-18 22:17:26 +02:00
parent 02ce7dafbe
commit 0709579452
1 changed files with 11 additions and 5 deletions

View File

@ -73,7 +73,7 @@ if [ -s "$tmpdir/hover_cur" ]; then
dfile=${defn%%:*}
dline=$(echo "$defn" | cut -d: -f2)
dcol=$(echo "$defn" | cut -d: -f3)
result=$(try python3 $OLLIE/t/lsp_hover "$dfile" "$dline" "$dcol" || true)
result=$(python3 $OLLIE_TOOLS_PATH/lsp_hover "$dfile" "$dline" "$dcol" 2>/dev/null || true)
[ -n "$result" ] && [ "$result" != "(no hover info)" ] && { printf '%s\n' "$result" | tee -a "$tmpdir/hover_embedded" >> "$tmpdir/hover_cur"; continue; }
# Fallback: read raw source block
sed -n "${dline},/^}/p" "$dfile" 2>/dev/null | tee -a "$tmpdir/hover_embedded" >> "$tmpdir/hover_cur" || true
@ -105,9 +105,15 @@ $(cat "$tmpdir/hover_embedded")
# Send prefix+selection as prefix context; selection is the focal point
_input=$(printf '%s%s' "$prefix" "$sel")
result=$(printf '%s' "$_input" | ${OLLIE_CFG_PATH:-$HOME/.config/ollie}/scripts/u/complete -file "$filename" -suffix "$suffix" -context "$context" -cwd "$modroot" "$@") || {
ollie-remount
result=$(printf '%s' "$_input" | ${OLLIE_CFG_PATH:-$HOME/.config/ollie}/scripts/u/complete -file "$filename" -suffix "$suffix" -context "$context" -cwd "$modroot" "$@")
}
# Build JSON request for /complete (write-then-read on same fid via 9p rdwr)
json=$(printf '{"cwd":%s,"file":%s,"prefix":%s,"suffix":%s,"context":%s}' \
"$(printf '%s' "$modroot" | jq -Rs .)" \
"$(printf '%s' "$filename" | jq -Rs .)" \
"$(printf '%s' "$_input" | jq -Rs .)" \
"$(printf '%s' "$suffix" | jq -Rs .)" \
"$(printf '%s' "$context" | jq -Rs .)")
result=$(printf '%s' "$json" | try 9p rdwr ollie/complete)
printf '%s' "$result"