Skip to content

Set working directory when invoked from shell extension - #10546

Merged
1 commit merged into
microsoft:mainfrom
ianjoneill:f-shell-extension-working-directory
Jul 9, 2021
Merged

1 commit merged into
microsoft:mainfrom
ianjoneill:f-shell-extension-working-directory

Conversation

@ianjoneill

@ianjoneill Ian O'Neill (ianjoneill) commented Jul 2, 2021 •

Copy link
Copy Markdown
Contributor

Sets the working directory of the terminal when invoked from the shell extension. This ensures that new tabs opened with a starting directory of . open in the directory that the terminal was invoked from.

Closes #8933

Validation Steps Performed

Manually tested - default PowerShell profile set to use home directory, Windows PowerShell profile set to use current directory. Launched via the shell extension and the default profile opened in the explorer directory, as did a new Windows PowerShell tab.

@ghost ghost added Area-ShellExtension For issues related to the explorer right-click context menu Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal. labels Jul 2, 2021

@lhecker Leonard Hecker (lhecker) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is correct, but I hope someone else can review the logical correctness.

@zadjii-msft Mike Griese (zadjii-msft) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope someone else can review the logical correctness.

blocking for aforementioned logical correctness discussion

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 6, 2021
@ianjoneill

Copy link
Copy Markdown
Contributor Author

So my thinking behind this was that it would make it similar to you running wt -d . from the address bar in explorer.

The screenshot below shows the current directory for different launch types:

  1. Launch from shell extension without this change
  2. Launch from shell extension with this change
  3. Launch from wt -d . from the address bar in explorer

Current Directory

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 7, 2021
@DHowett

Copy link
Copy Markdown
Member

So, this will definitely work... but only for the default configuration of Terminal. It starts to get a little dicey when you use the "New windows open in ... existing instance of terminal" option. Then again, this doesn't make it worse for anyone else; it is just as ambiguous for reused instances as it ever was. 😁

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On account of the thing I said, I'm cool with this. It's not worse than it was, and it is better for our default configuration. We'll have to figure out what to do in general with the cwd when Remoting is on.

@DHowett

Copy link
Copy Markdown
Member

Thanks for the contribution!

@DHowett Dustin L. Howett (DHowett) added zPreview-Service-Consider AutoMerge Marked for automatic merge by the bot when requirements are met labels Jul 9, 2021
@ghost

Copy link
Copy Markdown

Hello Dustin L. Howett (@DHowett)!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost
ghost merged commit f152573 into microsoft:main Jul 9, 2021
@ianjoneill

Copy link
Copy Markdown
Contributor Author

Yeah I see what you mean.

The current behaviour (new tabs get the working directory that was used to launch the "parent" terminal window) makes sense from a process hierarchy perspective, but I could understand people wanting something else. If it were to be made configurable I get the impression could be a bit tricky to describe in a clear way!

Dustin L. Howett (DHowett) pushed a commit that referenced this pull request Jul 12, 2021
Sets the working directory of the terminal when invoked from the shell extension. This ensures that new tabs opened with a starting directory of `.` open in the directory that the terminal was invoked from.

Closes #8933

## Validation Steps Performed
Manually tested - default PowerShell profile set to use home directory, Windows PowerShell profile set to use current directory. Launched via the shell extension and the default profile opened in the explorer directory, as did a new Windows PowerShell tab.

(cherry picked from commit f152573)
@ghost

Copy link
Copy Markdown

🎉Windows Terminal v1.9.1942.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost

Copy link
Copy Markdown

🎉Windows Terminal Preview v1.10.1933.0 has been released which incorporates this pull request.:tada:

Handy links:

@adrianghc

Adrian Georg Herrmann (adrianghc) commented Jul 24, 2021 •

Copy link
Copy Markdown

This feature does not work for me. I'm using WT Preview 1.10.1933.0. New tabs don't launch in the directory of the first tab when launching WT from the shell extension.

@ianjoneill

Copy link
Copy Markdown
Contributor Author

This feature does not work for me. I'm using WT Preview 1.10.1933.0. New tabs don't launch in the directory of the first tab when launching WT from the shell extension.

Hi Adrian Georg Herrmann (@adrianghc), could you open a new issue and provide a copy of your settings.json?

@adrianghc

Copy link
Copy Markdown

This feature does not work for me. I'm using WT Preview 1.10.1933.0. New tabs don't launch in the directory of the first tab when launching WT from the shell extension.

Hi Adrian Georg Herrmann (@adrianghc), could you open a new issue and provide a copy of your settings.json?

Done at #10789.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-ShellExtension For issues related to the explorer right-click context menu AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Open Windows Terminal here" does not continue to work for subsequent tabs, panes

5 participants