File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
packages/cursorless-vscode/src/ide/vscode Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { getCellIndex } from "@cursorless/vscode-common";
2
2
import {
3
3
commands ,
4
4
NotebookDocument ,
5
+ TabInputTextDiff ,
5
6
TextEditor ,
6
7
ViewColumn ,
7
8
window ,
@@ -58,12 +59,15 @@ function getViewColumn(editor: TextEditor): ViewColumn | undefined {
58
59
}
59
60
const uri = editor . document . uri . toString ( ) ;
60
61
const tabGroup = window . tabGroups . all . find ( ( tabGroup ) =>
61
- tabGroup . tabs . find (
62
- ( tab : any ) =>
63
- tab . input . uri ?. toString ( ) === uri ||
64
- tab . input . original ?. toString ( ) === uri ||
65
- tab . input . modified ?. toString ( ) === uri ,
66
- ) ,
62
+ tabGroup . tabs . find ( ( tab ) => {
63
+ if ( tab . input instanceof TabInputTextDiff ) {
64
+ return (
65
+ tab . input . original . toString ( ) === uri ||
66
+ tab . input . modified . toString ( ) === uri
67
+ ) ;
68
+ }
69
+ return ( tab as any ) . input ?. uri ?. toString ( ) === uri ;
70
+ } ) ,
67
71
) ;
68
72
return tabGroup ?. viewColumn ;
69
73
}
Original file line number Diff line number Diff line change 1
- import { TextEditor , window } from "vscode" ;
1
+ import { TabInputTextDiff , TextEditor , window } from "vscode" ;
2
2
3
3
/**
4
4
* @param editor The editor to check
@@ -10,6 +10,10 @@ export function isDiffEditorOriginal(editor: TextEditor): boolean {
10
10
}
11
11
const uri = editor . document . uri . toString ( ) ;
12
12
return window . tabGroups . all . some ( ( tabGroup ) =>
13
- tabGroup . tabs . find ( ( tab : any ) => tab . input . original ?. toString ( ) === uri ) ,
13
+ tabGroup . tabs . find (
14
+ ( tab ) =>
15
+ tab . input instanceof TabInputTextDiff &&
16
+ tab . input . original . toString ( ) === uri ,
17
+ ) ,
14
18
) ;
15
19
}
You can’t perform that action at this time.
0 commit comments