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

terminal.goToRecentDirectory is not shell-aware #178994

Open
pfitzseb opened this issue Apr 3, 2023 · 6 comments
Open

terminal.goToRecentDirectory is not shell-aware #178994

pfitzseb opened this issue Apr 3, 2023 · 6 comments
Assignees
Labels
feature-request Request for new features or functionality terminal-shell-integration Shell integration, command decorations, etc.
Milestone

Comments

@pfitzseb
Copy link
Contributor

pfitzseb commented Apr 3, 2023

The shell integration feature can be used by arbitrary REPL-like programs. This includes cwd detection. Unfortunately, the current implementation of workbench.action.terminal.goToRecentDirectory can't handle that gracefully, since it seems to always send something like cd $dir\n to the terminal.

This is the status quo in Julia (switching to shell mode makes the command work, but is cumbersome):
Peek 2023-04-03 13-16

It would be awesome if REPL-likes could register a template string at startup, which VS Code would then send instead of cd $dir. E.g.

OSC 633 ; P ; cdTemplate='cd("$dir")' ST
@Tyriar Tyriar added feature-request Request for new features or functionality terminal-shell-integration Shell integration, command decorations, etc. labels Aug 3, 2023
@VSCodeTriageBot VSCodeTriageBot added this to the Backlog Candidates milestone Aug 3, 2023
@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2023

Good idea 👍. I guess we would also want to consider whether \ or / is preferred and special path mappings like in git bash which would transform c:\Users to /c/Users

@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2023

cc @zadjii-msft

@Tyriar Tyriar modified the milestones: Backlog Candidates, Backlog Aug 3, 2023
@microsoft microsoft deleted a comment from VSCodeTriageBot Aug 3, 2023
@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2023

I think 633 P is the right sequence here as well since it was intended to set "properties" on the terminal which are a set one time, as opposed to the others which are very common.

@zadjii-msft
Copy link
Member

Ha, yes, this just came up in a review I was doing too. link.

cmd is another interesting example, because changing to another drive requires cd /d {path}.

If you do end up doing something like this with a custom property, we can try and follow suite. I'm pretty sure there's an edge case somewhere out there where one shell will accept paths wrapped in single-quotes, and others in double quotes.

I'm also personally not planning on sending the \r at the end of any commands we synthesize from history. So, if we do end up with cd c:\foo on the commandline, someone can go back and edit it first.

@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2023

I'm also personally not planning on sending the \r at the end of any commands we synthesize from history. So, if we do end up with cd c:\foo on the commandline, someone can go back and edit it first.

@zadjii-msft we have a pattern where we don't send the \r if you hold alt fyi:

image
image

@zadjii-msft
Copy link
Member

Oh that's neat, I'll have to keep that in mind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality terminal-shell-integration Shell integration, command decorations, etc.
Projects
None yet
Development

No branches or pull requests

4 participants