-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explore improving the single file debug experience #92269
Comments
How "single-file debugging" works today:
@isidorn is that a faithful description of the current behavior? |
@weinand yes this is faithful description of the current flow. |
What are the problems/paint points that we try to address? A first pair of problems is related to the fact that VS Code behaves differently if the workspace has a "launch.json" or not:
Another problem comes from the fact that VS Code does not want to activate debug extensions eagerly. As a consequence VS Code can only rely on the declarative information available in the package.json but not on running extension code. Today VS Code only knows the supported languages of a debugger. This information is used in the "single-file debugging without launch.json" scenario for activating a debug extension based on the language open in the current editor. But this mechanism does not work if a file with an unsupported language is open in the editor or if there is no file open at all. Running extension code could easily figure out that the project (workspace) is runnable/debuggable. E.g. it could determine the entry-point of the project by analysing the package.json. (Actually this code exists already in many debug extensions but it cannot be used without activating the debug extension). "Run without debugging": Some proposals (in no specific order):
How to design the APIs? |
Good analysis of our current limitations. I can brainstorm on potential ideas on how to solve some of these, but you might be already writing this, so let me know once you are looking for feedback. Thanks! |
@isidorn I'm done with my proposals. Please review and provide feedback. Thanks. |
Discussion will be continued in April. |
Good writeup. Some feedback: Play buttonIn order to know if VS Code should put a Play button in the editor title VS Code should ask all activated debug extensions if they support a Play button for that file. If any of them do, the Play action should be there. The extensino can not decide this based on VS Code api, but VS Code debug UX would have to pass the file / uri for who it is asking. Because there can be inactive editors opened side by side. Extension activationI do not see the issues of extensions not being activated. If the extension is not activated then 99% it can not handle the open file, since it would already activated on that file type. Run without debuggingThis sounds best fitted for a static contribution point via |
@isidorn thanks for the feedback. Play Button: Extension Activation: Run without Debugging: |
I was thinking that most extensions are actually a debugger and a language service in one (but that does not have to hold). In order to better decide on the activation strategy and if it needs a solution I would be interested in how many debuggers are out there that do not activate on opening of a file type they are interested in. Run without debugging: makes sense. |
Most prominently none of the node.js/JS debuggers are tied to the Typescript and Javascript language extensions... |
Apologize if this does not belong here, if so you can mark it as off-topic and I could potentially create a new issue. It sounds as if this issue partially implements functionality of https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner. If this is true and that this issue implements run one file, then it would be cool to extend it to be able to run with the selected text i.e.
|
@testforstephen this is very interesting. I think Java debugger already supports debugging single files. Could you join the discussion here? |
@thernstig this issue is more focused on debugging a single file than just running. So we want to provide another universal entry point into debug extensions. Any debug extension that is interested in improving its single file debug experience would be able to participate. The extension you are mentioning above doesn't deal with debugging at all and it is not open for new languages. |
Play Button: If you judge whether or not to enable play button by calling the proposed Keep single file config in memory or persist? Run without Debugging: |
@testforstephen great feedback, thanks a lot. |
The toolbar is useful for long-running code even without breakpoints in the picture, since it provides the means to pause or stop the process. And a real adapter wouldn't know in advance if the code is long-running or not. |
@weinand yes I can introdcue the As for the @luabud @int19h thanks a lot for great feedback! After compiling all the feedback and great ideas I suggest we start with @weinand initial proposal. Action items:
Let me know if this makes sense. |
@int19h wrote:
but previously wrote:
When in long-running Python code launched this way, what does the debug toolbar's 'pause' button do? Suspend execution, show the current line, and allow setting of breakpoints? Or merely pause the process until I press either 'play', 'stop', or 'restart'? Or something different? |
@isidorn I will communicate the guidelines in the release notes. |
@gjsjohnmurray the debug toolbar's behavior is controlled by the debug extension/debug adapter. Possible strategies:
|
@weinand thanks for your input. It looks like Mock implements the second strategy. Perhaps add a compile time flag (cf its existing 'runMode' flag) to give us an example of a DA that implements the first. And to help with understanding/testing of the differences, how about making its |
@gjsjohnmurray For Python, it would do nothing - in fact, I believe we respond to that message with an error response. But there are many other debug adapters :) Besides, there's still Stop, which is always applicable. @weinand Speaking of which - perhaps Pause should be surfaced as a capability, so that it can be disabled/hidden entirely, rather than relying on error responses for this? I suspect that most debug adapters wouldn't be able provide it in "noDebug" mode, so it should be a fairly common case. +1 on only showing the toolbar after a short delay. This would cover the common case of a simple script nicely without regressing UX elsewhere; our users should like that. |
@weinand makes sense for the verifcation needed and release notes @gjsjohnmurray @int19h can you please create a new issue to show the toolbar after a short delay, since this is not directly related to the single file debug discussion. Thanks! |
|
I have introduced the I will update the docs here https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups I have created this follow up item for @misolori #101026 @weinand and me can work on finalising on what is the exact recommnedation for extensions and post it here and in the release notes. |
After discussion we decided to go with the group name To recap @weinand and me came up with the following recommendations for debug extensions (we will also cover this in our release notes):
Mock debug example can be found here fyi @connor4312 since we could also do this in js-debug To verify: clone the mock debug repo from here, run the extension and make sure the commands are properly contributed for every markdown file in the editor title area. |
Verified that the proposal works and looks fine. |
@testforstephen please take a look at the recommendations and see how Java debugger can benefit. |
@akaroml sure, tracked with issue microsoft/vscode-java-debug#834 |
Is this being tracked anywhere? It definitely looks a bit weird right now with different sizes. |
@isidorn aha, perfect - already shipped! :) I copied the original name (from #92269 (comment)) so if that's the main source for this info, might be worth editing in there (I did check the release notes, but it didn't seem to include the specifics). Thanks! |
Makes sense, I have updated my comments from above. Thanks for pointing this out. |
Today VS Code debugging has no generic way to know whether a debug extension implements "single file debugging". Without this knowledge it is not possible to provide a standardised UX experience for this case.
Because of this some debug extension have started to create their own UI. A good example is the Python extension which shows a play button in the editor:
The text was updated successfully, but these errors were encountered: