mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add saved files to recently opened (#20470)
This commit is contained in:
@@ -31,7 +31,6 @@ import { Emitter } from 'vs/base/common/event';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { parse, stringify } from 'vs/base/common/marshalling';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
//#region Editor / Resources DND
|
||||
@@ -190,8 +189,7 @@ export class ResourcesDropHandler {
|
||||
@IWorkspacesService private readonly workspacesService: IWorkspacesService,
|
||||
@IEditorService private readonly editorService: IEditorService,
|
||||
@IWorkspaceEditingService private readonly workspaceEditingService: IWorkspaceEditingService,
|
||||
@IHostService private readonly hostService: IHostService,
|
||||
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
|
||||
@IHostService private readonly hostService: IHostService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -216,12 +214,8 @@ export class ResourcesDropHandler {
|
||||
}
|
||||
|
||||
// Add external ones to recently open list unless dropped resource is a workspace
|
||||
// and only for resources that are outside of the currently opened workspace
|
||||
if (externalLocalFiles.length) {
|
||||
this.workspacesService.addRecentlyOpened(externalLocalFiles
|
||||
.filter(resource => !this.contextService.isInsideWorkspace(resource))
|
||||
.map(resource => ({ fileUri: resource }))
|
||||
);
|
||||
this.workspacesService.addRecentlyOpened(externalLocalFiles.map(resource => ({ fileUri: resource })));
|
||||
}
|
||||
|
||||
// Open in Editor
|
||||
|
||||
@@ -193,12 +193,8 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
|
||||
}
|
||||
}
|
||||
|
||||
private addFileToRecentlyOpened(uri: URI): void {
|
||||
// add the picked file into the list of recently opened
|
||||
// only if it is outside the currently opened workspace
|
||||
if (!this.contextService.isInsideWorkspace(uri)) {
|
||||
this.workspacesService.addRecentlyOpened([{ fileUri: uri, label: this.labelService.getUriLabel(uri) }]);
|
||||
}
|
||||
protected addFileToRecentlyOpened(uri: URI): void {
|
||||
this.workspacesService.addRecentlyOpened([{ fileUri: uri, label: this.labelService.getUriLabel(uri) }]);
|
||||
}
|
||||
|
||||
protected async pickFolderAndOpenSimplified(schema: string, options: IPickAndOpenOptions): Promise<void> {
|
||||
@@ -228,7 +224,13 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
|
||||
}
|
||||
|
||||
options.title = nls.localize('saveFileAs.title', 'Save As');
|
||||
return this.saveRemoteResource(options);
|
||||
const uri = await this.saveRemoteResource(options);
|
||||
|
||||
if (uri) {
|
||||
this.addFileToRecentlyOpened(uri);
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
protected async showSaveDialogSimplified(schema: string, options: ISaveDialogOptions): Promise<URI | undefined> {
|
||||
|
||||
@@ -131,7 +131,11 @@ export class FileDialogService extends AbstractFileDialogService implements IFil
|
||||
} else {
|
||||
const result = await this.nativeHostService.showSaveDialog(this.toNativeSaveDialogOptions(options));
|
||||
if (result && !result.canceled && result.filePath) {
|
||||
return URI.file(result.filePath);
|
||||
const uri = URI.file(result.filePath);
|
||||
|
||||
this.addFileToRecentlyOpened(uri);
|
||||
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
return undefined; // {{SQL CARBON EDIT}} strict-null-check
|
||||
|
||||
Reference in New Issue
Block a user