-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Add REPL completion for tilde paths #23475
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 REPL completion for tilde paths #23475
Conversation
Overrides path completions if a user expansion is available. For example, `~/Docu` will autocomplete to `/home/user/Docu` after one <TAB>, and then to `/home/user/Documents` after a second <TAB>.
Thanks for the PR. I personally think this makes sense but other will have to chime in as well. It would be great to have a few tests for the functionality. There is a corresponding file |
It seems that the OSX Travis build has been terminated because the "log length has exceeded the limit of 4 MB". Is that due to a change I made, or is it just an issue with OSX builds in general? |
Seems to be an issue with the build system spitting out a lot of output? Should not be related to this PR. |
base/repl/REPLCompletions.jl
Outdated
@@ -462,13 +467,19 @@ function completions(string, pos) | |||
m = match(r"[\t\n\r\"><=*?|]| (?!\\)", reverse(partial)) | |||
startpos = nextind(partial, reverseind(partial, m.offset)) | |||
r = startpos:pos | |||
|
|||
expanded = complete_expanduser(replace(string[r], r"\\ ", " "), startpos:pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can pass r
as the last argument?
Is there a case where it's useful to expand "~" but not what comes next? i.e. in your example, why not expand |
@rfourquet Requiring two separate julia> mkdir("~/Docu
julia> mkdir("/home/user/Docu
julia> mkdir("/home/user/Docu") This is applicable in the case of file creation, as well. For example, the user may want to create |
It seems like a desirable behavior, and it fixes an annoying issue. thanks @HarrisonGrodin ! |
Autocompletes tilde expansion (using
expanduser
) in REPL strings and commands.Overrides path completions if a user expansion is available. For example,
~/Docu
will autocomplete to/home/user/Docu
after one<TAB>
, and then to/home/user/Documents
after a second<TAB>
.Closes #22599.