From 4351ad7447dcb51ddf39cbaac6e94802d1b47c9c Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Sat, 27 May 2023 23:04:07 +0200 Subject: [PATCH] add changeset --- .changeset/hip-maps-study.md | 5 +++++ packages/vscode-graphql-execution/README.md | 2 +- packages/vscode-graphql-execution/src/extension.ts | 12 ++++-------- .../src/providers/exec-content.ts | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 .changeset/hip-maps-study.md diff --git a/.changeset/hip-maps-study.md b/.changeset/hip-maps-study.md new file mode 100644 index 00000000000..03bae32e86b --- /dev/null +++ b/.changeset/hip-maps-study.md @@ -0,0 +1,5 @@ +--- +'vscode-graphql-execution': minor +--- + +`GraphQLContentProvider.getCurrentHtml` should not return `Promise` diff --git a/packages/vscode-graphql-execution/README.md b/packages/vscode-graphql-execution/README.md index 5c00f5d357a..5a0345c25ca 100644 --- a/packages/vscode-graphql-execution/README.md +++ b/packages/vscode-graphql-execution/README.md @@ -13,7 +13,7 @@ inline in your code for: the operation. 2. (If variables are specified in the operation), a dialog will prompt for these variables -3. Then, the results or network error should appear, voila! +3. Then, the results or network error should appear, voilĂ ! 4. If no endpoints are configured, it will exit early and tell you to define them. diff --git a/packages/vscode-graphql-execution/src/extension.ts b/packages/vscode-graphql-execution/src/extension.ts index f2ea4cd3d6e..9a06daea5ff 100644 --- a/packages/vscode-graphql-execution/src/extension.ts +++ b/packages/vscode-graphql-execution/src/extension.ts @@ -13,12 +13,11 @@ import { import { GraphQLContentProvider } from './providers/exec-content'; import { GraphQLCodeLensProvider } from './providers/exec-codelens'; import { ExtractedTemplateLiteral } from './helpers/source'; -// import { CustomInitializationFailedHandler } from "./CustomInitializationFailedHandler" function getConfig() { return workspace.getConfiguration( 'vscode-graphql-execution', - window.activeTextEditor ? window.activeTextEditor.document.uri : null, + window.activeTextEditor?.document.uri, ); } @@ -27,9 +26,8 @@ export function activate(context: ExtensionContext) { 'GraphQL Operation Execution', ); const config = getConfig(); - const { debug } = config; - if (debug) { + if (config.debug) { // eslint-disable-next-line no-console console.log('Extension "vscode-graphql" is now active!'); } @@ -72,7 +70,7 @@ export function activate(context: ExtensionContext) { const commandContentProvider = commands.registerCommand( 'vscode-graphql-execution.contentProvider', - async (literal: ExtractedTemplateLiteral) => { + (literal: ExtractedTemplateLiteral) => { const uri = Uri.parse('graphql://authority/graphql'); const panel = window.createWebviewPanel( @@ -93,9 +91,7 @@ export function activate(context: ExtensionContext) { contentProvider, ); context.subscriptions.push(registration); - - const html = await contentProvider.getCurrentHtml(); - panel.webview.html = html; + panel.webview.html = contentProvider.getCurrentHtml(); }, ); context.subscriptions.push(commandContentProvider); diff --git a/packages/vscode-graphql-execution/src/providers/exec-content.ts b/packages/vscode-graphql-execution/src/providers/exec-content.ts index 6bddbb3bac1..6517cd4ef61 100644 --- a/packages/vscode-graphql-execution/src/providers/exec-content.ts +++ b/packages/vscode-graphql-execution/src/providers/exec-content.ts @@ -37,7 +37,7 @@ export class GraphQLContentProvider implements TextDocumentContentProvider { timeout = (ms: number) => new Promise(res => setTimeout(res, ms)); - async getCurrentHtml(): Promise { + getCurrentHtml(): string { return this.html; }