Skip to content

Update VS Code shell integration script #1982

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

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

andyleejordan
Copy link
Member

Updates our embedded copy with changes made upstream, see microsoft/vscode#170516.

Fixes PowerShell/vscode-powershell#4343.

@andyleejordan andyleejordan requested a review from a team January 3, 2023 20:40
@andyleejordan
Copy link
Member Author

@SeeminglyScience @Tyriar I think the change we make from Console::Write to Write-Host -NoNewLine could be shipped upstream, and I'm wondering if we should change:

# Only send the command executed sequence when PSReadLine is loaded, if not shell integration should
# still work thanks to the command line sequence
if (Get-Module -Name PSReadLine) {
	$__VSCodeOriginalPSConsoleHostReadLine = $function:PSConsoleHostReadLine
...
}

to

if (Get-Module -Name PSReadLine -and $Host.Name -ne "Visual Studio Code Host") {
	$__VSCodeOriginalPSConsoleHostReadLine = $function:PSConsoleHostReadLine
...
}

then at least I won't have to change those two things when importing the script, and that gets us closer to somehow doing what I think is the "Right Thing" and getting either PSES or VS Code to load the upstream shell integration script even for PSES Extension Terminals.

@andyleejordan andyleejordan enabled auto-merge (squash) January 4, 2023 19:19
Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM!

@andyleejordan andyleejordan merged commit d27fe8c into main Jan 4, 2023
@andyleejordan andyleejordan deleted the andschwa/update-shell-integration branch January 4, 2023 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Engine Issue-Bug A bug to squash.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VS Code Integrated Terminal Reports Error From Script NOT Being Debugged
2 participants