Closed aeschli closed 6 years ago
I've started looking at some of these issues, but there's quite a bit to go through here. Some of the issues (i.e. EQU, NOT, @, redirection characters) can be attributed to the syntax theme. They are scoped, but if the syntax theme you are using does not have a style definition for that scope, they will appear not be highlighted.
I will get fixes out for some of the easier issues to fix. The others might take some time. As mentioned, batch files have a rather complex "language" that is becoming increasingly difficult to express using these regex based definitions.
OK, thank you very much; I am using the default theme and no extensions -- so the lack of applied colours should be resolve upstream
From @Kroc on April 6, 2018 8:35
Issue Type: Bug
There are a handful of highlighting issues with Windows Batch files:
[x]
ECHO:
is not recognised, whenECHO.
is;ECHO:
is faster as it does not do a file lookup! -- see: https://ss64.com/nt/echo.html[x] The
OFF
inECHO OFF
is not highlighted[x] The following code gets highlighting confused (the
"$...
seems to throw it off)[x] No space between
GOTO
and the label name does not highlight correctly; i.e.GOTO:EOF
[x]
CLS
keyword is not highlighted[x]
EQU
/NOT
and other comparison operators are not highlighted[ ]
IN
&DO
are not highlighted[x] command concatenator
&
, and the pipe operators>
,|
are not highlighted nor pipe numbers for redirection, e.g.>NUL 2>&1
(a common way to suppress all output)[x] error-suppressor
@
is not highlighted in any way; this needs to be highlighted when used with a command, but not within 'strings' (which may or may not be quoted, according to command used)[x]
ENABLEEXTENSIONS
/DISABLEDELAYEDEXPANSION
etc. not highlighted along withSETLOCAL
[x] Syntax break-down here: (looks like the quoted paren-escape failed to be noticed)
Aside: What would be the best way to broach a discussion on using a PEG-based parser, rather than the regex-infused TextMate system for VSCode? Windows Batch files happen to be one of the best examples of extremely complex mode-like behaviour that would be easily and elegantly handled by a real state machine based approach using PEG/EBNF grammars. Grammar based parsing would also be readily shareable between language servers and other external software.
VS Code version: Code 1.22.1 (950b8b0d37a9b7061b6f0d291837ccc4015f5ecd, 2018-04-06T02:26:57.615Z) OS version: Windows_NT x64 10.0.16299
Extensions: none
Copied from original issue: Microsoft/vscode#47297