mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
jupyter-code-context (completion): Larger context inside nested parens
This commit is contained in:
parent
1109681475
commit
fafdf0d1b2
1 changed files with 12 additions and 1 deletions
|
@ -1329,7 +1329,18 @@ If the region is active, return it. Otherwise return the line."
|
|||
(jupyter-line-or-region-context))
|
||||
|
||||
(cl-defmethod jupyter-code-context ((_type (eql completion)))
|
||||
(jupyter-region-context (line-beginning-position) (point)))
|
||||
(let ((ppss (syntax-ppss)))
|
||||
(if (zerop (nth 0 ppss))
|
||||
(jupyter-region-context (line-beginning-position) (point))
|
||||
(jupyter-region-context
|
||||
;; Return a context including all nested parenthesis and the closest
|
||||
;; contiguous non-whitespace sequence of characters at the top level.
|
||||
(save-excursion
|
||||
(goto-char (car (nth 9 ppss)))
|
||||
(skip-syntax-backward "->")
|
||||
(skip-syntax-backward "^->")
|
||||
(point))
|
||||
(point)))))
|
||||
|
||||
;;;;; Helpers for completion interface
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue