lf-lang / vscode-lingua-franca

Lingua Franca extension for Visual Studio Code
Other
5 stars 3 forks source link

VS code Plugin error report when there is a cyclic dependency. #33

Closed byeonggiljun closed 2 years ago

byeonggiljun commented 2 years ago

I'm Byeonggil Jun, an undergraduate student who is working on LF, especially the ts target advised by professor Hokeun Kim.

I'd like to report an error in VS Code plugin that I'm experiencing.

I'm currently using VS Code's LF plugin for development. When my code has a cyclic dependency error, half of the diagram is painted red in the VS Code plugin's diagram. On the other hand, in the epoch, the diagram is displayed perfectly. image

This is my code. The purpose of this code is to take a user input on one federate and print it on another federate, iteratively.

target TypeScript;
reactor Input_iterator {
    input imes:string;
    input init:string;
    output message:string;
    physical action b;

    preamble {=
        import * as readline from "readline";
    =}

    reaction(startup, init) -> b {=
        const rl = readline.createInterface({
         input: process.stdin,
         output: process.stdout
         });

        rl.question("type any words ", (answer) => {
        console.log(`Word: ${answer}`);
        actions.b.schedule(new TimeValue(t, TimeUnit.msec),answer as string);
        rl.close();
        });
    =}
    reaction(b) -> message {=
        message = b as string;
    =}
 }

 reactor printer {
    input imes:string;
    output done:string;
    physical action a;
    reaction(imes) -> a{=
        console.log(imes);
        actions.a.schedule(new TimeValue(5, TimeUnit.msec)), null)
    =}
    reaction(a) -> done {=
      done = "done";
=}
}
federated reactor mes_iterator {
    a = new Input_iterator();
    b = new printer();
    a.message -> b.imes;
    b.done -> a.init;
}

One possible reason is that VS Code plugin may be out of sync with the lingua-franca code base. My VS Code shows error messages below although the code is compiled successfully. image

I experienced that error message before when I ran ./gradlew runLfc on the command line with the lingua-franca code base that was out of sync.

My development environment is as follows: OS: Ubuntu 20.04

Please let me know if you need more information necessary for debugging.

Thanks, Byeonggil

lhstrh commented 2 years ago

Thanks for the bug report, @ByeongGil-Jun!

This is a known issue also reported in https://github.com/lf-lang/vscode-lingua-franca/issues/31 and @a-sr is working on a fix.

The synchronization between the VS Code extension and the Lingua Franca code base is version based, and we're rolling out automated release infrastructure to ensure that these stay in sync, starting with the upcoming v0.1.0 release of LF.

For the time being, you could do this:

git clone --recurse-submodules git@github.com:lf-lang/vscode-lingua-franca.git
cd lingua-franca
git pull origin master
cd ..
npm install

This will build and install a new vsix image with the latest Lingua Franca and install it in VS Code.

hokeun commented 2 years ago

Duplicate of https://github.com/lf-lang/vscode-lingua-franca/issues/31

lhstrh commented 2 years ago

I was just able to confirm that this issue has, in fact, not been fixed yet. We hope to release a patch for this soon.

lhstrh commented 2 years ago

Has been solved in v0.1.1 release.