Skip to content

Syntax highlighting "bugs" when using "." or "(" #18

Open

Description

@thiesw

Syntax highlighting is not complete in some cases, correction should be very simple in most cases:

OKAY: $foo ${foo} ${foo.bar}
WRONG (stops at "."): $foo.bar $foo.bar.baz $foo.function(param)

Solution idea:

  • add "." to valid reference characters.
  • for function call the text upto the closing ")" should be highlighted, maybe the part "(...)" even in a different color, e.g. "reference parameters")

Directives may have parenthesis, e.g. #foreach($x in $coll) or #if(condition)
The whole text (upto closing ")") should be highlighted as directive, but references therein should be colored as reference of course, so "#foreach ... )" as directive but "$x" und $coll" as reference.
A full correct implementation involves parsing because "()" can be nested here - but a first (and quick) correction may simple look for the first ")" because this is the 80-90% use case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions