Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

No warning when debugging a file that has been modified after starting the debugging session #2559

Closed
aarzilli opened this issue Jun 4, 2019 · 5 comments

Comments

@aarzilli
Copy link

aarzilli commented Jun 4, 2019

  1. Debug any program
  2. Modify the source code without stopping the debugger
  3. Continue using the debugger

There is no warning that the executable being debugged is stale,m now the line numbers reported by the debugger will be nonsensical and behavior of the debugged program will diverge from what would be expected from the source code displayed on screen.

@ramya-rao-a
Copy link
Contributor

Fair point
We have listeners on each file save vscode.workspace.onDidSaveTextDocument
We have a way to figure out if there is an active debug session vscode.debug.activeDebugSession

Therefore, we can definitely use the two and show a warning that a file change has been saved while the debug session is in progress.

Thanks for reporting!

@ramya-rao-a
Copy link
Contributor

PRs are welcome to add this feature

Code Pointers:

  • Set up local dev environment for the Go extension
  • The activate() function in the goMain.ts is where all the listeners are added and so here is where the warning (vscode.window.showWarningMessage) should be added

@haryps
Copy link
Contributor

haryps commented Jul 15, 2019

Hi @ramya-rao-a,

I would like to fix this issue and i have made the PR as attached.

However, i wonder whether this must be fixed from each extension or visual studio code core code.

Second, should the warning message added when the file has been changed or only when the file has been changed then saved? Please advise.

In visual studio, there is condition where we are not allowed to edit code during debugging. Can we identify that condition in this extension?

@ramya-rao-a
Copy link
Contributor

However, i wonder whether this must be fixed from each extension or visual studio code core code.

VS Code will not be aware of which code files should be allowed to be edited and which shouldnt when a debug session is started. Therefore, it cannot make that decision and each language extension is in the best place to make this decision.

Second, should the warning message added when the file has been changed or only when the file has been changed then saved? Please advise.

On save should be enough.

In visual studio, there is condition where we are not allowed to edit code during debugging. Can we identify that condition in this extension?

Can you elaborate?

@ramya-rao-a
Copy link
Contributor

There is now a warning that shows up if you save changes to a Go file when there is an active debug session

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants