| 523 | # assigned below to one of these functions. |
| 524 | |
| 525 | def _complete_location(self, text, line, begidx, endidx): |
| 526 | # Complete a file/module/function location for break/tbreak/clear. |
| 527 | if line.strip().endswith((':', ',')): |
| 528 | # Here comes a line number or a condition which we can't complete. |
| 529 | return [] |
| 530 | # First, try to find matching functions (i.e. expressions). |
| 531 | try: |
| 532 | ret = self._complete_expression(text, line, begidx, endidx) |
| 533 | except Exception: |
| 534 | ret = [] |
| 535 | # Then, try to complete file names as well. |
| 536 | globs = glob.glob(glob.escape(text) + '*') |
| 537 | for fn in globs: |
| 538 | if os.path.isdir(fn): |
| 539 | ret.append(fn + '/') |
| 540 | elif os.path.isfile(fn) and fn.lower().endswith(('.py', '.pyw')): |
| 541 | ret.append(fn + ':') |
| 542 | return ret |
| 543 | |
| 544 | def _complete_bpnumber(self, text, line, begidx, endidx): |
| 545 | # Complete a breakpoint number. (This would be more helpful if we could |