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))) (jupyter-completion-symbol-beginning (1- (point)))
(point))) (point)))
(t (t
(let ((prefix (cl-call-next-method "\\\\\\|\\.\\|::" 2))) (let ((prefix (cl-call-next-method "\\\\\\|\\.\\|::?" 2)))
(prog1 prefix (prog1 prefix
(when (and (consp prefix) (when (consp prefix)
(eq (char-before (- (point) (length (car prefix)))) ?\\)) (let ((beg (- (point) (length (car prefix)))))
;; Include the \ in the prefix so it gets replaced if a canidate is (cond
;; selected. ;; Include the \ in the prefix so it gets replaced if a canidate is
(setcar prefix (concat "\\" (car prefix))))))))) ;; 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 (cl-defmethod jupyter-completion-post-completion (candidate
&context (jupyter-lang julia)) &context (jupyter-lang julia))