@@ -77,6 +77,40 @@ export class DocumentContentProvider implements vscode.TextDocumentContentProvid
77
77
// Exists as a local file and we aren't viewing a different namespace on the same server,
78
78
// so return a file:// uri that will open the local file.
79
79
return vscode . Uri . file ( localFile ) ;
80
+ } else {
81
+ // The local file doesn't exist in this folder, so check any other
82
+ // local folders in this workspace if it's a multi-root workspace
83
+ const wFolders = vscode . workspace . workspaceFolders ;
84
+ if ( wFolders && wFolders . length > 1 ) {
85
+ // This is a multi-root workspace
86
+ for ( const wFolder of wFolders ) {
87
+ if ( wFolder . uri . scheme === "file" && wFolder . name !== workspaceFolder ) {
88
+ // This isn't the folder that we checked originally
89
+ const wFolderConn = config ( "conn" , wFolder . name ) ;
90
+ const compareConns = ( ) : boolean => {
91
+ if ( wFolderConn . ns === conn . ns ) {
92
+ if ( wFolderConn . server && conn . server ) {
93
+ if ( wFolderConn . server === conn . server ) {
94
+ return true ;
95
+ }
96
+ } else if ( ! wFolderConn . server && ! conn . server ) {
97
+ if ( wFolderConn . host === conn . host && wFolderConn . port === conn . port ) {
98
+ return true ;
99
+ }
100
+ }
101
+ }
102
+ return false ;
103
+ } ;
104
+ if ( compareConns ( ) && ( ! namespace || namespace === wFolderConn . ns ) ) {
105
+ // This folder is connected to the same server:ns combination as the original folder
106
+ const wFolderFile = this . getAsFile ( name , wFolder . name ) ;
107
+ if ( wFolderFile ) {
108
+ return vscode . Uri . file ( wFolderFile ) ;
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
80
114
}
81
115
const { active } = conn ;
82
116
if ( ! active ) {
0 commit comments