Skip to content

Commit

Permalink
Auto complete for #queue, #inst, etc.
Browse files Browse the repository at this point in the history
Fixes #926
  • Loading branch information
mfikes committed May 11, 2019
1 parent db5653f commit d4aaf0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. This change
- Add -keep-gcl option to the clean script
- Ignore `*.swp` files
- Support [`NO_COLOR`](https://no-color.org) ([#923](https://github.com/planck-repl/planck/issues/923))
- Auto complete for `#queue`, `#inst`, _etc_. ([#926](https://github.com/planck-repl/planck/issues/926))

### Changed
- Re-enable FTL JIT on macOS ([#820](https://github.com/planck-repl/planck/issues/820))
Expand Down
6 changes: 5 additions & 1 deletion planck-cljs/src/planck/repl.cljs
Expand Up @@ -657,6 +657,9 @@
:req :req-un :opt :opt-un
:args :ret :fn])

(def ^:private tagged-literal-completions
["#uuid" "#inst" "#queue" "#js"])

(def ^:private namespace-completion-exclusions
'[planck.from.io.aviso.ansi
planck.pprint.code
Expand Down Expand Up @@ -728,6 +731,7 @@
(completion-candidates-for-ns (add-macros-suffix expanded-ns) false)))
(concat
(map str keyword-completions)
tagged-literal-completions
(namespace-completions)
(map #(str % "/") (keys (current-alias-map)))
(completion-candidates-for-ns 'cljs.core false)
Expand Down Expand Up @@ -786,7 +790,7 @@
(local-keyword-completions kw-name)
(let [top-form? (re-find #"^\s*\(\s*[^()\s]*$" buffer)
typed-ns (second (re-find #"\(*(\b[a-zA-Z0-9-.<>*=&?]+)/[a-zA-Z0-9-]*$" buffer))]
(let [buffer-match-suffix (first (re-find #":?([a-zA-Z0-9-.<>*=&?]*|^\(/)$" buffer))
(let [buffer-match-suffix (first (re-find #"[#:]?([a-zA-Z0-9-.<>*=&?]*|^\(/)$" buffer))
completions (sort (filter (partial is-completion? buffer-match-suffix)
(completion-candidates top-form? typed-ns)))
common-prefix (longest-common-prefix completions)]
Expand Down

0 comments on commit d4aaf0d

Please sign in to comment.