Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/interp/repl.jq
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ def _complete($line; $cursor_pos):
def _is_separator: . as $c | " .;[]()|=" | contains($c);
def _is_internal: startswith("_") or startswith("$_");
def _query_index_or_key($q):
( ([.[] | _eval($q; {}) | type]) as $n
| if ($n | all(. == "object")) then "."
elif ($n | all(. == "array")) then "[]"
( ([.[] | _eval($q; {}) | type])
| if length > 0 and all(. == "object") then "."
# TODO: only [] if not first [1,2,3]\t -> [][] not [].[]
elif length > 0 and all(. == "array") then ".[]"
else null
end
);
Expand Down