qjebbs / vscode-plantuml

Rich PlantUML support for Visual Studio Code.
MIT License
1.09k stars 155 forks source link

Method arguments cause incorrect syntax highlighting #327

Open dstodev opened 4 years ago

dstodev commented 4 years ago

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.

qjebbs commented 4 years ago

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.

fuhrmanator commented 4 years ago

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

qjebbs commented 4 years ago

@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.

tillig commented 3 years ago

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.