From 070957945259262a232d95261e1ce01271254233 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sat, 18 Jul 2026 22:17:26 +0200 Subject: [PATCH] Kmpl: use /complete endpoint and $OLLIE_TOOLS_PATH for LSP --- scripts/Kmpl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/Kmpl b/scripts/Kmpl index 98286ef..24d7962 100755 --- a/scripts/Kmpl +++ b/scripts/Kmpl @@ -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"