lf-lang / lingua-franca

Intuitive concurrent programming in any language
https://www.lf-lang.org
Other
224 stars 60 forks source link

Error in Diagram Synthesis #2166

Closed jjrev closed 6 months ago

jjrev commented 7 months ago

Using VSCode on Windows 11 with JDK 17 installed, I see the following error message when I try to display the diagram for a given *.lf file (doesn't matter which):

An exception occurred during diagram synthesis\
java.nio.file.InvalidPathException: Illegal character [:] in path at index 4: \\\c:\Users\xxxxxxxx\Development\lingua-franca\test\C\src\Deadline.lf
\
    at java.base/sun.nio.fs.WindowsPathParser.nextSlash(WindowsPathParser.java:212)
\
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:111)
\
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
\
    at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
\
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
\
    at java.base/java.nio.file.Path.of(Path.java:147)
\
    at org.lflang.generator.CodeMap$Correspondence.tag(CodeMap.java:144)
\
    at org.lflang.ast.ASTUtils.toText(ASTUtils.java:693)
\
    at org.lflang.generator.ReactionInstance.<init>(ReactionInstance.java:70)
\
    at org.lflang.generator.ReactorInstance.createReactionInstances(ReactorInstance.java:758)
\
    at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:902)
\
    at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:882)
\
    at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:105)
\
    at org.lflang.diagram.synthesis.LinguaFrancaSynthesis.transform(LinguaFrancaSynthesis.java:322)
\
    at org.lflang.diagram.synthesis.LinguaFrancaSynthesis.transform(LinguaFrancaSynthesis.java:144)
\
    at de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis.transform(AbstractDiagramSynthesis.java:220)
\
    at de.cau.cs.kieler.klighd.syntheses.ReinitializingDiagramSynthesisProxy.transform(ReinitializingDiagramSynthesisProxy.java:289)
\
    at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:454)
\
    at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:389)
\
    at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:346)
\
    at de.cau.cs.kieler.klighd.lsp.KGraphDiagramUpdater.lambda$6(KGraphDiagramUpdater.java:267)
\
    at de.cau.cs.kieler.klighd.lsp.launch.AbstractLanguageServer.lambda$1(AbstractLanguageServer.java:117)
\
    at de.cau.cs.kieler.klighd.lsp.launch.AbstractLanguageServer.configureAndRun(AbstractLanguageServer.java:96)
\
    at org.lflang.diagram.lsp.LanguageDiagramServer.start(LanguageDiagramServer.java:111)
\
    at org.lflang.diagram.lsp.LanguageDiagramServer.main(LanguageDiagramServer.java:107)

Per a request from @a-sr, copying this issue here from original issue: https://github.com/kieler/klighd-vscode/issues/166#issue-2098586755

lhstrh commented 7 months ago

I suppose \\\c:\Users\xxxxxxxx\Development\lingua-franca\test\C\src\Deadline.lf isn't a valid path on Windows. What is the correct path?

jjrev commented 7 months ago

Correct. Just pasting that path into Explorer doesn't work. You have to drop the first three backslashes.

Side note, I downloaded the Epoch IDE (on the same machine) and diagrams render correctly.

jjrev commented 7 months ago

Unsure if this is related but I'm also seeing the following error on any *.lf file at the first line (regardless of what that line is):

Error executing EValidator(org.eclipse.emf.ecore.impl.EClassImpl@238915d2 (name: Model) (instanceClassName: null) (abstract: false, interface: false).0)
lhstrh commented 6 months ago

Seems like a trivial bug, but this would require help from a developer who runs on Windows. I flagged it as such.

jjrev commented 6 months ago

Another interesting detail is that this issue does not manifest if I use WSL to launch VSCode.

lhstrh commented 6 months ago

Another interesting detail is that this issue does not manifest if I use WSL to launch VSCode.

That makes sense though, because in a WSL environment straightforward Linux paths are used. What is the correct version of \\\c:\Users\xxxxxxxx\Development\lingua-franca\test\C\src\Deadline.lf?

jjrev commented 6 months ago

I gave up trying to get the /mnt/c/Users/... path to load in VSCode launched from WSL (due to permission issues) and just cloned the repo to my WSL home directory.