Change:
Testing Scenario: Have a webview editor extension installed that contributes for .txt. Create a new file. Enter something in it so it isn't empty. Save it as What should happen next? Currently, nothing happens. It stays in the default VS Code editor. It might make sense to have the choose editor quick pick open.
Fixing this was more challenging than expected, pushing to November
It looks like renaming works and opens in the custom editor per my preferences, but if I save an untitled file as in the issue, nothing happens.
Marking for April Custom editors use to open a custom editor in place of the default editor. When a untitled editor is saved, is called but this goes directly to which bypasses the . Let me know if there's some other event we can listen to to detect when an untitled editor is saved. I couldn't find anything while debugging through the code
I guess this needs to be wired in, PR welcome.
I believe this will also apply to notebooks. I'll let you know what I come up with
Assigning you since this seems like something we should think about for all editor types, including notebooks
I discussed this issue a bit with Kai and it doesn't sound like we will be fixing this any time soon. The main drive is for notebooks where you see "Hey this is a .ipnyb file, install the jupyter extension" and then the user clicks install but there ipnyb is still plain JSON. The goal for that is to allow rendering of those files without execution if no extension is installed. For the other cases it's not nearly as important as most files have a usable text editor type. We want to reduce the number of notifications as much as possible and switching the file for the user could be extremely jarring.
Since I just came across the relevant code, we have a way to replace an editor when it is saved (to a different path or when saving untitled): This code does not go through any override but rather takes the typed editor input as it was returned from the implementation. If we were to change that logic, we probably would have to ask method to return an untyped input without override, or at least make sure the text based editors don't set the override.
I think that there needs to be better UX if we were to implement this as a saveAs causing an editor type switch can be jarring. I don't love the notification approach but maybe something along those lines. User gets prompted that there is an ew editor type for this resource -user can choose to switch or set automatic switching -editor switches. If automatic switching enabled we no longer prompt and just switch anyways for that resource type
Yup agreed, didn't mean to ask to solve this now, just wanted to keep track of the location in code where this is currently decided
To verify: an untitled file it as jupyter notebook should be created your setting to have the entry steps 1 and 2 with a different file name shouldn't switch to a notebook, it should stay as a text
I tried above steps with the GitHub issue notebook extension instead and when I come to step 5. and save an untitled editor as "", that editor actually closes.
My settings: My extensions: Video: !

Discussion:
if (!result.matches(editor)) { const targetGroups = editor.hasCapability(EditorInputCapabilities.Untitled) ? this.editorGroupService.groups.map(group => group.id) /* untitled replaces across all groups */ : [groupId]; for (const targetGroup of targetGroups) { <ins> const resolvedEditor = await this.editorResolverService.resolveEditor({ resource: result.resource, }, targetGroup); </ins> const group = this.editorGroupService.getGroup(targetGroup); <del> await group?.replaceEditors([{ editor, replacement: result, options: editorOptions }]); </del> <ins> if (resolvedEditor !== ResolvedStatus.ABORT && isEditorInputWithOptionsAndGroup(resolvedEditor)) { // dispose the previous result before replacing with the resolved editor saveResults.pop()?.dispose(); saveResults.push(resolvedEditor.editor); await group?.replaceEditors([{ editor, replacement: resolvedEditor.editor, options: editorOptions }]); } else { await group?.replaceEditors([{ editor, replacement: result, options: editorOptions }]); } </ins> } } }