File tree Expand file tree Collapse file tree 4 files changed +42
-6
lines changed
Expand file tree Collapse file tree 4 files changed +42
-6
lines changed Original file line number Diff line number Diff line change 757757 "default" : " none" ,
758758 "description" : " Defines if the report or log file should be opened after a run." ,
759759 "scope" : " resource"
760+ },
761+ "robotcode.run.openOutputTarget" : {
762+ "type" : " string" ,
763+ "enum" : [
764+ " simpleBrowser" ,
765+ " externalHttp" ,
766+ " externalFile"
767+ ],
768+ "enumDescriptions" : [
769+ " Display the output file in a simple VSCode browser window." ,
770+ " Display the output file in your default web browser via HTTP." ,
771+ " Display the output file in your default browser via the file system."
772+ ],
773+ "default" : " simpleBrowser" ,
774+ "description" : " Specifies how Robot Framework output files should be displayed when opened." ,
775+ "scope" : " resource"
760776 }
761777 }
762778 },
19431959 "workspaces" : [
19441960 " docs"
19451961 ]
1946- }
1962+ }
Original file line number Diff line number Diff line change @@ -612,10 +612,11 @@ export class DebugManager {
612612 logFile ?: string ,
613613 reportFile ?: string ,
614614 ) : Promise < void > {
615- if ( session . configuration ?. openOutputAfterRun === "report" && reportFile ) {
616- await this . languageClientsManager . openUriInDocumentationView ( vscode . Uri . file ( reportFile ) ) ;
617- } else if ( session . configuration ?. openOutputAfterRun === "log" && logFile ) {
618- await this . languageClientsManager . openUriInDocumentationView ( vscode . Uri . file ( logFile ) ) ;
615+ const openMode = session . configuration ?. openOutputAfterRun as string ;
616+ const fileToOpen = openMode === "report" ? reportFile : openMode === "log" ? logFile : undefined ;
617+
618+ if ( fileToOpen ) {
619+ await this . languageClientsManager . openOutputFile ( vscode . Uri . file ( fileToOpen ) ) ;
619620 }
620621 }
621622}
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
116116 return [ ] ;
117117 } ,
118118 async handleTerminalLink ( link : TerminalLink ) {
119- await languageClientManger . openUriInDocumentationView ( vscode . Uri . file ( link . path ) ) ;
119+ await languageClientManger . openOutputFile ( vscode . Uri . file ( link . path ) ) ;
120120 } ,
121121 } ) ,
122122
Original file line number Diff line number Diff line change @@ -794,6 +794,25 @@ export class LanguageClientsManager {
794794 }
795795 }
796796
797+ public async openOutputFile ( file : vscode . Uri ) : Promise < void > {
798+ const workspace = vscode . workspace . getWorkspaceFolder ( file ) ;
799+ const result = vscode . workspace . getConfiguration ( CONFIG_SECTION , workspace ) . get < string > ( "run.openOutputTarget" ) ;
800+
801+ switch ( result ) {
802+ case "simpleBrowser" :
803+ await this . openUriInDocumentationView ( file ) ;
804+ break ;
805+ case "externalHttp" :
806+ await vscode . env . openExternal (
807+ await vscode . env . asExternalUri ( ( await this . convertToDocumentationUri ( file ) ) ?? file ) ,
808+ ) ;
809+ break ;
810+ case "externalFile" :
811+ await vscode . env . openExternal ( file ) ;
812+ break ;
813+ }
814+ }
815+
797816 public async convertToDocumentationUri (
798817 uri : vscode . Uri ,
799818 token ?: vscode . CancellationToken | undefined ,
You can’t perform that action at this time.
0 commit comments