VSCode API: How to catch source file not found when starting/changing/stopping debugger session?

31 Views Asked by At

Problem: File cannot be found (image)

When I start debugger, in case I move source file out of the source directory, this panel pops up. What I want to do - is to catch this and reprogram it so I can show a message that "source file can't be found". Currently, I'm nowhere to access this, because it's a part of the IDE and debugger extension.

What I've tried so far is (using VSCode API):

  • using vscode.workspace.onDidOpenTextDocument event
  • using vscode.window.onDidChangeActiveTextEditor event (this one was closest to solution except it only works when I'm changing sessions, if I have more than one session. Also it works when only one session is started, although I want it to work when I have more sessions also, if I stop one, it should automatically try "figuring" where the source file of the currently active session is.)
  • using vscode.debug.onDidChangeActiveSession event
  • using vscode.debug.onDidStopDebugSession event
  • using vscode.debug.onDidStartDebugSession event

I also tried combinations with all of the events mentioned above.

I figured, maybe, it would be okay to try using file system module, but I really don't want to call for file system on every debugger event.

0

There are 0 best solutions below