From 81f6911dd60820353d8b8b4b8975d5e93fe0f582 Mon Sep 17 00:00:00 2001 From: JordanBoltonMN Date: Thu, 8 Sep 2022 06:23:32 -0700 Subject: [PATCH] Fix semantic tokens (#161) --- package-lock.json | 4 ++-- package.json | 2 +- server/src/server.ts | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 90e7e8fe..2259b18b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-powerquery", - "version": "0.1.43", + "version": "0.1.44", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-powerquery", - "version": "0.1.43", + "version": "0.1.44", "hasInstallScript": true, "license": "MIT", "devDependencies": { diff --git a/package.json b/package.json index 0fc43eca..7d06f8aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vscode-powerquery", - "version": "0.1.43", + "version": "0.1.44", "displayName": "Power Query / M Language", "description": "Language service for the Power Query / M formula language", "author": "Microsoft Corporation", diff --git a/server/src/server.ts b/server/src/server.ts index 07f16dae..e713eca0 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -291,10 +291,13 @@ connection.onRequest("powerquery/semanticTokens", async (params: SemanticTokenPa const traceManager: PQP.Trace.TraceManager = TraceManagerUtils.createTraceManager(document.uri, "semanticTokens"); const analysis: PQLS.Analysis = createAnalysis(document, traceManager); - try { - return await analysis.getPartialSemanticTokens(pqpCancellationToken); - } catch (error) { - ErrorUtils.handleError(connection, error, "semanticTokens"); + const result: PQP.Result = + await analysis.getPartialSemanticTokens(pqpCancellationToken); + + if (PQP.ResultUtils.isOk(result)) { + return result.value ?? []; + } else { + ErrorUtils.handleError(connection, result.error, "semanticTokens"); return []; }