-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Description
There's syntax highlighting as part of the PowerShell extension to indicate commands. This makes things like something.bat and ipconfig.exe the same color as PowerShell cmdlets like import-module. The highlighting for .bat and .exe files doesn't properly detect when .bat or .exe is part of a longer word. It also does not properly highlight .bat and .exe files whose names start with numbers.
Code to reproduce
something.bat
ipconfig.exe
Import-Module AzureRM.Backup
Import-Module AzureRm.Batch
Import-Module AzureRm.Exefake
Import-Module AzureRM.Cdn
21jumpstreet.bat
Result of code
Using Monokai Dimmed theme for emphasis.

Lines 4, 5 and 7 have incorrect syntax highlighting.
Diagnostic info
code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
code -v
1.11.2
6eaebe3b9c70406d67c97779468c324a7a95db0e
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.1066
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.1066
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Possible Fix
It appears that the regular expression that detects these patterns is flawed: https://github.com/Microsoft/vscode/blob/master/extensions/powershell/syntaxes/PowershellSyntax.tmLanguage#L243
By replacing the above linked line with a better regular expression, this issue could be resolved.
More appropriate regular expression
<string>(\b(([A-Za-z0-9\-_\.]+).(?i:exe|com|cmd|bat))\b)</string>
