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

git cannot bring up VScode diff tool under powershell ISE #4908

Closed
6 tasks done
jdai opened this issue Jan 31, 2024 · 4 comments
Closed
6 tasks done

git cannot bring up VScode diff tool under powershell ISE #4908

jdai opened this issue Jan 31, 2024 · 4 comments

Comments

@jdai
Copy link

jdai commented Jan 31, 2024

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

when use "git difftool", on PS it pops up vscode and works well, or PS ISE it doesn't pop up vscode and stuck.

this case might similar as: #4012

OS Name Microsoft Windows 11 Enterprise
Version 10.0.22631 Build 22631

PowerShell Version

PS E:\repos\king> $PSVersionTable; $Host

Name                           Value                                                                                                                                    
----                           -----                                                                                                                                    
PSVersion                      5.1.22621.2506                                                                                                                           
PSEdition                      Desktop                                                                                                                                  
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                  
BuildVersion                   10.0.22621.2506                                                                                                                          
CLRVersion                     4.0.30319.42000                                                                                                                          
WSManStackVersion              3.0                                                                                                                                      
PSRemotingProtocolVersion      2.3                                                                                                                                      
SerializationVersion           1.1.0.1                                                                                                                                  

Name             : Windows PowerShell ISE Host
Version          : 5.1.22621.2506
InstanceId       : b41bcafd-56c2-4c89-b635-42369ab60fcb
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : zh-CN
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.Host.ISE.ISEOptions
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

PS E:\repos\king> code --version
1.85.2
8b3775030ed1a69b13e4f4c628c612102e30a681
x64

Extension Version

PS E:\repos\king> code --list-extensions --show-versions | Select-string powershell

[email protected]

Steps to Reproduce

1)start powershell ISE
2)setup vscode/git env, touch one for file that is in git repo(say file1.txt) then edit .gitconfig by:
PS> config --global -e
......#add these lines below:
[diff]
tool = vscode
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTE
[merge]
tool = vscode
[mergetool "vscode"]
cmd = code --wait $MERGED
3)run:
PS E:\repos\king> git difftool

Viewing (1/1): 'tools/pwsh/modules/Build-Utils.psm1'
git difftool
PS E:\repos\king> git difftool
then stuck.

On PS(not ISE), same command will lead to:
PS E:\repos\king> git difftool

Viewing (1/1): 'tools/pwsh/modules/Build-Utils.psm1'
Launch 'vscode' [Y/n]?
type S and it will continue to pop up vscode window. both PS and PS ISE run as admin.

Visuals

No response

Logs

No response

@jdai jdai added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Jan 31, 2024
@JustinGrote
Copy link
Collaborator

JustinGrote commented Jan 31, 2024

Thanks for the submission! But if I'm reading this right, you're trying to run PowerShell ISE and then start vscode from ISE? This all works just fine from a cmd or pwsh command prompt so if it doesn't work in ISE there's not much we can do about this in terms of the extension, PowerShell ISE is deprecated.

I have my git configured to use vscode and that is configured for code --wait and works just fine in cmd, bash, and pwsh
image

@JustinGrote
Copy link
Collaborator

I was able to reproduce in ISE, this has to do with how the custom ISE host is probably handling the interactive prompt of Launch vscode [y/n]. Unfortunately that's nothing we can fix here, we recommend you use VSCode with the PowerShell extension, it is the currently supported official way to author PowerShell. This would have to be fixed in ISE and that's deprecated so unlikely unless something was fixed in git directly to handle this maybe it's unlikely.

image

As such I'm going to close this as wontfix. Sorry, but there's nothing we can do to fix this, it's not in the scope of the vscode extension.

@JustinGrote JustinGrote closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
@JustinGrote JustinGrote added Area-ISE Compatibility Resolution-External Will close automatically. and removed Needs: Triage Maintainer attention needed! Resolution-External Will close automatically. labels Jan 31, 2024
@jdai
Copy link
Author

jdai commented Feb 1, 2024

thanks for fast review. I am involved in Microsoft projects and we still use PS ISE. PS has one problem - ninja problem as I filed here: ninja-build/ninja#2379

@JustinGrote
Copy link
Collaborator

Sorry to hear that, as a workaround you can have a normal powershell window next to your ISE and whenever you need to do a diff, run the command there rather than ISE, should work fine. If there's a git config setting to disable that prompt, that would probably work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants