@@ -54,8 +54,8 @@ export class DiffViewProvider {
5454 // If the file is already open, ensure it's not dirty before getting its
5555 // contents.
5656 if ( fileExists ) {
57- const existingDocument = vscode . workspace . textDocuments . find ( ( doc ) =>
58- arePathsEqual ( doc . uri . fsPath , absolutePath ) ,
57+ const existingDocument = vscode . workspace . textDocuments . find (
58+ ( doc ) => doc . uri . scheme === "file" && arePathsEqual ( doc . uri . fsPath , absolutePath ) ,
5959 )
6060
6161 if ( existingDocument && existingDocument . isDirty ) {
@@ -91,7 +91,10 @@ export class DiffViewProvider {
9191 . map ( ( tg ) => tg . tabs )
9292 . flat ( )
9393 . filter (
94- ( tab ) => tab . input instanceof vscode . TabInputText && arePathsEqual ( tab . input . uri . fsPath , absolutePath ) ,
94+ ( tab ) =>
95+ tab . input instanceof vscode . TabInputText &&
96+ tab . input . uri . scheme === "file" &&
97+ arePathsEqual ( tab . input . uri . fsPath , absolutePath ) ,
9598 )
9699
97100 for ( const tab of tabs ) {
@@ -509,13 +512,14 @@ export class DiffViewProvider {
509512 // Listen for document open events - more efficient than scanning all tabs
510513 disposables . push (
511514 vscode . workspace . onDidOpenTextDocument ( async ( document ) => {
512- if ( arePathsEqual ( document . uri . fsPath , uri . fsPath ) ) {
515+ // Only match file:// scheme documents to avoid git diffs
516+ if ( document . uri . scheme === "file" && arePathsEqual ( document . uri . fsPath , uri . fsPath ) ) {
513517 // Wait a tick for the editor to be available
514518 await new Promise ( ( r ) => setTimeout ( r , 0 ) )
515519
516520 // Find the editor for this document
517- const editor = vscode . window . visibleTextEditors . find ( ( e ) =>
518- arePathsEqual ( e . document . uri . fsPath , uri . fsPath ) ,
521+ const editor = vscode . window . visibleTextEditors . find (
522+ ( e ) => e . document . uri . scheme === "file" && arePathsEqual ( e . document . uri . fsPath , uri . fsPath ) ,
519523 )
520524
521525 if ( editor ) {
@@ -529,7 +533,11 @@ export class DiffViewProvider {
529533 // Also listen for visible editor changes as a fallback
530534 disposables . push (
531535 vscode . window . onDidChangeVisibleTextEditors ( ( editors ) => {
532- const editor = editors . find ( ( e ) => arePathsEqual ( e . document . uri . fsPath , uri . fsPath ) )
536+ const editor = editors . find ( ( e ) => {
537+ const isFileScheme = e . document . uri . scheme === "file"
538+ const pathMatches = arePathsEqual ( e . document . uri . fsPath , uri . fsPath )
539+ return isFileScheme && pathMatches
540+ } )
533541 if ( editor ) {
534542 cleanup ( )
535543 resolve ( editor )
0 commit comments