classification
Title: add filename completion to pdb
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, python-dev, tshepang
Priority: normal Keywords: patch

Created on 2012-03-06 15:36 by tshepang, last changed 2012-03-10 21:36 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
pdb-completion.diff georg.brandl, 2012-03-09 10:54 review
pdb-completion-v2.diff georg.brandl, 2012-03-09 17:17 review
Messages (12)
msg155020 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-03-06 15:36
This would be extra nice because I would not have to fill in the entire path manually when I'm setting a b(reak).
msg155220 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-03-09 09:50
I agree. It should not be too hard to add complete_break() and other similar methods that do this to Pdb.
msg155222 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-03-09 10:54
Here's a patch for 3.3, adding completion to most commands (either completes locations, breakpoint numbers or expressions).  Please test!
msg155242 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-03-09 16:26
Thanks for the work.

I see that completion now works for user-defined variables, but:

* completing with 'b' doesn't work at all
* completing with 'break' only completes the first directory that gets the TAB key
* also, 'break' doesn't complete when I do another try to do auto-completion (works only on first try)
msg155247 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-03-09 17:17
> I see that completion now works for user-defined variables, but:

> * completing with 'b' doesn't work at all

Right, that needs to be added for every shortcut.

> * completing with 'break' only completes the first directory that gets the TAB key
> * also, 'break' doesn't complete when I do another try to do auto-completion (works only on first try)

Indeed.  That should be fixed with this new version of the patch.
msg155249 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-03-09 17:36
Works much better, but there are still some issues:

* using relative path completes, but I get something like "'../prog.py' not found from sys.path"
* using "~/" to try to complete the HOME directory doesn't work... it completes the root directory
msg155250 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-03-09 17:41
> * using relative path completes, but I get something like "'../prog.py' not found from sys.path"

That has nothing to do with the completion.

> * using "~/" to try to complete the HOME directory doesn't work... it completes the root directory

Since break doesn't accept "~", I don't see why it should complete it.  Keep in mind it's not a shell :)
msg155251 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-03-09 17:46
> Georg Brandl <georg@python.org> added the comment:
>> * using relative path completes, but I get something like "'../prog.py' not found from sys.path"
> That has nothing to do with the completion.

If I give it an absolute path it works, hence the complaint.

>> * using "~/" to try to complete the HOME directory doesn't work... it completes the root directory
> Since break doesn't accept "~", I don't see why it should complete it.  Keep in mind it's not a shell :)

Fair enough. Perhaps the completion should not be when encountering
that character?
msg155252 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-03-09 17:50
>>> * using relative path completes, but I get something like "'../prog.py' not found from sys.path"
>> That has nothing to do with the completion.
> If I give it an absolute path it works, hence the complaint.

But that has to do with how relative paths are handled, not with how they are entered: they are taken relative to sys.path[0]. I don't know why, and if that is the useful thing to do, but it's for another issue.

>>> * using "~/" to try to complete the HOME directory doesn't work... it completes the root directory
>> Since break doesn't accept "~", I don't see why it should complete it.  Keep in mind it's not a shell :)
> Fair enough. Perhaps the completion should not be when encountering
that character?

That should be easy to do, yes.
msg155254 - (view) Author: Tshepang Lekhonkhobe (tshepang) * Date: 2012-03-09 18:14
> But that has to do with how relative paths are handled, not with how they are entered: they are taken relative to sys.path[0]. I don't know why, and if that is the useful thing to do, but it's for another issue.

Perhaps refuse to complete all relative paths as well?
msg155255 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-03-09 18:16
Nope, don't think so. They are accepted and handled (albeit strangely) after all.
msg155352 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-10 21:36
New changeset 01a25f638c83 by Georg Brandl in branch 'default':
Close #14210: add command argument completion to pdb: complete file names, global/local variables, aliases
http://hg.python.org/cpython/rev/01a25f638c83
History
Date User Action Args
2012-03-10 21:36:54python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg155352

resolution: fixed
stage: resolved
2012-03-09 18:16:19georg.brandlsetmessages: + msg155255
2012-03-09 18:14:56tshepangsetmessages: + msg155254
2012-03-09 17:50:02georg.brandlsetmessages: + msg155252
2012-03-09 17:46:48tshepangsetmessages: + msg155251
2012-03-09 17:41:50georg.brandlsetmessages: + msg155250
2012-03-09 17:36:26tshepangsetmessages: + msg155249
2012-03-09 17:17:09georg.brandlsetfiles: + pdb-completion-v2.diff

messages: + msg155247
2012-03-09 16:26:30tshepangsetmessages: + msg155242
2012-03-09 10:54:04georg.brandlsetfiles: + pdb-completion.diff
assignee: georg.brandl
messages: + msg155222

keywords: + patch
2012-03-09 09:50:41georg.brandlsetnosy: + georg.brandl
messages: + msg155220
2012-03-06 15:36:47tshepangcreate