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

Fix keys used to resolve terminal settings #132851

Merged

Conversation

IllusionMH
Copy link
Contributor

@IllusionMH IllusionMH commented Sep 10, 2021

This PR fixes #132718 ("open in integrated terminal") and most likely #132824 (npm scripts, etc.)

Also this one looks like resolving infamous #132150 as well.

TerminalSettingPrefix.* enum members already have . in the end (e.g 'terminal.integrated.shell.') and initially used in simple string concatenation perfix + platform but in some template literal values has additional . added which results in undefined instead of user configured settings.

@meganrogge @Tyriar it would be nice to consider this for recovery as well.

@IllusionMH
Copy link
Contributor Author

IllusionMH commented Sep 10, 2021

Verified couple of times - with this change I can revert back changes in createTerminal and still have Git Bash started on VS Code restart.

async createTerminal(options?: ICreateTerminalOptions): Promise<ITerminalInstance> {
-	if (!this._availableProfiles) {
-		await this._refreshAvailableProfilesNow();
-	}
-	const config = options?.config || this._availableProfiles?.find(p => p.profileName === this._defaultProfileName);
+	const config = options?.config;

Will create follow-up PR with this change and related cleanup so it can be verified in Insiders before release, while I think c813199 should be included into Recovery release.

@IllusionMH
Copy link
Contributor Author

@Tyriar could you please take a look on this PR. It's good candidate for Recovery release as it solves set of issues with Terminal profiles.

@meganrogge meganrogge merged commit 20388b6 into microsoft:main Sep 10, 2021
@meganrogge meganrogge added this to the August 2021 Recovery milestone Sep 10, 2021
@meganrogge
Copy link
Contributor

Thanks!

@Tyriar
Copy link
Member

Tyriar commented Sep 10, 2021

@IllusionMH FYI I don't think we can remove that !this._availableProfiles check as it would introduce a low repro race condition; it's used later on in the terminal creation flow.

@IllusionMH
Copy link
Contributor Author

@Tyriar agree about check and awaiting for . Borrowed some code from my POC that helps to repro race conditions to repro this one again 😄 For some reason it was harder then before.

However I doubt that || this._availableProfiles?.find(...) is needed anymore as it was first change (fixed Create terminal button) to get profiles when there was no options.config.

P.S. Also Thank you and @meganrogge for considering it for Recovery and your patience! ❤️
Sorry for being so annoying with this change

@IllusionMH IllusionMH deleted the fix-terminal-profiles-resolution branch September 10, 2021 17:35
@Tyriar
Copy link
Member

Tyriar commented Sep 10, 2021

Yep that might not be needed due to resolving happening later on:

await this._terminalProfileResolverService.resolveShellLaunchConfig(shellLaunchConfig, {
remoteAuthority: undefined,
os: OS
});

Little hesitant to change unless there's an issue though.

@mcheedle
Copy link

Will this resolve #132766 as well?

@IllusionMH
Copy link
Contributor Author

IllusionMH commented Sep 10, 2021

I believe that it should. You can try latest Insiders build which includes this change and another tuning form Tyriar.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context menu command "Open in Integrated Terminal" does not use Default Profile
4 participants