Skip to content

Commit 894a283

Browse files
committed
use 'open' package to open reports externally
1 parent c733c58 commit 894a283

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@
493493
"ms-python.python"
494494
],
495495
"dependencies": {
496+
"open": "^8.2.0",
496497
"vscode-debugadapter": "^1.47.0",
497498
"vscode-debugprotocol": "^1.47.0",
498499
"vscode-languageclient": "^7.0.0",
@@ -501,7 +502,7 @@
501502
"devDependencies": {
502503
"@types/glob": "^7.1.3",
503504
"@types/mocha": "^8.2.2",
504-
"@types/node": "^15.12.2",
505+
"@types/node": "^15.12.2",
505506
"@types/vscode": "^1.56.0",
506507
"@typescript-eslint/eslint-plugin": "^4.26.1",
507508
"@typescript-eslint/parser": "^4.26.1",

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
"rootDir": "vscode-client",
1616
"strict": true,
1717
"experimentalDecorators": true,
18-
"allowSyntheticDefaultImports": true,
18+
//"esModuleInterop": true,
19+
//"allowSyntheticDefaultImports": true,
1920
"noImplicitAny": true,
2021
"noImplicitThis": true,
2122
"noUnusedLocals": true,
2223
//"noUnusedParameters": true,
2324
"noFallthroughCasesInSwitch": true,
2425
"resolveJsonModule": true,
2526
"removeComments": true,
26-
"noImplicitReturns": true,
27+
"noImplicitReturns": true,
2728
},
2829
"exclude": [
2930
"node_modules",

vscode-client/extension.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from "path";
33
import * as vscode from "vscode";
44
import { LanguageClient, LanguageClientOptions, ServerOptions } from "vscode-languageclient/node";
55
import { sleep, Mutex } from "./utils";
6+
import openExternal = require("open");
67

78
const LANGUAGE_SERVER_DEFAULT_TCP_PORT = 6610;
89
const LANGUAGE_SERVER_DEFAULT_HOST = "127.0.0.1";
@@ -45,7 +46,6 @@ let clientsMutex = new Mutex();
4546
let clients: Map<string, LanguageClient> = new Map();
4647

4748
async function updateLoadedDocumentClients(uri?: vscode.Uri | undefined) {
48-
OUTPUT_CHANNEL.appendLine("initialze/restart all needed language clients.");
4949
await clientsMutex.dispatch(async () => {
5050
for (let client of clients.values()) {
5151
await client.stop().catch((_) => {});
@@ -481,6 +481,10 @@ async function attachPython(session: vscode.DebugSession, event: string, options
481481
}
482482
}
483483

484+
async function openReport(file: string) {
485+
await openExternal(file);
486+
}
487+
484488
async function onRobotExited(session: vscode.DebugSession, outputFile?: string, logFile?: string, reportFile?: string) {
485489
if (reportFile) {
486490
let config = vscode.workspace.getConfiguration(CONFIG_SECTION, session.workspaceFolder);
@@ -489,7 +493,7 @@ async function onRobotExited(session: vscode.DebugSession, outputFile?: string,
489493
case "disabled":
490494
return;
491495
case "external":
492-
vscode.env.openExternal(vscode.Uri.file(reportFile));
496+
openReport(reportFile);
493497
}
494498
}
495499
}
@@ -642,13 +646,13 @@ export async function activateAsync(context: vscode.ExtensionContext) {
642646

643647
switch (config.get<string>("run.openReportAfterRun")) {
644648
default:
645-
vscode.env.openExternal(vscode.Uri.file(link.path));
649+
openReport(link.path);
646650
break;
647651
}
648652
},
649653
}),
650654

651-
vscode.workspace.onDidChangeConfiguration((event) => {
655+
vscode.workspace.onDidChangeConfiguration(async (event) => {
652656
for (let s of [
653657
"robotcode.python",
654658
"robotcode.languageServer.mode",
@@ -662,7 +666,7 @@ export async function activateAsync(context: vscode.ExtensionContext) {
662666
"robotcode.robot.args",
663667
]) {
664668
if (event.affectsConfiguration(s)) {
665-
vscode.window
669+
await vscode.window
666670
.showWarningMessage(
667671
'Please use the "Reload Window" action for changes in ' + s + " to take effect.",
668672
...["Reload Window"]

0 commit comments

Comments
 (0)