vscode-ebnf icon indicating copy to clipboard operation
vscode-ebnf copied to clipboard

syntax coloring is unexpected

Open medovina opened this issue 1 year ago • 2 comments

I like the functionality of this extension a lot. However, it chooses syntax colors that aren't what I would expect.

  • I would expect strings in an EBNF specification to appear in the same color as constant strings in code, e.g. in a Python program. In my Visual Studio theme (Light Modern), this is red. But with this extension strings appear black.

  • This extension colors a non-terminal that's being defined (on the left side of '=') in the same color that Visual Studio uses for keywords in programming languages. In the Light Modern theme this is blue. That seems wrong to me, since a non-terminal is not a keyword. In my opinion, a non-terminal that's being defined should have the same color as a non-terminal that's being used (on the right side of '='). By analogy, if I write Python code such as

def foo(x):
   return bar(x)

then VS Code displays 'foo' and 'bar' in the same color, even though 'foo' is a function that's being defined and 'bar' is a function that's being called. Simply put, they are both the same kind of thing, i.e. a function, so I think they should have the same color.

I know that these colors are a matter of opinion, so if you disagree you can simply close this. But I thought I would at least bring this up.

medovina avatar Feb 25 '24 07:02 medovina

Now that I've used the extension a bit more, I think that having a different color on the left side of the '=' is not so bad, so maybe my second point above is not so important. I still think it would be nicer if strings were colored consistently with source files containing code.

medovina avatar Feb 25 '24 07:02 medovina