File tree 4 files changed +42
-6
lines changed
4 files changed +42
-6
lines changed Original file line number Diff line number Diff line change 757
757
"default" : " none" ,
758
758
"description" : " Defines if the report or log file should be opened after a run." ,
759
759
"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"
760
776
}
761
777
}
762
778
},
1943
1959
"workspaces" : [
1944
1960
" docs"
1945
1961
]
1946
- }
1962
+ }
Original file line number Diff line number Diff line change @@ -612,10 +612,11 @@ export class DebugManager {
612
612
logFile ?: string ,
613
613
reportFile ?: string ,
614
614
) : 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 ) ) ;
619
620
}
620
621
}
621
622
}
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
116
116
return [ ] ;
117
117
} ,
118
118
async handleTerminalLink ( link : TerminalLink ) {
119
- await languageClientManger . openUriInDocumentationView ( vscode . Uri . file ( link . path ) ) ;
119
+ await languageClientManger . openOutputFile ( vscode . Uri . file ( link . path ) ) ;
120
120
} ,
121
121
} ) ,
122
122
Original file line number Diff line number Diff line change @@ -794,6 +794,25 @@ export class LanguageClientsManager {
794
794
}
795
795
}
796
796
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
+
797
816
public async convertToDocumentationUri (
798
817
uri : vscode . Uri ,
799
818
token ?: vscode . CancellationToken | undefined ,
You can’t perform that action at this time.
0 commit comments