From b98c544a9d04130935ce6762b474997a38ac3892 Mon Sep 17 00:00:00 2001 From: Jan Dolejsi Date: Fri, 5 Jun 2020 15:04:51 +0200 Subject: [PATCH 1/6] - cleaned-up .vscodeignore - ptest test outcome indication on tree nodes not yet expanded - Val std error -> Problem - Day time resolution supported - non-refreshing plans upon planner exit - ES2019 --- .vscodeignore | 1 - CHANGELOG.md | 11 +++++++++++ package.json | 2 +- src/diagnostics/PlanValidator.ts | 16 +++++++++++++--- src/init/OverviewPage.ts | 2 +- src/planning/PlannerAsyncService.ts | 4 ++++ src/planning/planning.ts | 6 ++++-- src/ptest/PTestExplorer.ts | 2 +- src/ptest/PTestTreeDataProvider.ts | 9 +++++++-- tsconfig.json | 6 ++++-- views/searchview/search.js | 2 +- 11 files changed, 47 insertions(+), 14 deletions(-) diff --git a/.vscodeignore b/.vscodeignore index c2bb1f9f..5bbdc444 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -8,7 +8,6 @@ src/** tsconfig.json *.cmd .vscode-test/** -val/** .vscodeignore package-lock.json .eslintrc.js diff --git a/CHANGELOG.md b/CHANGELOG.md index e07a379e..cbc1843d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # PDDL support - What's new? +## 2.17.4 + +- Fixed bug, where the test results/outcomes were not being displayed on the tree, if the tree was first-time-expanded _during_ the execution of the tests. +- Fixed regression on the visual search debugger related to selection of nodes on the tree. +- Fixed response to failing plan validation. Instead of opening the _Problems_ pane, we open the _Output_ pane, where the detailed VAL output is printed. +- Val std-error stream is also now presented in the _Problems_ pane. +- Small fix for the Overview Page, when it is closed before the current configuration is posted to it. +- Support for DAY (and WEEK) time resolution in plans. +- To minimize the refresh of plan visualization, the plans are _no longer_ re-painted when upon the planner exit. +- Step up to target ES2019 + ## 2.17.3 Escaping spaces in VAL paths on MacOS. diff --git a/package.json b/package.json index b74dc1e5..90a43756 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Planning Domain Description Language support", "author": "Jan Dolejsi", "license": "MIT", - "version": "2.17.3", + "version": "2.17.4", "publisher": "jan-dolejsi", "engines": { "vscode": "^1.44.0", diff --git a/src/diagnostics/PlanValidator.ts b/src/diagnostics/PlanValidator.ts index fecf2d2e..aa5d94fa 100644 --- a/src/diagnostics/PlanValidator.ts +++ b/src/diagnostics/PlanValidator.ts @@ -59,7 +59,8 @@ export class PlanValidator { try { const outcome = await this.validatePlanDocument(planDocument); if (outcome.getError()) { - commands.executeCommand('workbench.actions.view.problems'); + // do not open the _Problems_ pane, unless you can direct the error there + // commands.executeCommand('workbench.actions.view.problems'); throw new Error(outcome.getError()); } } catch (ex) { @@ -157,7 +158,7 @@ export class PlanValidator { this.output.appendLine(child.stderr.toString()); } - outcome = this.analyzeOutput(planInfo, child.error, output); + outcome = this.analyzeOutput(planInfo, child.stderr.toString(), child.error, output); onSuccess(outcome.getDiagnostics()); } @@ -185,7 +186,7 @@ export class PlanValidator { return "."; } - analyzeOutput(planInfo: PlanInfo, error: Error | undefined, output: string): PlanValidationOutcome { + analyzeOutput(planInfo: PlanInfo, stderr: string, error: Error | undefined, output: string): PlanValidationOutcome { if (error) { return PlanValidationOutcome.failed(planInfo, error); } @@ -212,6 +213,10 @@ export class PlanValidator { return PlanValidationOutcome.valid(planInfo); } + if (stderr?.trim()) { + return PlanValidationOutcome.otherError(planInfo, stderr.trim()); + } + return PlanValidationOutcome.unknown(planInfo); } @@ -319,6 +324,11 @@ class PlanValidationOutcome { return new PlanValidationOutcome(planInfo, diagnostics); } + static otherError(planInfo: PlanInfo, error: string): PlanValidationOutcome { + const diagnostics = [new Diagnostic(createRangeFromLine(0), `${error}. Run the 'PDDL: Validate plan' command for more information.`, DiagnosticSeverity.Error)]; + return new PlanValidationOutcome(planInfo, diagnostics, error); + } + static unknown(planInfo: PlanInfo): PlanValidationOutcome { const diagnostics = [new Diagnostic(createRangeFromLine(0), "Unknown error. Run the 'PDDL: Validate plan' command for more information.", DiagnosticSeverity.Warning)]; return new PlanValidationOutcome(planInfo, diagnostics, "Unknown error."); diff --git a/src/init/OverviewPage.ts b/src/init/OverviewPage.ts index bc3eb8e4..4a4bd8b1 100644 --- a/src/init/OverviewPage.ts +++ b/src/init/OverviewPage.ts @@ -325,7 +325,7 @@ export class OverviewPage { updateValAlert: await this.val.isNewValVersionAvailable() // todo: workbench.editor.revealIfOpen }; - return this.webViewPanel.webview.postMessage(message); + return this.webViewPanel.webview?.postMessage(message) ?? false; } private toWireWorkspaceFolder(workspaceFolder: WorkspaceFolder): WireWorkspaceFolder { diff --git a/src/planning/PlannerAsyncService.ts b/src/planning/PlannerAsyncService.ts index 0ab41400..33b69923 100644 --- a/src/planning/PlannerAsyncService.ts +++ b/src/planning/PlannerAsyncService.ts @@ -66,6 +66,10 @@ export class PlannerAsyncService extends PlannerService { return 1 / 1000; case "HOUR": return 60 * 60; + case "DAY": + return 24 * 60 * 60; + case "WEEK": + return 7 * 24 * 60 * 60; case "SECOND": default: return 1; diff --git a/src/planning/planning.ts b/src/planning/planning.ts index 269f8145..73779f8a 100644 --- a/src/planning/planning.ts +++ b/src/planning/planning.ts @@ -484,8 +484,10 @@ export class Planning implements planner.PlannerResponseHandler { } visualizePlans(plans: Plan[]): void { - this.plans = plans; - this.planView.setPlannerOutput(plans, !this.isSearchDebugger()); + if (this.plans !== plans) { + this.plans = plans; + this.planView.setPlannerOutput(plans, !this.isSearchDebugger()); + } } static q(path: string): string { diff --git a/src/ptest/PTestExplorer.ts b/src/ptest/PTestExplorer.ts index b277d95f..6fa13ffd 100644 --- a/src/ptest/PTestExplorer.ts +++ b/src/ptest/PTestExplorer.ts @@ -63,7 +63,7 @@ export class PTestExplorer { this.subscribe(instrumentOperationAsVsCodeCommand('pddl.tests.problemSaveAs', () => this.saveProblemAs().catch(showError))); this.subscribe(instrumentOperationAsVsCodeCommand(PTEST_REVEAL, nodeUri => - this.pTestViewer.reveal(this.pTestTreeDataProvider.findNodeByResource(nodeUri), { select: true, expand: true })) + this.pTestViewer.reveal(this.pTestTreeDataProvider.findNodeByResourceOrThrow(nodeUri), { select: true, expand: true }).then(() => { return; }, showError)) ); this.manifestGenerator = new ManifestGenerator(this.codePddlWorkspace.pddlWorkspace, this.context); diff --git a/src/ptest/PTestTreeDataProvider.ts b/src/ptest/PTestTreeDataProvider.ts index 3505e610..aa75a586 100644 --- a/src/ptest/PTestTreeDataProvider.ts +++ b/src/ptest/PTestTreeDataProvider.ts @@ -48,11 +48,16 @@ export class PTestTreeDataProvider implements TreeDataProvider { setTestOutcome(test: Test, testOutcome: TestOutcome): void { this.testResults.set(test.getUriOrThrow().toString(), testOutcome); const node = this.findNodeByResource(test.getUriOrThrow()); - this._onDidChange.fire(node); + // the node may not exist, if the tree hasn't been expanded yet + node && this._onDidChange.fire(node); + } + + findNodeByResourceOrThrow(resource: Uri): PTestNode { + return assertDefined(this.findNodeByResourceOrThrow(resource), `No node for ${resource.toString()}`); } findNodeByResource(resource: Uri): PTestNode { - return assertDefined(this.treeNodeCache.get(resource.toString()), `No node for ${resource.toString()}`); + return this.treeNodeCache.get(resource.toString()); } cache(node: PTestNode): PTestNode { diff --git a/tsconfig.json b/tsconfig.json index 31780d43..e49cc1d3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,13 +5,15 @@ "noUnusedParameters": true, "noImplicitAny": true, "noImplicitReturns": true, - "target": "es6", + "target": "ES2019", + "lib": [ + "es2019" + ], "module": "commonjs", "moduleResolution": "node", "forceConsistentCasingInFileNames": true, "rootDir": "src", "outDir": "out", - "lib": [ "es6" ], "sourceMap": true }, "exclude": [ diff --git a/views/searchview/search.js b/views/searchview/search.js index 968d886f..8dbd2553 100644 --- a/views/searchview/search.js +++ b/views/searchview/search.js @@ -333,7 +333,7 @@ shapeMap['e'] = 'ellipse'; function navigate(e) { e = e || window.event; /** @type{number | undefined} */ - const newSelectedStateId = undefined; + let newSelectedStateId = undefined; switch (e.key) { case "ArrowLeft": newSelectedStateId = e.shiftKey ? navigateChart(-1) : navigateTreeSiblings(-1); From 27990f613539ee7c5a9da4c63aad4121b4dc6b56 Mon Sep 17 00:00:00 2001 From: Jan Dolejsi Date: Fri, 5 Jun 2020 15:08:34 +0200 Subject: [PATCH 2/6] v2.17.4 --- package-lock.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4032c64f..3b6d39da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pddl", - "version": "2.17.3", + "version": "2.17.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -690,7 +690,7 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/balanced-match/-/balanced-match-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "bcrypt-pbkdf": { @@ -947,7 +947,7 @@ }, "color-name": { "version": "1.1.3", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/color-name/-/color-name-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, @@ -966,7 +966,7 @@ }, "concat-map": { "version": "0.0.1", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/concat-map/-/concat-map-0.0.1.tgz", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "content-disposition": { @@ -1281,7 +1281,7 @@ }, "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, @@ -1687,7 +1687,7 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/fs.realpath/-/fs.realpath-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { @@ -1788,7 +1788,7 @@ }, "has-flag": { "version": "3.0.0", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/has-flag/-/has-flag-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, @@ -1920,7 +1920,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/inflight/-/inflight-1.0.6.tgz", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { "once": "^1.3.0", @@ -1929,7 +1929,7 @@ }, "inherits": { "version": "2.0.3", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/inherits/-/inherits-2.0.3.tgz", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "inquirer": { @@ -2528,7 +2528,7 @@ }, "once": { "version": "1.4.0", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/once/-/once-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { "wrappy": "1" @@ -2669,7 +2669,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-key": { @@ -2998,7 +2998,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -3502,7 +3502,7 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/wrappy/-/wrappy-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { From 8ebec21c196a496832bb73afc2b319918a4e075a Mon Sep 17 00:00:00 2001 From: Jan Dolejsi Date: Wed, 17 Jun 2020 13:25:26 +0200 Subject: [PATCH 3/6] - auto completion for (:constraints ) includes the nested (and ), which I always forget --- src/completion/AbstractCompletionItemProvider.ts | 2 +- src/completion/DomainCompletionItemProvider.ts | 2 +- src/completion/ProblemCompletionItemProvider.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/completion/AbstractCompletionItemProvider.ts b/src/completion/AbstractCompletionItemProvider.ts index 8c4a05a6..190d3d38 100644 --- a/src/completion/AbstractCompletionItemProvider.ts +++ b/src/completion/AbstractCompletionItemProvider.ts @@ -59,7 +59,7 @@ export class AbstractCompletionItemProvider { } protected addConstraintsDocumentation(): void { - this.addSuggestionDocumentation(':constraints', 'Constraints', 'Constraints.... you may want to stay away from those.'); + this.addSuggestionDocumentation(':constraints', 'Constraints', 'Constraints that all plans must satisfy.'); } protected addRequirementsDocumentation(): void { diff --git a/src/completion/DomainCompletionItemProvider.ts b/src/completion/DomainCompletionItemProvider.ts index a75a5c0e..48c105b7 100644 --- a/src/completion/DomainCompletionItemProvider.ts +++ b/src/completion/DomainCompletionItemProvider.ts @@ -190,7 +190,7 @@ export class DomainCompletionItemProvider extends AbstractCompletionItemProvider case parser.PddlStructure.PREDICATES: case parser.PddlStructure.FUNCTIONS: case parser.PddlStructure.CONSTRAINTS: - return this.createSnippetCompletionItem(suggestion, "(" + suggestion.sectionName + " \n\t$0\n)", range, context, index); + return this.createSnippetCompletionItem(suggestion, "(" + suggestion.sectionName + " (and\n\t$0\n))", range, context, index); case parser.PddlStructure.ACTION: return this.createSnippetCompletionItem(suggestion, ["(:action ${1:action_name}", diff --git a/src/completion/ProblemCompletionItemProvider.ts b/src/completion/ProblemCompletionItemProvider.ts index d7a38f19..3fe63c51 100644 --- a/src/completion/ProblemCompletionItemProvider.ts +++ b/src/completion/ProblemCompletionItemProvider.ts @@ -92,7 +92,7 @@ export class ProblemCompletionItemProvider extends AbstractCompletionItemProvide case parser.PddlStructure.OBJECTS: case parser.PddlStructure.INIT: case parser.PddlStructure.CONSTRAINTS: - return this.createSnippetCompletionItem(suggestion, "(" + suggestion.sectionName + " \n\t$0\n)", range, context, index); + return this.createSnippetCompletionItem(suggestion, "(" + suggestion.sectionName + " (and\n\t$0\n))", range, context, index); case parser.PddlStructure.GOAL: return this.createSnippetCompletionItem(suggestion, "(" + suggestion.sectionName + " (and\n\t$0\n))", range, context, index); case parser.PddlStructure.METRIC: From 7fef78cf8ff0b1b03453d3bd033e78c62d166ccb Mon Sep 17 00:00:00 2001 From: Jan Dolejsi Date: Wed, 17 Jun 2020 14:04:29 +0200 Subject: [PATCH 4/6] - async service call handles multiple plans and xml plan format --- src/planning/PlannerAsyncService.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/planning/PlannerAsyncService.ts b/src/planning/PlannerAsyncService.ts index 33b69923..4a3d37a8 100644 --- a/src/planning/PlannerAsyncService.ts +++ b/src/planning/PlannerAsyncService.ts @@ -77,7 +77,7 @@ export class PlannerAsyncService extends PlannerService { } // eslint-disable-next-line @typescript-eslint/no-explicit-any - processServerResponseBody(responseBody: any, planParser: parser.PddlPlannerOutputParser, callbacks: planner.PlannerResponseHandler, resolve: (plans: Plan[]) => void, reject: (error: Error) => void): void { + async processServerResponseBody(responseBody: any, planParser: parser.PddlPlannerOutputParser, callbacks: planner.PlannerResponseHandler, resolve: (plans: Plan[]) => void, reject: (error: Error) => void): Promise { let _timedOut = false; const responseStatus: string = responseBody['status']['status']; if (["STOPPED", "SEARCHING_BETTER_PLAN"].includes(responseStatus)) { @@ -86,15 +86,20 @@ export class PlannerAsyncService extends PlannerService { const plansJson = responseBody['plans']; try { // eslint-disable-next-line @typescript-eslint/no-explicit-any - plansJson.forEach((plan: any) => this.parsePlan(plan, planParser)); + const parserPromises = plansJson.map((plan: any) => this.parsePlan(plan, planParser)); + await Promise.all(parserPromises); } catch (err) { reject(err); } const plans = planParser.getPlans(); - if (plans.length > 0) { callbacks.handleOutput(plans[0].getText() + '\n'); } - else { callbacks.handleOutput('No plan found.'); } + if (plans.length > 0) { + callbacks.handleOutput(plans[0].getText() + '\n'); + } + else { + callbacks.handleOutput('No plan found.'); + } resolve(plans); return; @@ -121,7 +126,7 @@ export class PlannerAsyncService extends PlannerService { } // eslint-disable-next-line @typescript-eslint/no-explicit-any - parsePlan(plan: any, planParser: parser.PddlPlannerOutputParser): void { + async parsePlan(plan: any, planParser: parser.PddlPlannerOutputParser): Promise { const makespan: number = plan['makespan']; const metric: number = plan['metricValue']; const searchPerformanceInfo = plan['searchPerformanceInfo']; @@ -131,19 +136,19 @@ export class PlannerAsyncService extends PlannerService { planParser.setPlanMetaData(makespan, metric, statesEvaluated, elapsedTimeInSeconds, this.planTimeScale); const planFormat: string | undefined = plan['format']; - if (planFormat && planFormat.toLowerCase() === 'json') { + if (planFormat?.toLowerCase() === 'json') { const planSteps = JSON.parse(plan['content']); this.parsePlanSteps(planSteps, planParser); planParser.onPlanFinished(); } - else if (planFormat && planFormat.toLowerCase() === 'tasks') { + else if (planFormat?.toLowerCase() === 'tasks') { const planText = plan['content']; planParser.appendLine(planText); planParser.onPlanFinished(); } - else if (planFormat && planFormat.toLowerCase() === 'xplan') { + else if (planFormat?.toLowerCase() === 'xplan') { const planText = plan['content']; - planParser.appendLine(planText); // the underlying + await planParser.appendXplan(planText); // must await the underlying async xml parsing } else { throw new Error('Unsupported plan format: ' + planFormat); From 022c6fe6e4b4e88afa6c5a7a10774e959d96a5b3 Mon Sep 17 00:00:00 2001 From: Jan Dolejsi Date: Wed, 17 Jun 2020 14:06:02 +0200 Subject: [PATCH 5/6] plan metric line plots --- src/planning/PlanReportGenerator.ts | 18 +++++++++++++++++- views/planview/charts.js | 6 ++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/planning/PlanReportGenerator.ts b/src/planning/PlanReportGenerator.ts index 95cd0eab..16444e37 100644 --- a/src/planning/PlanReportGenerator.ts +++ b/src/planning/PlanReportGenerator.ts @@ -200,11 +200,23 @@ ${objectsHtml} functionValues.forEach((values, liftedVariable) => { const chartDivId = `chart_${planIndex}_${liftedVariable.declaredName}`; - lineCharts += `
\n`; + lineCharts += this.createLineChartDiv(chartDivId); let chartTitleWithUnit = values.legend.length > 1 ? liftedVariable.name : liftedVariable.getFullName(); if (liftedVariable.getUnit()) { chartTitleWithUnit += ` [${liftedVariable.getUnit()}]`; } lineChartScripts += ` drawChart('${chartDivId}', '${chartTitleWithUnit}', '', ${JSON.stringify(values.legend)}, ${JSON.stringify(values.values)}, ${this.options.displayWidth});\n`; }); + + // add one plot for declared metric + for (let metricIndex = 0; metricIndex < plan.problem.getMetrics().length; metricIndex++) { + const metric = plan.problem.getMetrics()[metricIndex]; + + const metricValues = await evaluator.evaluateExpression(metric.getExpression()); + const chartDivId = `chart_${planIndex}_metric${metricIndex}`; + lineCharts += this.createLineChartDiv(chartDivId); + const chartTitleWithUnit = metric.getDocumentation()[metric.getDocumentation().length - 1]; + lineChartScripts += ` drawChart('${chartDivId}', '${chartTitleWithUnit}', '', ['${/*unit?*/""}'], ${JSON.stringify(metricValues.values)}, ${this.options.displayWidth});\n`; + } + } catch (err) { console.error(err); const valStepPath = evaluator.getValStepPath(); @@ -228,6 +240,10 @@ ${lineCharts} `; } + private createLineChartDiv(chartDivId: string): string { + return `
\n`; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any private async handleValStepError(err: any, valStepPath: string): Promise { if (err instanceof ValStepError) { diff --git a/views/planview/charts.js b/views/planview/charts.js index bc07270a..866771b7 100644 --- a/views/planview/charts.js +++ b/views/planview/charts.js @@ -17,7 +17,8 @@ function drawChart(chartDivId, functionName, unit, objects, columnData) { title: 'Time' }, vAxis: { - title: unit + title: unit, + scaleType: 'linear' //vAxisScaleType = 'log' }, interpolateNulls: true, title: functionName @@ -46,7 +47,8 @@ function drawChartMultipleSeries(chartDivId, functionName, unit, objects, column title: 'Time' }, vAxis: { - title: unit + title: unit, + scaleType: 'linear' //vAxisScaleType = 'log' }, interpolateNulls: true, title: functionName From 54b31a917a52ccd87e551056457db1caea5f25a1 Mon Sep 17 00:00:00 2001 From: Jan Dolejsi Date: Wed, 17 Jun 2020 14:06:29 +0200 Subject: [PATCH 6/6] v2.18 --- CHANGELOG.md | 29 ++++++++++++++++++++++++----- README.md | 9 +++++++++ package-lock.json | 40 ++++++++++++++++++++-------------------- package.json | 6 +++--- 4 files changed, 56 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbc1843d..25e0f4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,32 @@ # PDDL support - What's new? -## 2.17.4 +## 2.18.0 + +### Features + +### Line plots for multiple metric expressions + +If your planner supports multiple `(:metric ...)` expressions in the problem file (VAL actually does), +you can use it to get some ad-hoc expressions displayed on a line plot below the plan. +This is very useful, to debug numerically-rich domains. + +![Plan metric plots](https://raw.githubusercontent.com/wiki/jan-dolejsi/vscode-pddl/img/plan_metric_plots.jpg) + +### Other improvements + +- Auto completion for (:constraints ) includes the nested (and ), which I always forget +- Val std-error stream is also now presented in the _Problems_ pane. +- Support for DAY (and WEEK) time resolution in plans. +- To minimize the refresh of plan visualization, the plans are _no longer_ re-painted when upon the planner exit. + +### Fixes - Fixed bug, where the test results/outcomes were not being displayed on the tree, if the tree was first-time-expanded _during_ the execution of the tests. - Fixed regression on the visual search debugger related to selection of nodes on the tree. - Fixed response to failing plan validation. Instead of opening the _Problems_ pane, we open the _Output_ pane, where the detailed VAL output is printed. -- Val std-error stream is also now presented in the _Problems_ pane. - Small fix for the Overview Page, when it is closed before the current configuration is posted to it. -- Support for DAY (and WEEK) time resolution in plans. -- To minimize the refresh of plan visualization, the plans are _no longer_ re-painted when upon the planner exit. +- Async service call handles multiple plans and xml plan format +- Fixed bug that caused the extension to hang in an endless loop, while resolving a PDDL symbol references (while hover-over) - Step up to target ES2019 ## 2.17.3 @@ -1019,7 +1037,8 @@ Note for open source contributors: all notable changes to the "pddl" extension w Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. -[Unreleased]: https://github.com/jan-dolejsi/vscode-pddl/compare/v2.17.1...HEAD +[Unreleased]: https://github.com/jan-dolejsi/vscode-pddl/compare/v2.18.0...HEAD +[2.16.0]:https://github.com/jan-dolejsi/vscode-pddl/compare/v2.17.1...v2.18.0 [2.16.0]:https://github.com/jan-dolejsi/vscode-pddl/compare/v2.16.0...v2.17.1 [2.15.7]:https://github.com/jan-dolejsi/vscode-pddl/compare/v2.15.7...v2.16.0 [2.15.7]:https://github.com/jan-dolejsi/vscode-pddl/compare/v2.15.6...v2.15.7 diff --git a/README.md b/README.md index 3e0015e6..c3e0f327 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,15 @@ If one of the rules above is not satisfied, the editor will not naturally associ ![domain/problem/plann associations](https://raw.githubusercontent.com/wiki/jan-dolejsi/vscode-pddl/img/PDDL_explicit_domain-problem-plan_associations.gif) +#### Line plots for multiple metric expressions + +If your planner supports multiple `(:metric ...)` expressions in the problem file (VAL actually does), +you can use it to get some ad-hoc expressions displayed on a line plot below the plan. +This is very useful, to debug numerically-rich domains. + +![Plan metric plots](https://raw.githubusercontent.com/wiki/jan-dolejsi/vscode-pddl/img/plan_metric_plots.jpg) + + #### Running the planner interactively See configuration setting `pddlPlanner.executionTarget` to select where is the planner executable started. You can either direct planner executable output to a _Terminal_ window instead of the _Output window_. This can be configured on the _Overview page_. diff --git a/package-lock.json b/package-lock.json index 3b6d39da..70c4f879 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "pddl", - "version": "2.17.4", + "version": "2.18.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -373,13 +373,13 @@ } }, "ai-planning-val": { - "version": "2.1.7", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/ai-planning-val/-/ai-planning-val-2.1.7.tgz", - "integrity": "sha1-PqsAKrmM0r3c69kyqdcZUVkkfQY=", + "version": "2.2.0", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/ai-planning-val/-/ai-planning-val-2.2.0.tgz", + "integrity": "sha1-ibs9vB7N2GUtKDpDrgsQBwj7GKE=", "requires": { "adm-zip": "^0.4.14", "events": "^3.1.0", - "pddl-workspace": "^3.0.0", + "pddl-workspace": "^3.2.0", "request": "^2.88.2", "yargs": "^15.3.1" }, @@ -690,7 +690,7 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "bcrypt-pbkdf": { @@ -947,7 +947,7 @@ }, "color-name": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, @@ -966,7 +966,7 @@ }, "concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "content-disposition": { @@ -1281,7 +1281,7 @@ }, "escape-string-regexp": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, @@ -1687,7 +1687,7 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { @@ -1788,7 +1788,7 @@ }, "has-flag": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, @@ -1920,7 +1920,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { "once": "^1.3.0", @@ -1929,7 +1929,7 @@ }, "inherits": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "inquirer": { @@ -2528,7 +2528,7 @@ }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { "wrappy": "1" @@ -2669,7 +2669,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-key": { @@ -2690,9 +2690,9 @@ "dev": true }, "pddl-workspace": { - "version": "3.1.0", - "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/pddl-workspace/-/pddl-workspace-3.1.0.tgz", - "integrity": "sha1-sAq/YG9Aa2zgzjkuQ6uA/oBUUOY=", + "version": "3.2.0", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/pddl-workspace/-/pddl-workspace-3.2.0.tgz", + "integrity": "sha1-3Fg7GMJwECRfGTVpPH4QxDzeVrc=", "requires": { "nunjucks": "^3.2.0", "parse-xsd-duration": "^0.5.0", @@ -2998,7 +2998,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, @@ -3502,7 +3502,7 @@ }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "resolved": "https://pkgs.dev.azure.com/slb-swt/_packaging/ai-planning/npm/registry/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write": { diff --git a/package.json b/package.json index 90a43756..f948395d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Planning Domain Description Language support", "author": "Jan Dolejsi", "license": "MIT", - "version": "2.17.4", + "version": "2.18.0", "publisher": "jan-dolejsi", "engines": { "vscode": "^1.44.0", @@ -973,14 +973,14 @@ "test": "npm run test:unit && npm run test:integration" }, "dependencies": { - "ai-planning-val": "^2.1.7", + "ai-planning-val": "^2.2.0", "await-notify": "^1.0.1", "body-parser": "^1.19.0", "events": "^3.1.0", "express": "^4.17.1", "jsonc-parser": "^2.2.1", "open": "^7.0.2", - "pddl-workspace": "^3.1.0", + "pddl-workspace": "^3.2.0", "request": "^2.88.2", "semver": "^7.1.3", "tree-kill": "^1.2.2",