Tagged: PowerShell Syntax Highlighting
-
AuthorPosts
-
November 21, 2025 at 6:33 pm #30486
Jamil
ParticipantI downloaded the PowerShellV2.esy syntax definition from https://github.com/Emurasoft/library/blob/main/syntax-files/PowerShellV2.esy. I am noticing that even though the file contains Write-Host defined on line 537, this command is not syntax highlighted. “Write-” is syntax highlighted, but Host is not. “Wait-Process” is fully syntax highlighted. Any ideas why this would be?
November 22, 2025 at 11:43 am #30487Patrick C
ParticipantMy guess:
Line 163 contains “write”
“Write-Host” is on line 537, resulting in “write” matching before “Write-Host”.
However if this were true, then none of the other “Write-…” statements would match.
What you can try is test this by deleting line 163.In case of interest:
While its not perfect, I do have an alternative PowerShell highlighter file.
PowerShell_by_PC.esyNovember 22, 2025 at 12:13 pm #30488Jamil
ParticipantYours is working much better.
Thank you!
November 23, 2025 at 1:09 pm #30489Jamil
ParticipantSyntax coloring is very difficult under EmEditor. I was seeing some unwanted colors even with the esy file suggested above. For example, Strings were appearing as PINK in color that I absolutely could not change.
What I ended up doing was asking Poe AI how to fix the colors the way I wanted. It kept referring to old versions of EmEditor and provided steps that made colors much worse. I ended up sharing screenshots of options telling it that it is providing wrong information. After doing this repeatedly, it finally figured out that to get colors the way I want I must create and use my own custom theme, because these wacky colors are hard baked into EmEditor.
It created a custom theme for me, and I am now using this for colors exactly how I want them.
November 23, 2025 at 1:48 pm #30490Jamil
ParticipantI am facing a similar issue now with PowerShell “Sort-Object” commandlet parameter. It is appearing in two different colors. I found that specific item under Highlight(1), and Whole Word Only is checked off. “Sort-Object” is not being treated as a whole word. “Sort-” is a different color than “Object”
Here is an image showing the issue:
November 24, 2025 at 1:40 am #30491Patrick C
ParticipantSort-Object works in my case (I OCR copy pasted line 47 of your example)
In Tools → Properties for Current Configuration → Highlight (1)
What you can check is:
1) When importing the esy file with “Import…”:
Select “Yes” to remove old items. → Prevent conflict with previous definitions.2) In the drop down list just below the “Enable Keyword Highlight” drop down box:
Select “Only User-Defined Strings” -
AuthorPosts
- The forum ‘Questions and Answers about EmEditor Core’ is closed to new topics and replies.