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

Issue with Syntax Coloring #472

Closed
BrandonStiff opened this issue Jan 30, 2017 · 6 comments
Closed

Issue with Syntax Coloring #472

BrandonStiff opened this issue Jan 30, 2017 · 6 comments

Comments

@BrandonStiff
Copy link

BrandonStiff commented Jan 30, 2017

System Details

  • Operating system name and version: Windows 8.1
  • VS Code version: 1.8.1
  • PowerShell extension version: 0.9.0
  • Output from $PSVersionTable:

Name Value


PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Evaluate $PSVersionTable in PowerShell and paste the output here

Issue Description

This should be an easy one (I hope!). I am experiencing a problem with syntax highlighting and color. The syntax coloring becomes off when I use the following line of code in my script:

[ValidatePattern("^([0-9A-Ha-h][0-9A-Ha-h](:|-)?){7}[0-9A-Ha-h][0-9A-Ha-h]`$")][String[]] $Wwpn,

Specifically, it takes issue with the backtick-dollarsign combination. If I remove the dollar sign, the coloring in all of the code below this line works again. Note the code itself works correctly, its simply the syntax color highlighting in VS Code that breaks. Here is an example of how to reproduce:

  1. Create a new script in VS Code.
  2. Save it as a .ps1 file.
  3. Paste this code function snippet inside.
function Test-Function1()
 {
   param
   (
     [ValidatePattern("^([0-9A-Ha-h][0-9A-Ha-h](:|-)?){7}`$")][String[]] $Wwpn,
     [string] $p1,
     [string] $p2
   )
   Write-Host ("All of the text colors are correct, but they will be broken below.")
 }
 
 function Test-Function2()
 {
   param
   (
     [ValidatePattern("^([0-9A-Ha-h][0-9A-Ha-h](:|-)?){7}[0-9A-Ha-h][0-9A-Ha-h]`$")][String[]] $Wwpn,
     [string] $p1,
     [string] $p2
   )
   Write-Host ("The [0-9A-Ha-h][0-9A-Ha-h] sequence in function1 above breaks the code coloring.  Not sure why...")
 }

 # Observe the oddness in code coloring.  However the functions above indeed do work!

Attached Logs

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

@BrandonStiff
Copy link
Author

I munged up the formatting on the code. I updated it above. (Sorry about that).

@rkeithhill
Copy link
Collaborator

The syntax highlighting for PowerShell is done in the https://github.com/PowerShell/EditorSyntax project. Can you post this defect there?

@daviwil
Copy link
Contributor

daviwil commented Jan 30, 2017

This issue was moved to PowerShell/EditorSyntax#32

@daviwil daviwil closed this as completed Jan 30, 2017
@daviwil
Copy link
Contributor

daviwil commented Jan 30, 2017

Thanks @Roadkill4545, I just moved the issue over to the PowerShell/EditorSyntax repo so that we can track it there.

@BrandonStiff
Copy link
Author

Thank you! Sorry for the misunderstanding.

@daviwil
Copy link
Contributor

daviwil commented Jan 30, 2017

No misunderstanding at all, we need to be more clear about where to file syntax bugs.

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

No branches or pull requests

3 participants