Open dstodev opened 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.
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 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.
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.
When writing a class:
Adding parameters to the method seems to break syntax highlighting:
Am I using the incorrect syntax for this? The issue persists with all color themes I have installed, including defaults.