Skip to content

Highlight parameter names after function invocation #76

Open
@omniomi

Description

@omniomi

Given Get-ChildItem -Path . -Recurse I cannot find a way to highlight "Path" and "Recurse". Currently I've only managed to highlight the -. The same goes for say "regex" in switch -Regex () {}.

It's gross but surly something like \\s\\-(?!(?i:[ic]?(?:eq|ne|gt|lt|ge|le|not|isnot|is|f|as|like|notmatch|match|notcontains|contains|in|and|or|xor|join|split|band|bor|bnot|bxor|replace))\\s)\\w+ would cover it? Provided it didn't step on constant.numeric and override negative integer highlighting.

Playing around on my own computer and adding this to powershell.tmLanguage.json:

{
    "match": "\\s\\-(?!(?i:[ic]?(?:eq|ne|gt|lt|ge|le|not|isnot|is|f|as|like|notmatch|match|notcontains|contains|in|and|or|xor|join|split|band|bor|bnot|bxor|replace))\\s)\\w+",
    "name": "variable.parameter.powershell"
},

I get the desired result although there may be edge cases I am not considering...

operators
commands

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions