Closed thom-sch closed 2 years ago
What do you see in the PlantUML source view? In the dev. versjon I see
@startuml test
component test1
//
@enduml
This is due to the "empty" line doesn't start with the common line prefix, since it lacks the final space, and is removed in the output. Instead the whole line is included, which results in a line that isn't syntactically correct.
This also means I don't see any exception, did you actually see it in the Error log or was it your "guess" (don't mean to be rude).
I can imagine this can be a problem for others, so I can test specially for the case where a line the linePrefix sans trailing blanks. and can be totally removed. What do you think?
Indeed I also see this syntactically wrong PlantUML-code in the source window.
As mentioned in my first post, it seems that the error was thrown by module
TextDiagramIntentHelper.java in line 99:
which is
result.append(line, pos1, pos2);
In case of a line consisting only of line-comment chars, calulating pos2 in line 98 results in pos1 == pos2; I'm not very familar with Java and so I havn't tested tis code snippet but only analysed it (can I found the errorlog somewhre to verify my guess?).
As mentioned in my post, too, I've changed line 99 to
if ( pos1 < pos2 ) result.append(line, pos1, pos2);
and the error disappears.
Since I'm not able to build the whole plugin, I've simply replaced TextDiagramIntentHelper.class with TextDiagramIntentHelper.java; this naiv work-around does the job.
(Though Eclipse itself reports some errors on loading, but seems to have no effect for the plugin itself.)
Regards from Meerbusch Thomas
Hello hallvard,
beg your pardon - my naiv solution is completly wrong! On testing it indeed I saw the correct image - but obviously it was the (correct) version from a previous attempt. Since my solution hasn't worked, the previous (correct) image was taken from the cache - and erroneously I assumed that all is fine... :(
So I agree with your solution to check for the line prefix without trailing space; however I'd prefer not to delete the line completly but replace it with an empty line to preserve the programmers's intended code structure.
Little contrite about my error... best regards from Meerbusch Thomas
With the solution I have now, there will be an empty line.
A syntax error occurs on creating diagrams using line comments:
// @startuml test
// component test1
//
// @enduml
Screenshot![grafik](https://user-images.githubusercontent.com/44623251/150119044-58063d11-aef8-448f-b517-4a5d438308f2.png)
Note that there is no additional space character behind the line comment '//' : adding a space char the error disappears!
Playing around with the plantuml plugin I've found the reason in class
TextDiagramIntentHelper.java / line 99
After removing prefix and line ending in this case pos1 == pos2 and in line 99
causes an error thrown by
line.append()
Checking this situation
the exception is not thrown and al is fine. As a workaround I've replaced TextDiagramIntentHelper.class by the (corrected) TextDiagramIntentHelper.java; this will resolve this issue - but now Eclipse reports some errors...
I'm not very familar with JAVA and especially don't know how to compile java files into class files; so it would be nice if this issue would be solved by someone else.. :)
Regards from Meerbusch Thomas