Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

on empty line-suffix, don't get completions #333

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
12 changes: 7 additions & 5 deletions src/cljs/snapshot/lumo/repl.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1445,12 +1445,14 @@
ns-alias (second (re-find #"\(*(\b[a-zA-Z-.<>*=&?]+)/[a-zA-Z-]*$" line))
line-match-suffix (first (re-find #":?([a-zA-Z-.<>*=&?]*|^\(/)$" line))
line-prefix (subs line 0 (- (count line) (count line-match-suffix)))
completions (reduce (fn [ret item]
(doto ret
(.push (str line-prefix item))))
completions (if (empty? line-match-suffix)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised that the completion-candidates fn does not depend on the prefix item. I would expect it is it's responsibility to do the if. Let me try to push a commit here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see completion-candidates comes up with all the completions all the time

#js []
(filter #(is-completion? line-match-suffix %)
(completion-candidates top-level? ns-alias)))]
(reduce (fn [ret item]
(doto ret
(.push (str line-prefix item))))
#js []
(filter #(is-completion? line-match-suffix %)
(completion-candidates top-level? ns-alias))))]
(cb (doto completions
.sort)))))

Expand Down