mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
@@ -36,19 +36,6 @@ 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): Promise<any> {
|
||||
return executor.executeCommand('_workbench.previewHtml',
|
||||
uri,
|
||||
typeof position === 'number' && typeConverters.ViewColumn.from(position),
|
||||
label,
|
||||
options
|
||||
);
|
||||
}
|
||||
}
|
||||
CommandsRegistry.registerCommand(PreviewHTMLAPICommand.ID, adjustHandler(PreviewHTMLAPICommand.execute));
|
||||
|
||||
export class OpenFolderAPICommand {
|
||||
public static ID = 'vscode.openFolder';
|
||||
public static execute(executor: ICommandsExecutor, uri?: URI, forceNewWindow?: boolean): Promise<any> {
|
||||
|
||||
@@ -175,23 +175,6 @@ export function createApiFactory(
|
||||
};
|
||||
})();
|
||||
|
||||
// Warn when trying to use the vscode.previewHtml command as it does not work properly in all scenarios and
|
||||
// has security concerns.
|
||||
const checkCommand = (() => {
|
||||
let done = false;
|
||||
const informOnce = () => {
|
||||
if (!done) {
|
||||
done = true;
|
||||
window.showWarningMessage(localize('previewHtml.deprecated', "Extension '{0}' uses the 'vscode.previewHtml' command which is deprecated and will be removed soon. Please file an issue against this extension to update to use VS Code's webview API.", extension.identifier.value));
|
||||
}
|
||||
};
|
||||
return (commandId: string) => {
|
||||
if (commandId === 'vscode.previewHtml') {
|
||||
informOnce();
|
||||
}
|
||||
return commandId;
|
||||
};
|
||||
})();
|
||||
|
||||
// namespace: commands
|
||||
const commands: typeof vscode.commands = {
|
||||
@@ -232,7 +215,7 @@ export function createApiFactory(
|
||||
});
|
||||
}),
|
||||
executeCommand<T>(id: string, ...args: any[]): Thenable<T> {
|
||||
return extHostCommands.executeCommand<T>(checkCommand(id), ...args);
|
||||
return extHostCommands.executeCommand<T>(id, ...args);
|
||||
},
|
||||
getCommands(filterInternal: boolean = false): Thenable<string[]> {
|
||||
return extHostCommands.getCommands(filterInternal);
|
||||
|
||||
@@ -15,7 +15,7 @@ import * as search from 'vs/workbench/contrib/search/common/search';
|
||||
import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
|
||||
import { CustomCodeAction } from 'vs/workbench/api/node/extHostLanguageFeatures';
|
||||
import { ICommandsExecutor, PreviewHTMLAPICommand, OpenFolderAPICommand, DiffAPICommand, OpenAPICommand, RemoveFromRecentlyOpenedAPICommand, SetEditorLayoutAPICommand } from './apiCommands';
|
||||
import { ICommandsExecutor, OpenFolderAPICommand, DiffAPICommand, OpenAPICommand, RemoveFromRecentlyOpenedAPICommand, SetEditorLayoutAPICommand } from './apiCommands';
|
||||
import { EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
|
||||
@@ -219,20 +219,6 @@ export class ExtHostApiCommands {
|
||||
};
|
||||
};
|
||||
|
||||
this._register(PreviewHTMLAPICommand.ID, adjustHandler(PreviewHTMLAPICommand.execute), {
|
||||
description: `
|
||||
Render the HTML of the resource in an editor view.
|
||||
|
||||
See [working with the HTML preview](https://code.visualstudio.com/docs/extensionAPI/vscode-api-commands#working-with-the-html-preview) for more information about the HTML preview's integration with the editor and for best practices for extension authors.
|
||||
`,
|
||||
args: [
|
||||
{ name: 'uri', description: 'Uri of the resource to preview.', constraint: (value: any) => value instanceof URI || typeof value === 'string' },
|
||||
{ name: 'column', description: '(optional) Column in which to preview.', constraint: (value: any) => typeof value === 'undefined' || (typeof value === 'number' && typeof types.ViewColumn[value] === 'string') },
|
||||
{ name: 'label', description: '(optional) An human readable string that is used as title for the preview.', constraint: (v: any) => typeof v === 'string' || typeof v === 'undefined' },
|
||||
{ name: 'options', description: '(optional) Options for controlling webview environment.', constraint: (v: any) => typeof v === 'object' || typeof v === 'undefined' }
|
||||
]
|
||||
});
|
||||
|
||||
this._register(OpenFolderAPICommand.ID, adjustHandler(OpenFolderAPICommand.execute), {
|
||||
description: 'Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.',
|
||||
args: [
|
||||
|
||||
Reference in New Issue
Block a user