0
  1. I set a breakpoint because I want to investigate what's going on.
  2. I step over/into
  3. Suddenly it goes off to a different (external) file. It's a swirl of going back and forth to different files forever and after 15 minutes I'm still not in my file and don't know what bug I have.

How can I force the debugger to stay only in my file/or potentially only in my folder?

Question no.2. What's the diff btw step over and step into? enter image description here

Tomas Baran
  • 1,570
  • 2
  • 20
  • 37
  • if you've gone too deep try `Step Out (Shift F11)` Regarding your question about step over and into etc, read : https://stackoverflow.com/questions/3580715/what-is-the-difference-between-step-into-and-step-over-in-the-eclipse-debugger – tHeSiD Jun 20 '20 at 18:01
  • Here is the answer: https://stackoverflow.com/questions/47556495/how-do-i-skip-external-code-when-debugging-in-vs-code/69144128#69144128 – Tomas Baran Feb 21 '22 at 20:03

1 Answers1

0

In VSCode, if you want to skip over files that you don't want to debug, usually files in your node_modules etc you can add a setting to tell VSCode to skip the files when debugging, so you can make the configuration only debug your code.

You have to add a setting skipFiles to you launch configuration, i.e. launch.json

Example:

            "skipFiles": [
                "<node_internals>/**",
                "**/app/out/vs/**"
            ]

You can read more about excluding the files you don't want to debug here - Skipping uninteresting code (node, chrome)

tHeSiD
  • 4,587
  • 4
  • 29
  • 49
  • Thanks! I'd seen your answer in another post before posting my question but it was not helpful. Can you please show us the full example of launch.json for flutter? I couldn't make your example to work. It looks like your example may be for javascript... – Tomas Baran Jun 20 '20 at 19:37
  • You should have posted your whole launch.json then, the question was generic. anyway you can take a look at this file and see how the `skipFiles` object is set for dart projects. I will add the specific lines you might need for your dart project to the answer https://github.com/Dart-Code/Dart-Code/blob/master/.vscode/launch.json – tHeSiD Jun 20 '20 at 19:43
  • My bad, I thought it was working but it was NOT. Adding your code "skipFiles" is NOT permitted and copying all launch.json from your link doesn't work either. – Tomas Baran Jun 20 '20 at 20:30
  • The only thing helpful here would be to see all the launch.json file – Tomas Baran Jun 20 '20 at 20:37
  • Then add it to your question :D. Anyway I don't have any dart project setup with me to check but, one way is to use VSCode's intellisense `CTRL+SPACE` and find all the options you debugger supports, maybe its named differently and you can find one which can skip files . – tHeSiD Jun 20 '20 at 20:44
  • Are you saying that "skipFiles" is not an option in your launch configuration? Intellisense doesn't show it as an option? – Mark Jun 20 '20 at 20:45
  • For VSCode, each debugger can have its own configuration setting, it is determined by this setting `"type": "node",` if you install the chrome debugger extension, the type for it will be `"type": "chrome",` node and chrome debuggers have different settings you can add in your launch.json if you are using some sort of dart debugger lets say `"type": "dart",` it will have its own settings. You can check the extension documentation for all the settings, some maybe common some might be different. for example in node you can have the `program` setting but not chrome https://i.imgur.com/zfEzLOu.png – tHeSiD Jun 20 '20 at 20:56
  • `skipFiles` is specific to Node. Dart has settings to control this - see my answer at https://stackoverflow.com/a/76682276/25124 – Danny Tuppeny Jul 13 '23 at 18:28