jupyter-completion-prefix (julia): Allow symbol key completion in dictionaries

This commit is contained in:
Nathaniel Nicandro 2019-02-14 23:09:00 -06:00
parent 67befbc10c
commit 6c7ceb4ae2
No known key found for this signature in database
GPG key ID: C34814B309DD06B8

View file

@ -53,13 +53,19 @@
(jupyter-completion-symbol-beginning (1- (point)))
(point)))
(t
(let ((prefix (cl-call-next-method "\\\\\\|\\.\\|::" 2)))
(let ((prefix (cl-call-next-method "\\\\\\|\\.\\|::?" 2)))
(prog1 prefix
(when (and (consp prefix)
(eq (char-before (- (point) (length (car prefix)))) ?\\))
;; Include the \ in the prefix so it gets replaced if a canidate is
;; selected.
(setcar prefix (concat "\\" (car prefix)))))))))
(when (consp prefix)
(let ((beg (- (point) (length (car prefix)))))
(cond
;; Include the \ in the prefix so it gets replaced if a canidate is
;; selected.
((eq (char-before beg) ?\\)
(setcar prefix (concat "\\" (car prefix))))
;; Also include : to complete symbols when used as dictionary keys
((and (eq (char-before beg) ?:)
(not (eq (char-before (1- beg)) ?:)))
(setcar prefix (concat ":" (car prefix))))))))))))
(cl-defmethod jupyter-completion-post-completion (candidate
&context (jupyter-lang julia))