vscode: Always open editor even in error cases
- open a not empty repo folder
- open a file in an editor (not preview mode)
- create a new untitled file
- add a couple of new lines
- save it as an
ipynb
file - close the saved file
- right click the ipynb file in the explorer and select “Open with…” > Jupyter
-> error notification
-> the explorer immediately selects the file from step 2. In a small workspace this is not an issue but in a larger on it is. The
ipynb
file might scroll out of the view port.
For me, the error notification here is the wrong tool. This should be a modal dialog.
Recording of step 7 and the consequences:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 30 (30 by maintainers)
Commits related to this issue
- Add modal error as part of #142875 — committed to microsoft/vscode by lramos15 2 years ago
- Modal alert on file open error ref #142875 — committed to microsoft/vscode by deleted user 2 years ago
- re #142875. Add error actions for notebook. — committed to microsoft/vscode by rebornix 2 years ago
- editors - always open an editor placeholder in case of an error (#142875) — committed to microsoft/vscode by bpasero 2 years ago
@bpasero thanks Ben, it’s exactly what I was looking for. I adopted the
IErrorWithActions
in notebook and then it’s up to the editor service to decide how it handles the error and actions (either in modal or error editor).@bpasero in the demo case that you show (creating a file from a link to a non-existent file), why do we show the editor area error message if they cancel? We are now showing a modal dialog and they have been told the error and opted to cancel.
You can actually control the buttons shown in the error dialog when opening, we do that to offer a “Create File” action in case you open a missing file and text editor does this by creating a
IErrorWithActions
:https://github.com/microsoft/vscode/blob/ddf1226995307c1d8db3cfafa7f96173c8b023de/src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts#L193-L209
Maybe worth exploring this for notebooks?