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

Running JavaScript does not output anything #131

Closed
MikaelMayer opened this issue Feb 14, 2022 · 4 comments · Fixed by dafny-lang/dafny#1824
Closed

Running JavaScript does not output anything #131

MikaelMayer opened this issue Feb 14, 2022 · 4 comments · Fixed by dafny-lang/dafny#1824
Assignees
Labels
bug Something isn't working language server Relates to the Dafny LSP server

Comments

@MikaelMayer
Copy link
Member

Here is the setting
image

It puts the following command on my command line:

> & "C:\Program Files\dotnet\dotnet.EXE" "...\Dafny.dll" "...\issue-vscode.dfy" /verifyAllModules /compile:3 /compileTarget:js
Dafny program verifier finished with 0 verified, 0 errors
Wrote textual form of target program to issue-vscode.js
Running...

>

So nothing is output. However, when I add /spillTargetCode:1 it display a javascript file that, when I execute it using node, correctly outputs:
image
and that works also on PowerShell.
I'm not sure what's going on here.

@MikaelMayer MikaelMayer added the bug Something isn't working label Feb 14, 2022
@camrein
Copy link
Member

camrein commented Feb 14, 2022

The run feature is currently provided by the Dafny compiler itself. Therefore, if the compiler doesn't implement run for a specific target, so doesn't the IDE.
We could think about implementing the compile & run feature independently from the compiler. I think this change would make sense anyways because the C# implementation loads the generated assembly. That's ok from compiler perspective as the process stops right after. However, the language server stays alive and keeps loading more and more code. At this time, there's no possibility to unload code from C#; thus, we have in fact a memory leak there.

@camrein camrein added the language server Relates to the Dafny LSP server label Feb 14, 2022
@keyboardDrummer
Copy link
Member

The run feature is currently provided by the Dafny compiler itself. Therefore, if the compiler doesn't implement run for a specific target, so doesn't the IDE. We could think about implementing the compile & run feature independently from the compiler. I think this change would make sense anyways because the C# implementation loads the generated assembly. That's ok from compiler perspective as the process stops right after. However, the language server stays alive and keeps loading more and more code. At this time, there's no possibility to unload code from C#; thus, we have in fact a memory leak there.

We could think about implementing the compile & run feature independently from the compiler.

What do you mean by that? It seems good to me to run the user C# program in a different process than the compiler, but the code organisation doesn't have to change for that.

@MikaelMayer
Copy link
Member Author

I fixed it here: dafny-lang/dafny#1824
Indeed, it was a problem on the Dafny side, not the IDE-VSCode

@camrein
Copy link
Member

camrein commented Feb 15, 2022

What do you mean by that? It seems good to me to run the user C# program in a different process than the compiler, but the code organisation doesn't have to change for that.

Sorry, I forgot that I changed this behavior long ago. If I remember correctly, the original VSCode extension that used DafnyServer used a custom LSP API to implement compile & run. Due to the problematic with unfreed code I changed that to the way we have now: Run a command in the terminal that invokes the Dafny compiler. This both solved the issue with the unfreed code as well as allowed Dafny users use two distinct compilations for the language server and compiler.

However, what I meant with compile & run indepedently from the compiler: Fire one command to compile the program, another command to execute it. However, if Dafny's /compile:3 switch is meant to work for any compilation target, we should stick to this implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working language server Relates to the Dafny LSP server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants