mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Add 'vscode.reopenWith' API command
Fixes #88426 Add an api command that allows extensions to open/reopen a file with a specific we custom editor. Use this to allow re-opening a failed to load image as text/binary For #77131
This commit is contained in:
@@ -132,6 +132,24 @@ export class OpenAPICommand {
|
||||
}
|
||||
CommandsRegistry.registerCommand(OpenAPICommand.ID, adjustHandler(OpenAPICommand.execute));
|
||||
|
||||
export class OpenWithAPICommand {
|
||||
public static readonly ID = 'vscode.openWith';
|
||||
public static execute(executor: ICommandsExecutor, resource: URI, viewType: string, column?: vscode.ViewColumn): Promise<any> {
|
||||
let position: EditorViewColumn | undefined;
|
||||
|
||||
if (typeof column === 'number') {
|
||||
position = typeConverters.ViewColumn.from(column);
|
||||
}
|
||||
|
||||
return executor.executeCommand('_workbench.openWith', [
|
||||
resource,
|
||||
viewType,
|
||||
position
|
||||
]);
|
||||
}
|
||||
}
|
||||
CommandsRegistry.registerCommand(OpenWithAPICommand.ID, adjustHandler(OpenWithAPICommand.execute));
|
||||
|
||||
CommandsRegistry.registerCommand('_workbench.removeFromRecentlyOpened', function (accessor: ServicesAccessor, uri: URI) {
|
||||
const workspacesService = accessor.get(IWorkspacesService);
|
||||
return workspacesService.removeFromRecentlyOpened([uri]);
|
||||
|
||||
Reference in New Issue
Block a user