-
Notifications
You must be signed in to change notification settings - Fork 293
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
Run line by line in an untitled file prompts to save file #6898
Comments
@isidorn can we suppress the "save all" when a debug session starts? Maybe another startDebugging option? |
@roblourens you should do the same as powershell. More details and an example how to fix here PowerShell/vscode-powershell#3338 |
Hey @isidorn, that solution doesn't work because the language here is still Python, and we can't do it based on file extension. We don't want this for all Python debugging, just specifically in a notebook, so I think we need a flag on the launch config to set this dynamically. Does that make sense? It would be similar to the "simple UI" flag |
cc @weinand |
@roblourens a flag in the |
I don't like piggybacking on the I would rather introduce a new mechanism for this. A new flag in the What I don't like about this approach is that the caller of the It would be helpful if we could tie the "debug.saveBeforeStart" setting to "more than a language", basically a "when" context condition. Similar for what is done for PowerShell:
we could do something like this for Python in notebooks:
But this is just dreaming... |
fyi @sandy081 for a more powerful settings scoping mechanism. Also in case there might be some other mechanism to use here. |
Yeah, we previously had a conversation about making the setting scopes more powerful so we can set settings based on notebook kind. I was thinking, is it ever useful to save an untitled file when I start debugging? Even if it's a .py file, it's not going to be imported by other files or in a launch.json if it is an untitled file that I just created. Can we save editors for files with unsaved changes but not save untitled files? Alternatively, I'm not sure how to express what I want as a more complex option for |
@roblourens yeah we explicitly added saving untitled files for beginners. Here's the scenario: a new user open a new untitled file, types some script and presses F5 to debug it The untitled file is not saved, and a lot of participants did not know that they have to save a file in order to debug it. So with the current approach we nicely prompt the user to save and then we start debugging. I would not change this flow. Making |
I guess a problem is that in a language scope we would be setting this for all python files, and if the user configured this as something else that would override our setting. Given that, if we don't have a config scope for notebooks then it seems impossible to get it right with a setting. |
@roblourens you are correct, however that is a corner case. We can check numbers, but I think that a very low number of users actually touch this setting. |
Yes, a setting tries to solve the problem on the wrong end: the user doesn't know the notebook cell debugger's requirements. Only the notebook cell debugger knows (this is already a problem for the PowerShell solution which ties the save requirement to the language instead of the debugger). Since we don't have a contribution mechanism to communicate that information to the "save" code, using a |
Well said, I agree that it should go in |
The only remaining question is how the debugSession option and the setting interact. |
I think the |
@isidorn yeah, that makes sense |
Jumping in here (not having previous context)
You can use |
So we can debug untitled notebooks cleanly, and it's not needed for other unsaved notebooks anyway. Fix #6898
So we can debug untitled notebooks cleanly, and it's not needed for other unsaved notebooks anyway. Fix #6898
Added a flag called |
Sounds good to me. |
I see this context key: |
Testing microsoft/vscode#129467
CleanShot.2021-07-27.at.14.41.02.mp4
I'm not sure what is expected here, but I got prompted to save an untitled notebook (with no workspace) but also clicked "cancel" and then it kept debugging? Either it should only work if you save it or allow to debug (I vote for the latter).
The text was updated successfully, but these errors were encountered: