Fruchtzwerg94 / PlantUmlViewer

A Notepad++ plugin to generate, view and export PlantUML diagrams
MIT License
83 stars 9 forks source link

Rendering not working (Failed to Render: ERROR 1 Syntax Error? "Some diagram description contains errors") #4

Closed RobiIhs closed 2 years ago

RobiIhs commented 2 years ago

Hello, first of all, thank you for your effort. I tried the plugin, downloading PlantUmlViewer_v1.1.1.5_x64.zip and placing it in the plugin folder (the plugin manager doesn't show the plugin in the list).

Whatever the code may be I always receive the same error:

Failed to Render ERROR 1 Syntax Error? Some diagram description contains errors"

Only once it succeeded and I saw the image in the Plant UML panel.

Using the .jar from cmd the .png is produced correctly:

C:\Program Files\Notepad++\plugins\PlantUMLViewer>java -jar plantuml-1.2022.5.jar "C:\Users..\Documents\UML\npp_plantum_example.pu"

This is the code I used to produce the .png with previous command:

@startuml

title Relationships - Class Diagram

class Dwelling {
  +Int Windows
  +void LockTheDoor()
}

class Apartment
class House
class Commune
class Window
class Door

Dwelling <|-down- Apartment: Inheritance
Dwelling <|-down- Commune: Inheritance
Dwelling <|-down- House: Inheritance
Dwelling "1" *-up- "many" Window: Composition
Dwelling "1" *-up- "many" Door: Composition

@enduml

I updated Notepad++, tried previous version of the plugin, ...

Thanks, Roberto

Fruchtzwerg94 commented 2 years ago

Hi @RobiIhs,

thanks for your report. First of all, the plugin appears only for the latest (8.4.2) and future versions of Notepad++ in the plugin manager. For older versions, you need to install the plugin manually like you did already.

Unfortunately, I am not able to reproduce the issue with the diagram you've posted here. The error

Failed to Render
ERROR
1
Syntax Error?

typically occurs if the document contains invalid syntax, here already in line 1. How are you using the plugin?

Could you also please try to use a plain Notepad++ version to reproduce the issue? You can do this by downloading the portable version from the [https://notepad-plus-plus.org/downloads/](officitla Notepad++ site).

Looking forward to get your update.

RobiIhs commented 2 years ago

Ok, thanks for your quick answer. I thought I had the last version of NPP but the updater stopped to 8.3.3. However also 8.4.2, with other two plugins was raising the same error.

So ...

I started with a plain fresh npp.8.4.2.portable.x64.zip. I installed "PlantUML Viewer" plugin with plugin manager: the rendering worked. I added "ComparePlugin" plugin with plugin manager: the rendering worked. I added "HexEditor" plugin with plugin manager: the rendering raised the error.

Failed to Render
ERROR
1
Syntax Error?

Let me tell you that this is not the 1st time that "HexEditor" causes me pains. It already happened in the past but that plugin is really helpful and from time to time I need it. For the moment, I'm going to remove it in order to go on playing with "PlantUML Viewer".

To make "PlantUML Viewer" work again I tried to remove "HexEditor"

Finally, in a new installation, I selected all 3 plugins together in the plugin manager, installing them together: all of them are working properly. I don't know if it's luck.

Thanks, Roberto

RobiIhs commented 2 years ago

I also tried this:

The error appears. It might depend on the loading order of the plugins?

I repeated the install with the portable .zip, installing simultaneously the plugins and it's working properly. Well, I can remain with the portable version.

Thank you. Roberto

Fruchtzwerg94 commented 2 years ago

Hi @RobiIhs ,

thanks for your great investigation here. I've also tried to reproduce the issue doing the steps described by you - without succcess. My current assumption is, that any of the other plugins affecting the text I am getting from the current document of Notepad++. And yes ... HEX editor is great ... but unfortunately sometimes really unstable. To get some more information about the issue, I've implemented showing the complete line of the error. Could you try to use the not yet released latest build for reproduction of the issue? Just replace the *.dll with the new one there. If the parsing then fails again, you should be able to see an extended error dialog which shows the content of the line which was not parsable. This may helps to understand whats happening.

Cheers, Philipp

RobiIhs commented 2 years ago

Hi Philipp, I'm sorry, I disappeared for a while. I think today I discovered the problem. I had the same error on a portable installation I already tested before. I was wondering why it wasn't working anymore, of course.

The fact is that I use very frequently the double "View" (left-right). Normally I keep the "secondary" on the right. Well I go to the point: even if the cursor is always in the plant-uml source tab, the rendering works only when it's in the left-main "View". So, I suspected that when the plant-uml source tab is on the "other" right View, the plugin is reading from the last current file of the main left View and since that file is general NOT plant-uml file the syntax wasn't respected, obviously. I confirmed this using two plant-uml files, one on the left and one on the right. The rendering always uses the one on the left, ignoring the position of the cursor.

I think that, in previous tests, whenever I was testing the "system-wide" (win-installer) NPP I was always using a saved session with both Views. While when I was using the "portable" NPP I was using a fresh session with only one View. In other words all previous tests are valuable like rubbish. The presence or not of the two Views and whether or not the schema was on the left side affected the behaviour.

I'm sorry for your wasted time. Cheers, Roberto

Fruchtzwerg94 commented 2 years ago

Hi Roberto,

thanks for your update. That was indeed the hint to the right direction and absolutely no waste of time. Since I was not aware of the dual mode it always took the text of the first document. I've created a fix for it. You may want to have have a look at the latest build to test it? Just let me know if it works for you.

Thanks for your investigation and report!

Cheers, Philipp