提交 cf149f8a 编写于 作者: S Sandeep Somavarapu

Provide a parameter to bubble up the error while adding/removing workspace folders through API

上级 b80ec5ca
......@@ -45,7 +45,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape {
}
$onDidAddFileSystemRoot(uri: URI): void {
this._workspaceEditingService.addFolders([{ uri }]);
this._workspaceEditingService.addFolders([{ uri }], true);
}
$onFileSystemChange(handle: number, changes: IFileChange[]): void {
......
......@@ -16,14 +16,16 @@ export interface IWorkspaceEditingService {
_serviceBrand: ServiceIdentifier<any>;
/**
* Add folders to the existing workspace
* Add folders to the existing workspace.
* When `donotNotifyError` is `true`, error will be bubbled up otherwise, the service handles the error with proper message and action
*/
addFolders(folders: IWorkspaceFolderCreationData[]): TPromise<void>;
addFolders(folders: IWorkspaceFolderCreationData[], donotNotifyError?: boolean): TPromise<void>;
/**
* Remove folders from the existing workspace
* When `donotNotifyError` is `true`, error will be bubbled up otherwise, the service handles the error with proper message and action
*/
removeFolders(folders: URI[]): TPromise<void>;
removeFolders(folders: URI[], donotNotifyError?: boolean): TPromise<void>;
/**
* creates a new workspace with the provided folders and opens it. if path is provided
......
......@@ -51,7 +51,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
) {
}
public addFolders(foldersToAdd: IWorkspaceFolderCreationData[]): TPromise<void> {
public addFolders(foldersToAdd: IWorkspaceFolderCreationData[], donotNotifyError: boolean = false): TPromise<void> {
const state = this.contextService.getWorkbenchState();
// If we are in no-workspace or single-folder workspace, adding folders has to
......@@ -71,10 +71,10 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
// Delegate addition of folders to workspace service otherwise
return this.contextService.addFolders(foldersToAdd)
.then(() => null, error => this.handleWorkspaceConfigurationEditingError(error));
.then(() => null, error => donotNotifyError ? TPromise.wrapError(error) : this.handleWorkspaceConfigurationEditingError(error));
}
public removeFolders(foldersToRemove: URI[]): TPromise<void> {
public removeFolders(foldersToRemove: URI[], donotNotifyError: boolean = false): TPromise<void> {
// If we are in single-folder state and the opened folder is to be removed,
// we close the workspace and enter the empty workspace state for the window.
......@@ -87,7 +87,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
// Delegate removal of folders to workspace service otherwise
return this.contextService.removeFolders(foldersToRemove)
.then(() => null, error => this.handleWorkspaceConfigurationEditingError(error));
.then(() => null, error => donotNotifyError ? TPromise.wrapError(error) : this.handleWorkspaceConfigurationEditingError(error));
}
public createAndEnterWorkspace(folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<void> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册