##// END OF EJS Templates
Improve matching files after script name for magic %run....
Thomas Kluyver -
Show More
@@ -253,7 +253,11 b' def magic_run_completer(self, event):'
253 """Complete files that end in .py or .ipy or .ipynb for the %run command.
253 """Complete files that end in .py or .ipy or .ipynb for the %run command.
254 """
254 """
255 comps = arg_split(event.line, strict=False)
255 comps = arg_split(event.line, strict=False)
256 relpath = (len(comps) > 1 and comps[-1] or '').strip("'\"")
256 # relpath should be the current token that we need to complete.
257 if (len(comps) > 1) and (not event.line.endswith(' ')):
258 relpath = comps[-1].strip("'\"")
259 else:
260 relpath = ''
257
261
258 #print("\nev=", event) # dbg
262 #print("\nev=", event) # dbg
259 #print("rp=", relpath) # dbg
263 #print("rp=", relpath) # dbg
@@ -270,7 +274,7 b' def magic_run_completer(self, event):'
270 # be arguments to the input script.
274 # be arguments to the input script.
271
275
272 if any(magic_run_re.match(c) for c in comps):
276 if any(magic_run_re.match(c) for c in comps):
273 pys = [f.replace('\\','/') for f in lglob('*')]
277 pys = [f.replace('\\','/') for f in lglob(relpath+'*')]
274 else:
278 else:
275 pys = [f.replace('\\','/')
279 pys = [f.replace('\\','/')
276 for f in lglob(relpath+'*.py') + lglob(relpath+'*.ipy') +
280 for f in lglob(relpath+'*.py') + lglob(relpath+'*.ipy') +
General Comments 0
You need to be logged in to leave comments. Login now