tlaplus / vscode-tlaplus

TLA+ language support for Visual Studio Code
MIT License
357 stars 33 forks source link

"Check and debug model with TLC" not enabled for MC.cfg #221

Open lemmy opened 3 years ago

lemmy commented 3 years ago

The "Check and debug model with TLC" command is not available when the current editor shows a TLC config file.

klinvill commented 3 years ago

Should the "Debug a running model" command also be available then?

This should be a quick change, we only need to add || editorLangId == tlaplus_cfg to the appropriate when conditions in package.json

alygin commented 3 years ago

@klinvill, I think the "Debug a running model" command should not depend on the active file at all. But it should be disabled when there's already a TLC process runing. I mean, its when must be !tlaplus.tlc.isRunning.

But I don't know why this command provides the program parameter, which depends on the active file:

https://github.com/alygin/vscode-tlaplus/blob/3e268b53873a80db550d89f5a6b2b5cd1b812586/src/debugger/debugging.ts#L41-L47

@lemmy, could you, please, comment on that? Is it really required to provide the file path here?

lemmy commented 3 years ago

1) I can't think of a reason why I would need the file. On the contrary, the back-end sends the absolute path of the file to the front-end. 2) If the VSCode debug adapter supports concurrent debugger sessions, we don't have to disable "Debug a running model" if another TLC is already running.

alygin commented 3 years ago
  1. I can't think of a reason why I would need the file. On the contrary, the back-end sends the absolute path of the file to the front-end.

I see that DebugConfiguration doesn't have the program parameter, yet you added it in the mentioned snippet. If it's not requred, we can remove it and allow the user to attach to a running TLC process from anywhere.

  1. If the VSCode debug adapter supports concurrent debugger sessions, we don't have to disable "Debug a running model" if another TLC is already running.

In this case, the restriction is not on the VSCode debuging infrastructure side. VSCode doesn't allow opening two web view panels at once, that's why we should either disable the command, or support switching panels from one process to another.

lemmy commented 3 years ago

+1 for "attach to a running TLC process from anywhere".

When debugging, the web view panel doesn't provide much value. Thus, iff allowing concurrent debugger sessions is desirable functionality, it could probably do without the web view. On the other hand, a user can also start multiple VSCode instances.

alygin commented 3 years ago

Ah, sure, we don't display the result view while debugging, so it shouldn't be an obstacle.

alygin commented 3 years ago

It looks like the file path is not necessary when launching a debugger, so it can be used in more contexts.

alygin commented 3 years ago

The fix is available in the v1.6.0-alpha.2 pre-release.