@@ -8,10 +8,9 @@ import { URI, UriComponents } from 'vs/base/common/uri';
8
8
import { localize } from 'vs/nls' ;
9
9
import { ILocalizedString } from 'vs/platform/action/common/action' ;
10
10
import { Action2 , IAction2Options , MenuId } from 'vs/platform/actions/common/actions' ;
11
- import { ICommandService } from 'vs/platform/commands /common/commands ' ;
11
+ import { ITextEditorOptions } from 'vs/platform/editor /common/editor ' ;
12
12
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
13
13
import { IOpenerService } from 'vs/platform/opener/common/opener' ;
14
- import { API_OPEN_DIFF_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands' ;
15
14
import { IResourceMergeEditorInput } from 'vs/workbench/common/editor' ;
16
15
import { MergeEditorInputData } from 'vs/workbench/contrib/mergeEditor/browser/mergeEditorInput' ;
17
16
import { MergeEditor } from 'vs/workbench/contrib/mergeEditor/browser/view/mergeEditor' ;
@@ -336,8 +335,8 @@ export class CompareInput1WithBaseCommand extends MergeEditorAction {
336
335
}
337
336
338
337
override runWithViewModel ( viewModel : MergeEditorViewModel , accessor : ServicesAccessor ) : void {
339
- const commandService = accessor . get ( ICommandService ) ;
340
- mergeEditorCompare ( viewModel , commandService , 1 ) ;
338
+ const editorService = accessor . get ( IEditorService ) ;
339
+ mergeEditorCompare ( viewModel , editorService , 1 ) ;
341
340
}
342
341
}
343
342
@@ -361,20 +360,29 @@ export class CompareInput2WithBaseCommand extends MergeEditorAction {
361
360
}
362
361
363
362
override runWithViewModel ( viewModel : MergeEditorViewModel , accessor : ServicesAccessor ) : void {
364
- const commandService = accessor . get ( ICommandService ) ;
365
- mergeEditorCompare ( viewModel , commandService , 2 ) ;
363
+ const editorService = accessor . get ( IEditorService ) ;
364
+ mergeEditorCompare ( viewModel , editorService , 2 ) ;
366
365
}
367
366
}
368
367
369
- function mergeEditorCompare ( viewModel : MergeEditorViewModel , commandService : ICommandService , inputNumber : 1 | 2 ) {
368
+ async function mergeEditorCompare ( viewModel : MergeEditorViewModel , editorService : IEditorService , inputNumber : 1 | 2 ) {
370
369
const model = viewModel . model ;
371
- const base = model . base . uri ;
372
- const input = inputNumber === 1 ? model . input1 . textModel . uri : model . input2 . textModel . uri ;
373
- openDiffEditor ( commandService , base , input ) ;
374
- }
375
-
376
- function openDiffEditor ( commandService : ICommandService , left : URI , right : URI , label ?: string ) {
377
- commandService . executeCommand ( API_OPEN_DIFF_EDITOR_COMMAND_ID , left , right , label ) ;
370
+ const base = model . base ;
371
+ const input = inputNumber === 1 ? viewModel . inputCodeEditorView1 . editor : viewModel . inputCodeEditorView2 . editor ;
372
+
373
+ const lineNumber = input . getPosition ( ) ! . lineNumber ;
374
+ await editorService . openEditor ( {
375
+ original : { resource : base . uri } ,
376
+ modified : { resource : input . getModel ( ) ! . uri } ,
377
+ options : {
378
+ selection : {
379
+ startLineNumber : lineNumber ,
380
+ startColumn : 1 ,
381
+ } ,
382
+ revealIfOpened : true ,
383
+ revealIfVisible : true ,
384
+ } as ITextEditorOptions
385
+ } ) ;
378
386
}
379
387
380
388
export class OpenBaseFile extends MergeEditorAction {
0 commit comments