Commit aa409935 authored by Fabián Ezequiel Gallina's avatar Fabián Ezequiel Gallina Committed by Fabián Ezequiel Gallina
Browse files

Improved completion support when in [i]pdb

`python-shell-completion--do-completion-at-point' has been modified in
order to support different completion contexts easily.

New vars:
 + python-shell-completion-pdb-string-code
parent 76a9ea3b
......@@ -1609,6 +1609,13 @@ and use the following as the value of this variable:
:group 'python
:safe 'stringp)
(defcustom python-shell-completion-pdb-string-code
"';'.join(globals().keys() + locals().keys())"
"Python code used to get completions separated by semicolons for [i]pdb."
:type 'string
:group 'python
:safe 'stringp)
(defvar python-shell-completion-original-window-configuration nil)
(defun python-shell-completion--get-completions (input process completion-code)
......@@ -1628,14 +1635,20 @@ completions on the current context."
(buffer-substring (point-at-bol) (point)) nil nil))
(input (substring-no-properties
(or (comint-word (current-word)) "") nil nil))
(if (and (> (length python-shell-completion-module-string-code) 0)
(cond ((and (> (length python-shell-completion-pdb-string-code) 0)
(string-match python-shell-prompt-pdb-regexp
(overlay-start comint-last-prompt-overlay)
(overlay-end comint-last-prompt-overlay))))
((and (> (length python-shell-completion-module-string-code) 0)
(string-match "^\\(from\\|import\\)[ \t]" line))
line process python-shell-completion-module-string-code)
(and (> (length input) 0)
input process python-shell-completion-string-code))))
(t python-shell-completion-string-code)))
(and (> (length input) 0)
(python-shell-completion--get-completions line process completion-code)))
(completion (when completions
(try-completion input completions))))
(cond ((eq completion t)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment