Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

got plantuml erro when include C4 on vscode #190

Closed
elderbig opened this issue Oct 2, 2021 · 3 comments
Closed

got plantuml erro when include C4 on vscode #190

elderbig opened this issue Oct 2, 2021 · 3 comments

Comments

@elderbig
Copy link

elderbig commented Oct 2, 2021

@startuml
!RELATIVE_INCLUDE = ./
' uncomment the following line and comment the first to use locally
' !include C4.puml
a --> b

@enduml

I pulled C4 from
https://github.com/plantuml-stdlib/C4-PlantUML
and copy C4_*.puml into local folder, where is my vscode workspace,then I edit plantuml like up,so I got erro:

Exception in thread "main" java.util.NoSuchElementException
at java.util.ArrayDeque.removeFirst(ArrayDeque.java:285)
at net.sourceforge.plantuml.tim.expression.ReversePolishInterpretor.(ReversePolishInterpretor.java:84)
at net.sourceforge.plantuml.tim.expression.TokenStack.getResult(TokenStack.java:250)
at net.sourceforge.plantuml.tim.Eater.eatExpression(Eater.java:95)
at net.sourceforge.plantuml.tim.EaterAffectation.analyze(EaterAffectation.java:66)
at net.sourceforge.plantuml.tim.iterator.CodeIteratorAffectation.executeAffectation(CodeIteratorAffectation.java:100)
at net.sourceforge.plantuml.tim.iterator.CodeIteratorAffectation.doAffectation(CodeIteratorAffectation.java:86)
at net.sourceforge.plantuml.tim.iterator.CodeIteratorAffectation.peek(CodeIteratorAffectation.java:74)
at net.sourceforge.plantuml.tim.TContext.executeLines(TContext.java:240)
at net.sourceforge.plantuml.tim.TimLoader.load(TimLoader.java:71)
at net.sourceforge.plantuml.BlockUml.(BlockUml.java:128)
at net.sourceforge.plantuml.BlockUmlBuilder.init(BlockUmlBuilder.java:127)
at net.sourceforge.plantuml.BlockUmlBuilder.(BlockUmlBuilder.java:78)
at net.sourceforge.plantuml.SourceStringReader.(SourceStringReader.java:95)
at net.sourceforge.plantuml.SourceStringReader.(SourceStringReader.java:87)
at net.sourceforge.plantuml.SourceStringReader.(SourceStringReader.java:75)
at net.sourceforge.plantuml.Pipe.managePipe(Pipe.java:85)
at net.sourceforge.plantuml.Run.managePipe(Run.java:379)
at net.sourceforge.plantuml.Run.main(Run.java:180)

vscode version

version: 1.58.0
comiit: 2d23c42a936db1c7b3b06f918cde29561cc47cd6
date: 2021-07-12T23:51:36.303Z
Electron: 12.1.2
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Linux 

vscode plantuml plugin version = v2.14.0

@kirchsth
Copy link
Contributor

kirchsth commented Oct 3, 2021

Hi @elderbig,

C4.puml doesn't use 'RELATIVE_INCLUDE' at all (only the dependent C4_.....) therefore I think it should have no relevance and you can reproduce it with other (non C4_... related) *.puml files too.

You should set the variable in code via %set_variable_value() like below

%set_variable_value("RELATIVE_INCLUDE", ".")

I tried it locally on my machine with VS Code (v 1.60.1) and following code and this was working
(C4VersionDetails() is one of the last beta features which is not part of the already deployed 2.3.0 version)

@startuml
%set_variable_value("RELATIVE_INCLUDE", ".")
!include C4_Component.puml

C4VersionDetails()

@enduml

grafik

BR Helmut

@kirchsth
Copy link
Contributor

kirchsth commented Oct 3, 2021

Hi @elderbig

maybe I found a better solution:

  • you can set the PlantUML command line argumentes in VS Code via the settings
    grafik

settings.json

    "plantuml.commandArgs": [        
        "-DRELATIVE_INCLUDE=\".\""
    ]
  • then not set_variable_value() call is required anymore
@startuml
' -DRELATIVE_INCLUDE="." is defined via settings
'  %set_variable_value("RELATIVE_INCLUDE", ".")
!include C4_Component.puml
C4VersionDetails()
@enduml

BR Helmut

@elderbig
Copy link
Author

elderbig commented Oct 4, 2021

Thank U, I resolved this in another way,I download plantuml.jar ,and run plantuml.jar like this:

java -jar plantuml.jar -picoweb

then plantuml.jar listen port 8080 by default.then set plantuml-plugin in vscode, let plantuml-plugin request to local plantuml server(remote service https://plantuml.com/ can be use too) instead of plantuml-plugin its self,now C4 is a stdlib in plantuml and we can use it away.

@kirchsth kirchsth closed this as completed Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants