Kmpl: use /complete endpoint and $OLLIE_TOOLS_PATH for LSP
This commit is contained in:
parent
02ce7dafbe
commit
0709579452
16
scripts/Kmpl
16
scripts/Kmpl
|
|
@ -73,7 +73,7 @@ if [ -s "$tmpdir/hover_cur" ]; then
|
||||||
dfile=${defn%%:*}
|
dfile=${defn%%:*}
|
||||||
dline=$(echo "$defn" | cut -d: -f2)
|
dline=$(echo "$defn" | cut -d: -f2)
|
||||||
dcol=$(echo "$defn" | cut -d: -f3)
|
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; }
|
[ -n "$result" ] && [ "$result" != "(no hover info)" ] && { printf '%s\n' "$result" | tee -a "$tmpdir/hover_embedded" >> "$tmpdir/hover_cur"; continue; }
|
||||||
# Fallback: read raw source block
|
# Fallback: read raw source block
|
||||||
sed -n "${dline},/^}/p" "$dfile" 2>/dev/null | tee -a "$tmpdir/hover_embedded" >> "$tmpdir/hover_cur" || true
|
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
|
# Send prefix+selection as prefix context; selection is the focal point
|
||||||
_input=$(printf '%s%s' "$prefix" "$sel")
|
_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
|
# Build JSON request for /complete (write-then-read on same fid via 9p rdwr)
|
||||||
result=$(printf '%s' "$_input" | ${OLLIE_CFG_PATH:-$HOME/.config/ollie}/scripts/u/complete -file "$filename" -suffix "$suffix" -context "$context" -cwd "$modroot" "$@")
|
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"
|
printf '%s' "$result"
|
||||||
|
|
|
||||||
Reference in New Issue