This commit is contained in:
Benjamin Pasero
2018-06-11 11:46:05 +02:00
parent f0a823103f
commit 799f31b5ff
2 changed files with 12 additions and 17 deletions

View File

@@ -27,7 +27,6 @@ import { ExtHostContext, ExtHostEditorsShape, IExtHostContext, ITextDocumentShow
import { MainThreadDocumentsAndEditors } from './mainThreadDocumentsAndEditors';
import { MainThreadTextEditor } from './mainThreadEditor';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IFileService } from 'vs/platform/files/common/files';
export class MainThreadTextEditors implements MainThreadTextEditorsShape {
@@ -253,19 +252,24 @@ CommandsRegistry.registerCommand('_workbench.open', function (accessor: Services
const editorService = accessor.get(IEditorService);
const editorGroupService = accessor.get(IEditorGroupsService);
const openerService = accessor.get(IOpenerService);
const fileService = accessor.get(IFileService);
const [resource, options, position] = args;
if (fileService.canHandleResource(resource)) {
return editorService.openEditor({ resource, options }, viewColumnToEditorGroup(editorGroupService, position)).then(() => void 0);
} else {
// http://, https://, command:id
//todo@ben make this proper
return openerService.open(resource).then(_ => void 0);
if (options || typeof position === 'number') {
// use editor options or editor view column as a hint to use the editor service for opening
return editorService.openEditor({ resource, options }, viewColumnToEditorGroup(editorGroupService, position)).then(_ => void 0);
}
if (resource && resource.scheme === 'command') {
// do not allow to execute commands from here
return TPromise.as(void 0);
}
// finally, delegate to opener service
return openerService.open(resource).then(_ => void 0);
});
CommandsRegistry.registerCommand('_workbench.diff', function (accessor: ServicesAccessor, args: [URI, URI, string, string, IEditorOptions, EditorViewColumn]) {
const editorService = accessor.get(IEditorService);
const editorGroupService = accessor.get(IEditorGroupsService);