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

Method arguments cause incorrect syntax highlighting

Open dstodev opened this issue 4 years ago • 4 comments

When writing a class: image

Adding parameters to the method seems to break syntax highlighting: image

Am I using the incorrect syntax for this? The issue persists with all color themes I have installed, including defaults.

dstodev avatar Jun 30 '20 17:06 dstodev

Any PRs about syntax highlighting are welcome..

My expectation, it's enough as it meets the basic usage. Because of the flexibility of plantuml syntax, the highlight rule will never be perfect, and it's already too complex now.

qjebbs avatar Aug 03 '20 08:08 qjebbs

Actually, I think the issue here is that things like method arguments aren't part of the syntax. PlantUML doesn't do true parsing, because it's not a formally defined language. Perhaps (if this project becomes stable) the syntax highlighting could be reused from this project: https://github.com/Enteee/plantuml-parser

fuhrmanator avatar Aug 10 '20 14:08 fuhrmanator

@fuhrmanator With a parser, we can create a more smarter autocompletion. But the syntax highlighting is based on REGEXP rules, cannot do parse works, that's why highlighting rules has been very complicated, but far not perfect, and won't be.

qjebbs avatar Aug 11 '20 02:08 qjebbs

It might be something to consider (and I know it's not a simple undertaking) handling things with a language server rather than trying to force-fit it into regex. You can use semantic document tokens when you have a language server that allow far richer support for weird conditions. That might allow that plantuml-parser package to be useful.

I just happened to run into some weird syntax highlighting issues today and was poking around in the issues here. Realized that, yeah, based entirely on regex... it's going to be impossible to get good highlighting so I didn't file a new issue.

tillig avatar Dec 10 '20 19:12 tillig