Do not show debug suggestion when a project can't compile #10721
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes microsoft/pxt-microbit#6372
For text errors, we were able to determine if an error was a compile or runtime error using the presence of a stack trace, but for block errors, there are some that do not prevent running the program but also do not have a stack, so the same method was not as reliable (hence, we just always showed the button).
However, looking more closely, I believe we can determine if it's a run-blocking error based on whether we detect the error in the typescript compile diagnostics or not. With that in mind, I've added a specific
preventsRunning
flag to errors, which we can now set and use for determining if we should show the debugger suggestion. When we detect a typescript compile error in blocks, we set this to true. If it's a runtime or blocks compilation error, we set it to false. I've switched the monaco errors to use this as well, though the actual behavior is unchanged.Upload target: https://makecode.microbit.org/app/3b1b8b4f477f1fa3d985f34d8d1728b0a2e88ef2-82f12bc8d0