Skip to content

Issue with Syntax Coloring #32

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

Closed
daviwil opened this issue Jan 30, 2017 · 3 comments
Closed

Issue with Syntax Coloring #32

daviwil opened this issue Jan 30, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@daviwil
Copy link
Contributor

daviwil commented Jan 30, 2017

From @Roadkill4545 on January 30, 2017 15:13

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.

Copied from original issue: PowerShell/vscode-powershell#472

@daviwil
Copy link
Contributor Author

daviwil commented Jan 30, 2017

From @Roadkill4545 on January 30, 2017 15:24

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

@daviwil
Copy link
Contributor Author

daviwil commented Jan 30, 2017

From @rkeithhill on January 30, 2017 17:56

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

@omniomi
Copy link
Contributor

omniomi commented May 21, 2018

This was resolved by #94

@omniomi omniomi closed this as completed May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants