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

VSCode PowerShell syntax highlighting 'messed up' by changing file under VSCode #3247

Open
charliearcuri opened this issue Mar 16, 2021 · 2 comments
Labels
Area-IntelliSense Issue-Enhancement A feature request (enhancement).

Comments

@charliearcuri
Copy link

charliearcuri commented Mar 16, 2021

20210315 1615856510-81b75b36-ddce-47dd-b292-72c53676f7601615855631823.zip
20210315 VSCode PowerShell syntax highlighting 'messed up' by changing file under VSCode

Issue Description

I am experiencing a problem with syntax highlighting when a .ps1 changes underneath VSCode.
Similarly, some changes cause PSScriptAnalyzer issues (e.g. "missing }" warnings that I could not make sense of)

Repro Steps

  1. open VSCode - open output folder of my VS2019 project
  2. open SDF-UefiFlash.ps1 using VSCode's Explorer
  3. observe syntax highlighting (it is correct at this point)
  4. close SDF-UefiFlash.ps1 in VSCode but keep the folder open
  5. while keeping VSCode open, open VS2019 and open the solution that contains SDF-UefiFlash.ps1 in addition to a .NET class library used by the .ps1 script
  6. In VS2019, make a change to SDF-UefiFlash.ps1 - this file being modified here is checked into git. The change I made was to add a .PARAMETER definition to the synopsis at the top of the file.
  7. rebuild all in VS2019 - this copies the newly changed version of SDF-UefiFlash.ps1 to the output folder that VSCode has open
  8. re-open SDF-UefiFlash.ps1 in VSCode

Expected Behaviour

The syntax highlighting works when I open a .ps1 in VSCode even if I have used VS2019 to update the file and published it to the folder VSCode has opened by 'rebuilding all' in VS2019.

Actual Behaviour

If I "rebuild all" in VS2019 while VSCode has the output folder open, when I open the .ps1 (which is copied to the output folder by the VS2019 rebuild all), the syntax highlighting is "messed up" - presumably because VSCode has some information about the syntax highlighting cached.

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19042
VSCode 1.54.3
PowerShell Extension Version 2021.2.2

PowerShell Information

Name Value
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.0.0 6.1.0 6.2.0 7.0.0 7.1.3
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
cpptools ms-vscode 1.2.2
jupyter ms-toolsai 2021.3.619093157
powershell ms-vscode 2021.2.2
python ms-python 2021.2.636928669
@ghost ghost added Needs: Triage Maintainer attention needed! Needs: Maintainer Attention Maintainer attention needed! labels Mar 16, 2021
@SydneyhSmith
Copy link
Collaborator

SydneyhSmith commented Mar 17, 2021

Thanks @charliearcuri this issue is related to our handling of external file change notifications--we will need to investigate what this work would entail after PowerShell/PowerShellEditorServices#1295 improves our thread handling

@SydneyhSmith SydneyhSmith added Area-IntelliSense Issue-Enhancement A feature request (enhancement). and removed Needs: Maintainer Attention Maintainer attention needed! Needs: Triage Maintainer attention needed! labels Mar 17, 2021
@ninmonkey
Copy link

Does it occur when semantic is disabled?

settings.json

"[powershell]": {
    "editor.semanticHighlighting.enabled": false
}

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Mar 27, 2021
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IntelliSense Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

3 participants