question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Version v2021.2.2 doesn't highlight the #Requires statements

See original GitHub issue

Environment

  • Editor and Version (VS Code, Atom, Sublime): VSCode 1.53.2
  • Your primary theme: Dark+ (default dark)

Issue Description

I just opened some PowerShell scripts and the extension got updated. Right in front of my eyes, I had some #requires statements and they got their highlight stripped off.

Screenshots

image

Expected Behavior

image

The only Theme which still highlights those statements that I found is Night Owl. I have like 10 themes installed and went through all of them and the Night Owl is the only one.

Code Samples

# Az modules
#Requires -Module @{ ModuleName = 'Az.Accounts'; RequiredVersion = '1.9.5' }
#Requires -Module @{ ModuleName = 'Az.ApplicationInsights'; RequiredVersion = '1.1.0' }
#Requires -Module @{ ModuleName = 'Az.Compute'; RequiredVersion = '4.5.0' }
#Requires -Module @{ ModuleName = 'Az.Network'; RequiredVersion = '3.5.0' }
#Requires -Module @{ ModuleName = 'Az.Resources'; RequiredVersion = '2.5.1' }
#Requires -Module @{ ModuleName = 'Az.ServiceBus'; RequiredVersion = '1.4.1' }
#Requires -Module @{ ModuleName = 'Az.Storage'; RequiredVersion = '2.7.0' }
#Requires -Module @{ ModuleName = 'Az.Websites'; RequiredVersion = '1.11.0' }

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
SydneyhSmithcommented, Mar 2, 2021

Thanks everyone, we agree that we should mark comments so that they are not semantically highlighted, and fall back to the TextMate grammar

2reactions
msftrncscommented, Mar 2, 2021

EditorSyntax is no longer used in VS Code when you have the PowerShell extension installed.

Incorrect. Unless your theme is marked as supporting semantic highlighting, you will 100% use the EditorSyntax grammar highlighting. (this is what the OP is running in to) Secondly, anything the symantic highlighting doesn’t handle directly, falls back to the EditorSyntax grammar highlighting.

Third, semantic highlighting was not intended to be a replacement for TextMate grammar’s, but instead a supplement. TextMate is still going to handle things better and be more flexible. In the case of PowerShell, the symantic highlighter is almost useless, as everything can be determined by the TextMate grammar. I am not implying that the current EditorSyntax grammar handles everything, but that a TextMate grammar CAN handle everything PowerShell has to syntax, which so implemented.

My suggestion, STOP semantically highlighting comments, and let that fall back on the TextMate grammar.

Include in that Text Strings, as the semantic highlighting prevents the TextMate grammar from highlighting character escapes. (actually the sematic highlighting will fail on a text string (doublequote) if an intepolated variable appears, so it should just give up trying text strings in general.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Highlight Text in PDF Documents - YouTube
Learn how to highlight a PDF on your iPhone and iPad with PDF Expert. You can easily highlight, underline, and strike out the...
Read more >
dafi36-2406.pdf - Air Force
By Order of the Secretary of the Air Force, this Guidance Memorandum immediately implements changes to Air Force Instruction (AFI) 36-2406, ...
Read more >
Supervisory Highlights: Issue 25, Fall 2021
The findings included in this report cover examinations completed between January 2021 and. June 2021 in the areas of credit card account management,...
Read more >
ANSI Essential Requirements 2022
The ANSI Essential Requirements govern the processes by which standards developers are accredited by ANSI and American National Standards are developed.
Read more >
IATA Dangerous Goods Regulations 62nd Edition (English ...
Users of the IATA Dangerous Goods Regulations are asked to note the following amendments and corrections to the 62nd Edition, effective from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found