PowerShell icon indicating copy to clipboard operation
PowerShell copied to clipboard

Reserved keywords in function names are highlighted incorrectly

Open Christophoclese opened this issue 5 years ago • 2 comments

If a reserved keyword is used as the beginning of a hyphenated function name (e.g., Do-Something or If-Thing) the beginning part of the function name that matches the reserved keyword is highlighted in red.

image

Christophoclese avatar Dec 16 '19 18:12 Christophoclese

This is actually an issue with the language definition from https://github.com/PowerShell/EditorSyntax thing rather than the module, so would have to be fixed there - it's still present in the current version of the definition (and functions the same way in VSCode).

That said, it's possible they won't view it as a bug - comments on https://github.com/PowerShell/EditorSyntax/pull/80 suggest they're only interested in approved verbs, which Do and If aren't.

theaquamarine avatar Feb 02 '20 18:02 theaquamarine

That makes sense. Thanks for the response.

I guess the takeaway is they don't really want you using hyphens in your function names unless you're going to stick to approved verbs?

Christophoclese avatar Feb 03 '20 05:02 Christophoclese