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

Don't see git push terminal quickfix #167613

Closed
bamurtaugh opened this issue Nov 29, 2022 · 33 comments
Closed

Don't see git push terminal quickfix #167613

bamurtaugh opened this issue Nov 29, 2022 · 33 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster

Comments

@bamurtaugh
Copy link
Member

Testing #167475

  • Open GH repo in VS Code Insiders
  • Create new branch off main
  • Make and commit a change in new branch
  • I thought I followed the steps shown in docs that'd produce a quick fix, but I'm not seeing one:

image

I assume I'm missing something obvious, but I can't seem to figure it out from experimentation and reviewing docs.

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

@bamurtaugh I think you have shell integration disabled as I don't see the circles to the left?

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Nov 29, 2022
@meganrogge
Copy link
Contributor

meganrogge commented Nov 29, 2022

or it failed to activate for some reason - can you hover the terminal tab @bamurtaugh ?

Screenshot 2022-11-29 at 1 39 57 PM

@bamurtaugh
Copy link
Member Author

bamurtaugh commented Nov 29, 2022

I just took the manual steps to enable shell integration in my PowerShell profile, and when I hover over the terminal tab, I see it says shell integration activated:

image

I tried the same steps but nothing seems to have changed:

image

I realize the manual PowerShell configuration (shown below) uses vscode and code - should I update to code-insiders?

if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --locate-shell-integration-path pwsh)" }

I tried changing the latter code to code-insiders but didn't see a difference.

I also tried completely deleting the line from the PowerShell profile, and when I hover over the terminal tab, it still says Shell integration activated.

@meganrogge
Copy link
Contributor

what is your powershell profile @bamurtaugh ?

@rzhao271
Copy link
Contributor

I have the same issue on Ubuntu 16 with bash:
Screenshot showing the message to create a PR, but with no lightbulb

@bamurtaugh
Copy link
Member Author

bamurtaugh commented Nov 29, 2022

From running code-insiders $Profile, the C:\Users\brmurtau\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 file opens, and it is empty. I tried adding the manual installation line and reloading, but no change, so I've now removed it again.

I decided to go through the flow again, since maybe I wasn't fully closing terminals and then reloading before, and here's what happened:

I closed all my terminals and reloaded VS Code one more time, and now when I hover over the Powershell tab, I don't see a mention of shell integration:

image

I tried pasting in the manual install line in my PowerShell Profile, and then I got the following in a terminal, which I think makes sense since I only have Insiders installed:

image

I updated the install line to mention code-insiders (if ($env:TERM_PROGRAM -eq "vscode") { . "$(code-insiders --locate-shell-integration-path pwsh)" }), closed the terminal, reloaded VS Code, and now I see the integration failed to activate:

image

@meganrogge
Copy link
Contributor

here are the profiles I meant above... you should have one called powershell. also, do you have the pwsh extension installed?

Screenshot 2022-11-29 at 2 02 08 PM

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

The regex should match those 🤔

// The previous line starts with "Create a pull request for \'([^\s]+)\' on GitHub by visiting:\s*"
// it's safe to assume it's a github pull request if the URL includes `/pull/`
export const GitCreatePrOutputRegex = /remote:\s*(?<link>https:\/\/github\.com\/.+\/.+\/pull\/new\/.+)/;

@bamurtaugh If you're in VS Code's screen reader mode, shell integration will not work (it may say it activated which is a bug). This is because we depend upon PSReadLine which is pwsh disables if a screen reader is detected.

@meganrogge
Copy link
Contributor

I have the same issue on Ubuntu 16 with bash: Screenshot showing the message to create a PR, but with no lightbulb

this looks different because shell integration is working for you. thanks for creating that separate issue

@meganrogge
Copy link
Contributor

@bamurtaugh can you set log level to debug, open dev tools, and screenshot it like this when you run a command such as git sttatus?
Screenshot 2022-11-29 at 2 04 36 PM

@bamurtaugh
Copy link
Member Author

bamurtaugh commented Nov 29, 2022

I just deleted the line from the PowerShell Profile I was editing, closed the terminal, and reloaded VS Code. I do not have the PowerShell extension installed. I do not have a mention of PowerShell in my settings.json.

I now changed log level to debug from trace. I ran git sttatus and here's the dev tools:

image

If I hover over the PowerShell tab, it says shell integration failed to activate.

@meganrogge
Copy link
Contributor

Until shell integration activates, this won't work. What's the warning from powershell in your terminal say? And can you share your settings.json file?

@bamurtaugh
Copy link
Member Author

What's the warning from powershell in your terminal say?

When I add if ($env:TERM_PROGRAM -eq "vscode") { . "$(code-insiders --locate-shell-integration-path pwsh)" } to my Profile file? If so, it's:

At C:\Users\brmurtau\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\v
s\workbench\contrib\terminal\browser\media\shellIntegration.ps1:30 char:56
+                 [System.Text.Encoding]::UTF8.GetBytes($match.Value)
+                                                                    ~
Missing closing ')' in expression.
At C:\Users\brmurtau\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\v
At C:\Users\brmurtau\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\v 
s\workbench\contrib\terminal\browser\media\shellIntegration.ps1:34 char:3
+     })
+      ~
Unexpected token ')' in expression or statement.
At C:\Users\brmurtau\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\v 
s\workbench\contrib\terminal\browser\media\shellIntegration.ps1:35 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : MissingEndParenthesisInExpression

I'm attaching my settings.json here: settingsNov.txt.

@meganrogge
Copy link
Contributor

meganrogge commented Nov 29, 2022

Manual install shouldn't be required so you can remove everything from your profile. I'd recommend doing that then running import-module psreadline

@bamurtaugh
Copy link
Member Author

I removed the manual install line and reloaded. Then I ran import-module psreadline in an integrated PowerShell terminal.

I do now see more highlighting in the terminal!

image

And hovering over the tab says the shell integration is activated.

image

But I'm not seeing a lightbulb.

@meganrogge
Copy link
Contributor

ok great progress - now can you set log level to debug, run git sttatus and screenshot the result?

@meganrogge
Copy link
Contributor

also just fyi from a time saving perspective - no need to reload 😄 just create a new terminal bw changes

@meganrogge
Copy link
Contributor

you still don't have command decorations, which is surprising given shell integration is activated

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

@bamurtaugh I'm pretty sure you're in screen reader mode or otherwise pwsh is detecting a screen reader so psreadline isn't getting enabled which causes shell integration not to work.

@bamurtaugh
Copy link
Member Author

@Tyriar I don't see indication I'm in screenreader mode (i.e. the status bar UI mentioned here).

When selecting "Use screen reader" in Windows, I don't see any options checked:
image

However, when I open a new terminal, I do still see the warning:
Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.

Any advice for how to disable? I see a lot of different info online, so not sure if you have one top of mind.

Subsequent terminals also fail to activate shell integration, even if I run the import-module psreadline:

image

@meganrogge
Copy link
Contributor

meganrogge commented Nov 29, 2022

looks like Set-ItemProperty 'registry::HKEY_CURRENT_USER\Control Panel\Accessibility\Blind Access' On 0 then reboot

@meganrogge
Copy link
Contributor

you can also check the value of that via Get-ItemPropertyValue 'registry::HKEY_CURRENT_USER\Control Panel\Accessibility\Blind Access' On

@bamurtaugh
Copy link
Member Author

Get-ItemPropertyValue 'registry::HKEY_CURRENT_USER\Control Panel\Accessibility\Blind Access' On outputs 1, so I'll set to 0 and restart in a bit to see if that helps.

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

If you see this, shell integration and quick fixes will definitely not work:

Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.

Touching the registry seems risky, I'd search for why pwsh is detecting a screen reader, this will do you good in the long run as PSReadLine makes the PS experience so much better. One possible way to work around this is to run Import-Module PSReadLine inside your profile (run code $Profile). Just running it in the terminal won't get shell integration to work, it needs to be in your profile.

@bamurtaugh
Copy link
Member Author

Hmm okay, I'll do some further digging. Adding Import-Module PSReadLine to my Powershell Profile doesn't make a difference (and others online say the same), so I'll need to find the root cause.

@bamurtaugh
Copy link
Member Author

Okay I managed to turn off screen reader access - I no longer get the warning when I open an integrated terminal or an external PowerShell terminal.

But shell integration is still failing to activate:

image

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

@bamurtaugh what version of powershell are you using? Shell integration is best with pwsh 7.

@bamurtaugh
Copy link
Member Author

$PSVersionTable outputs 5.1.25247.1000 for PSVersion. So I just installed PowerShell 7 and created a terminal profile for it in VS Code.

I now got the quick fix! Although as shown in the image, each time I open a new PowerShell 7 terminal instance, the typing is a bit odd and overlaps:

image

When I ran the command again, the text didn't overlap, but I didn't get a lightbulb:

image

Not sure if this is expected?

It also took some time to 1) realize I needed PowerShell 7, 2) detect PowerShell 7 in VS Code. Not sure if these items are documented.

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

It not working here (on Windows) is actually a known issue and there isn't much we can do about it:

image

See #153476

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

Also the typing overlapping it also a conpty problem that I don't think it on our end.

@bamurtaugh
Copy link
Member Author

I tried the git push commands, and there are no warnings either:

image

I opened a new terminal, and it worked, and I get the telemetry logged correctly.

image

Let me know if there's anything else I can provide about the topics I mentioned above. Otherwise, I've now gotten this working, it's just not super regular and perhaps there could be greater details in docs (about versions, detecting latest version, etc).

@Tyriar
Copy link
Member

Tyriar commented Nov 29, 2022

@bamurtaugh looks like the first terminal doesn't have shell integration still, but the new one does. Since it works sometimes I'm guessing it just doesn't work now when the "placeholder decoration" isn't in the expected spot which breaks the command output detection, so a dupe of #153476

@meganrogge
Copy link
Contributor

/duplicate #153476

@vscodenpa vscodenpa added the *duplicate Issue identified as a duplicate of another issue(s) label Dec 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants