mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
jupyter-completion-prefix (julia): Allow symbol key completion in dictionaries
This commit is contained in:
parent
67befbc10c
commit
6c7ceb4ae2
1 changed files with 12 additions and 6 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue