martin-pabst / Online-IDE-new-compiler

Online-IDE with new compiler
GNU General Public License v3.0
0 stars 0 forks source link

Pressing cmd ends debugging #17

Closed fjf2002 closed 1 week ago

fjf2002 commented 1 week ago

On my macOS, pressing the cmd button (as I do for cmd-Tab to switch windows) (and perhaps other keys) halt the interpreter. The problem seems to be this bit of code:

https://github.com/martin-pabst/Online-IDE-new-compiler/blob/72537b027876f12b86034a2878653e556cb5bdcf/src/client/main/gui/Editor.ts#L105-L118

The purpose seems to be halting the interpreter when the editor content gets modified?

  1. I am not sure if the keyDown event is suitable for this.
  2. Aren't there any other means to archieve this? For example, I suppose you have another detection when the editor content shall be re-compiled. This could stop the interpreter, too.
  3. Concerning #15, it would be interesting to be able to edit and compile the program WHILE debugging.
martin-pabst commented 1 week ago
  1. You're right: editor.onDidChangeModelContent is better suitable than editor.onKeyDown -> fixed.
  2. The Compiler is separated as much as possible from other components (editor, gui, ...) in order to make it usable separately (e.g. for unit-testing).
  3. This goal is very difficult to achieve because the compiler currently always builds entire executables and is not able to identify individual program changes and incorporate them into an existing executable. For me it's a miracle that other systems (e.g. Java hot swap) can do this at runtime.