Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file completion to the REPL #5343

Merged
merged 1 commit into from
Jan 10, 2014
Merged

Add file completion to the REPL #5343

merged 1 commit into from
Jan 10, 2014

Conversation

carlobaldassi
Copy link
Member

I know the readline REPL is going to be substituted with pure julia, but since that does not seem to be as imminent as I used to think and since not having file completion is really annoying, I patched the repl-readline code to do file completion on tab under two circumstances: 1) within strings 2) when the line starts with ;.

The fist case is a bit complicated to do properly and the resulting code is not really nice looking, but it mostly works (most common cases such as escaping and similar are covered; I hope I haven't missed anything obvious; the only situation I can think of where it would fail to work properly is a string within an interpolation within a string, but surely there are other failure scenarios if one tries hard enough). Anyway, this is code which is supposed to be short-lived, and I think it's still better than what we have now.

@carlobaldassi
Copy link
Member Author

Oh and it doesn't know about string macros of course (e.g. it will attempt file completion within regexps, but I don't see this as worse than attempting variable/method names completion).

@StefanKarpinski
Copy link
Member

This is a great feature!

only active within strings/commands, or when the line starts with ';'
@carlobaldassi
Copy link
Member Author

Changed to work within backticks as well, plus improved to use different word-breaking rules than for julia (e.g. abc-def\t should complete def if looking for identifiers, but it should complete abc-def if looking for files).

I'll merge soon if there are no objections.

carlobaldassi added a commit that referenced this pull request Jan 10, 2014
@carlobaldassi carlobaldassi merged commit 6e209f0 into master Jan 10, 2014
@carlobaldassi carlobaldassi deleted the cb/filecompletion branch January 10, 2014 15:28
@StefanKarpinski
Copy link
Member

This is so nice. Thanks for doing that. Doing shell stuff in the Julia REPL is now very nearly as slick as doing it in the shell itself (slightly less so because I use zsh which has all sorts of tricked out context-sensitive tab completion, but still, this is so great).

@carlobaldassi
Copy link
Member Author

My pleasure. Anyway, I think that the biggest win of this change will turn out to be this ;)

nolta added a commit that referenced this pull request Mar 26, 2014
@nolta nolta mentioned this pull request Mar 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants