vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Text corrupted when formatting the code after a branch switch

Open andrewducker opened this issue 3 years ago • 0 comments

Prerequisites

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

Summary

I am experiencing an issue with formatting. I expect the formatted code to only contain text from the current branch, but it intermittently contains code from the previous branch I was working on.

PowerShell Version

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

Visual Studio Code Version

1.70.0
da76f93349a72022ca4670c1b84860304616aaa2
x64

Extension Version

[email protected]

Steps to Reproduce

Work on a relatively large file (couple of hundred lines in my experience). Switch to a different branch, with somewhat different code Format the code (in my case automatically on save) Find code from the first branch splatted in a random location on the new branch

Once this happens, the only way to fix it that I've found is to restart VSCode.

I suspect that the Language Server isn't being reset when we switch branches.

Visuals

No response

Logs

No response

andrewducker avatar Aug 09 '22 10:08 andrewducker

Thanks @andrewducker sorry to hear you are hitting this issue...we will need to do more investigation.

SydneyhSmith avatar Aug 11 '22 17:08 SydneyhSmith

I've been having the same issue for a while, but haven't found a consistent repro.

@andrewducker Do you work in a devcontainer? I do, so just wondering if it can be ruled out as a reason.

fflaten avatar Aug 13 '22 11:08 fflaten

I'm not in a devcontainer.

andrewducker avatar Aug 13 '22 11:08 andrewducker

This issue was closed automatically as repro info was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information!

msftbot[bot] avatar Aug 21 '22 13:08 msftbot[bot]