File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -722,6 +722,25 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
722722 apiVersion : active ? apiVersion : undefined ,
723723 } ;
724724 } ,
725+ serverDocumentUriForUri ( uri : vscode . Uri ) : vscode . Uri {
726+ const { apiTarget } = connectionTarget ( uri ) ;
727+ if ( typeof apiTarget === "string" ) {
728+ // It was a file-type uri, so find its document (we hope it is open)
729+ const docs = vscode . workspace . textDocuments . filter ( ( doc ) => doc . uri === uri ) ;
730+ let fileName = "" ;
731+ if ( docs . length === 1 ) {
732+ // Found it, so work out the corresponding server-side name
733+ const file = currentFile ( docs [ 0 ] ) ;
734+ // For some local documents there is no server-side equivalent
735+ if ( file ) {
736+ fileName = file . name ;
737+ }
738+ }
739+ // uri.path will be "/" if no mapping exists to a server-side equivalent
740+ uri = vscode . Uri . file ( fileName ) . with ( { scheme : OBJECTSCRIPT_FILE_SCHEMA , authority : apiTarget } ) ;
741+ }
742+ return uri ;
743+ } ,
725744 } ;
726745
727746 // 'export' our public API
You can’t perform that action at this time.
0 commit comments