mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -3,15 +3,21 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { tmpdir } from 'os';
|
||||
import { posix } from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { isMalformedFileUri } from 'vs/base/common/resources';
|
||||
import * as vscode from 'vscode';
|
||||
import * as typeConverters from 'vs/workbench/api/node/extHostTypeConverters';
|
||||
import { CommandsRegistry, ICommandService, ICommandHandler } from 'vs/platform/commands/common/commands';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { EditorViewColumn } from 'vs/workbench/api/shared/editor';
|
||||
import { EditorGroupLayout } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IDownloadService } from 'vs/platform/download/common/download';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// The following commands are registered on both sides separately.
|
||||
@@ -21,7 +27,7 @@ import { isWindows } from 'vs/base/common/platform';
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
export interface ICommandsExecutor {
|
||||
executeCommand<T>(id: string, ...args: any[]): Thenable<T>;
|
||||
executeCommand<T>(id: string, ...args: any[]): Promise<T>;
|
||||
}
|
||||
|
||||
function adjustHandler(handler: (executor: ICommandsExecutor, ...args: any[]) => any): ICommandHandler {
|
||||
@@ -32,7 +38,7 @@ function adjustHandler(handler: (executor: ICommandsExecutor, ...args: any[]) =>
|
||||
|
||||
export class PreviewHTMLAPICommand {
|
||||
public static ID = 'vscode.previewHtml';
|
||||
public static execute(executor: ICommandsExecutor, uri: URI, position?: vscode.ViewColumn, label?: string, options?: any): Thenable<any> {
|
||||
public static execute(executor: ICommandsExecutor, uri: URI, position?: vscode.ViewColumn, label?: string, options?: any): Promise<any> {
|
||||
return executor.executeCommand('_workbench.previewHtml',
|
||||
uri,
|
||||
typeof position === 'number' && typeConverters.ViewColumn.from(position),
|
||||
@@ -45,7 +51,7 @@ CommandsRegistry.registerCommand(PreviewHTMLAPICommand.ID, adjustHandler(Preview
|
||||
|
||||
export class OpenFolderAPICommand {
|
||||
public static ID = 'vscode.openFolder';
|
||||
public static execute(executor: ICommandsExecutor, uri?: URI, forceNewWindow?: boolean): Thenable<any> {
|
||||
public static execute(executor: ICommandsExecutor, uri?: URI, forceNewWindow?: boolean): Promise<any> {
|
||||
if (!uri) {
|
||||
return executor.executeCommand('_files.pickFolderAndOpen', forceNewWindow);
|
||||
}
|
||||
@@ -56,14 +62,14 @@ export class OpenFolderAPICommand {
|
||||
uri = correctedUri;
|
||||
}
|
||||
|
||||
return executor.executeCommand('_files.windowOpen', [uri], forceNewWindow);
|
||||
return executor.executeCommand('_files.windowOpen', { folderURIs: [uri], forceNewWindow });
|
||||
}
|
||||
}
|
||||
CommandsRegistry.registerCommand(OpenFolderAPICommand.ID, adjustHandler(OpenFolderAPICommand.execute));
|
||||
|
||||
export class DiffAPICommand {
|
||||
public static ID = 'vscode.diff';
|
||||
public static execute(executor: ICommandsExecutor, left: URI, right: URI, label: string, options?: vscode.TextDocumentShowOptions): Thenable<any> {
|
||||
public static execute(executor: ICommandsExecutor, left: URI, right: URI, label: string, options?: vscode.TextDocumentShowOptions): Promise<any> {
|
||||
return executor.executeCommand('_workbench.diff', [
|
||||
left, right,
|
||||
label,
|
||||
@@ -77,7 +83,7 @@ CommandsRegistry.registerCommand(DiffAPICommand.ID, adjustHandler(DiffAPICommand
|
||||
|
||||
export class OpenAPICommand {
|
||||
public static ID = 'vscode.open';
|
||||
public static execute(executor: ICommandsExecutor, resource: URI, columnOrOptions?: vscode.ViewColumn | vscode.TextDocumentShowOptions, label?: string): Thenable<any> {
|
||||
public static execute(executor: ICommandsExecutor, resource: URI, columnOrOptions?: vscode.ViewColumn | vscode.TextDocumentShowOptions, label?: string): Promise<any> {
|
||||
let options: ITextEditorOptions;
|
||||
let position: EditorViewColumn;
|
||||
|
||||
@@ -100,9 +106,15 @@ export class OpenAPICommand {
|
||||
}
|
||||
CommandsRegistry.registerCommand(OpenAPICommand.ID, adjustHandler(OpenAPICommand.execute));
|
||||
|
||||
CommandsRegistry.registerCommand('_workbench.removeFromRecentlyOpened', function (accessor: ServicesAccessor, path: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string) {
|
||||
const windowsService = accessor.get(IWindowsService);
|
||||
|
||||
return windowsService.removeFromRecentlyOpened([path]).then(() => undefined);
|
||||
});
|
||||
|
||||
export class RemoveFromRecentlyOpenedAPICommand {
|
||||
public static ID = 'vscode.removeFromRecentlyOpened';
|
||||
public static execute(executor: ICommandsExecutor, path: string): Thenable<any> {
|
||||
public static execute(executor: ICommandsExecutor, path: string): Promise<any> {
|
||||
return executor.executeCommand('_workbench.removeFromRecentlyOpened', path);
|
||||
}
|
||||
}
|
||||
@@ -110,8 +122,15 @@ CommandsRegistry.registerCommand(RemoveFromRecentlyOpenedAPICommand.ID, adjustHa
|
||||
|
||||
export class SetEditorLayoutAPICommand {
|
||||
public static ID = 'vscode.setEditorLayout';
|
||||
public static execute(executor: ICommandsExecutor, layout: EditorGroupLayout): Thenable<any> {
|
||||
public static execute(executor: ICommandsExecutor, layout: EditorGroupLayout): Promise<any> {
|
||||
return executor.executeCommand('layoutEditorGroups', layout);
|
||||
}
|
||||
}
|
||||
CommandsRegistry.registerCommand(SetEditorLayoutAPICommand.ID, adjustHandler(SetEditorLayoutAPICommand.execute));
|
||||
CommandsRegistry.registerCommand(SetEditorLayoutAPICommand.ID, adjustHandler(SetEditorLayoutAPICommand.execute));
|
||||
|
||||
CommandsRegistry.registerCommand('_workbench.downloadResource', function (accessor: ServicesAccessor, resource: URI) {
|
||||
const downloadService = accessor.get(IDownloadService);
|
||||
const location = posix.join(tmpdir(), generateUuid());
|
||||
|
||||
return downloadService.download(resource, location).then(() => URI.file(location));
|
||||
});
|
||||
Reference in New Issue
Block a user