Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30486
    Jamil
    Participant

    I 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?

    #30487
    Patrick C
    Participant

    My 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.esy

    #30488
    Jamil
    Participant

    Yours is working much better.

    Thank you!

    #30489
    Jamil
    Participant

    Syntax 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.

    #30490
    Jamil
    Participant

    I 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:
    Screenshot of issue

    #30491
    Patrick C
    Participant

    Sort-Object works in my case (I OCR copy pasted line 47 of your example)

    In ToolsProperties for Current ConfigurationHighlight (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”

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Questions and Answers about EmEditor Core’ is closed to new topics and replies.