mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-17 20:44:27 +01:00
debt - prevent simple code editors in results (#203019)
Co-authored-by: Johannes Rieken <johannes.rieken@gmail.com>
This commit is contained in:
co-authored by
Johannes Rieken
parent
e5a6595f13
commit
40ecea93e9
@@ -414,7 +414,7 @@ async function saveSelectedEditors(accessor: ServicesAccessor, options?: ISaveEd
|
||||
// find it in our text file models. Currently, only textual editors
|
||||
// support embedded editors.
|
||||
const focusedCodeEditor = codeEditorService.getFocusedCodeEditor();
|
||||
if (focusedCodeEditor instanceof EmbeddedCodeEditorWidget) {
|
||||
if (focusedCodeEditor instanceof EmbeddedCodeEditorWidget && !focusedCodeEditor.isSimpleWidget) {
|
||||
const resource = focusedCodeEditor.getModel()?.uri;
|
||||
|
||||
// Check that the resource of the model was not saved already
|
||||
|
||||
@@ -19,6 +19,7 @@ import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { extractFileListData } from 'vs/platform/dnd/browser/dnd';
|
||||
import { Iterable } from 'vs/base/common/iterator';
|
||||
import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess';
|
||||
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
|
||||
|
||||
export class FileDialogService extends AbstractFileDialogService implements IFileDialogService {
|
||||
|
||||
@@ -217,10 +218,13 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
|
||||
// When saving, try to just download the contents
|
||||
// of the active text editor if any as a workaround
|
||||
if (context === 'save') {
|
||||
const activeTextModel = this.codeEditorService.getActiveCodeEditor()?.getModel();
|
||||
if (activeTextModel) {
|
||||
triggerDownload(VSBuffer.fromString(activeTextModel.getValue()).buffer, basename(activeTextModel.uri));
|
||||
return;
|
||||
const activeCodeEditor = this.codeEditorService.getActiveCodeEditor();
|
||||
if (!(activeCodeEditor instanceof EmbeddedCodeEditorWidget)) {
|
||||
const activeTextModel = activeCodeEditor?.getModel();
|
||||
if (activeTextModel) {
|
||||
triggerDownload(VSBuffer.fromString(activeTextModel.getValue()).buffer, basename(activeTextModel.uri));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user