From 25c3bfd8c4e5e74625b756cbbba54fc3add42533 Mon Sep 17 00:00:00 2001 From: Rikki Schulte Date: Sun, 28 Jan 2024 19:51:57 +0100 Subject: [PATCH 1/6] Version Packages (#3520) Co-authored-by: github-actions[bot] --- .changeset/twelve-planes-breathe.md | 7 ------- packages/vscode-graphql-execution/CHANGELOG.md | 6 ++++++ packages/vscode-graphql-execution/package.json | 2 +- packages/vscode-graphql-syntax/CHANGELOG.md | 6 ++++++ packages/vscode-graphql-syntax/package.json | 2 +- packages/vscode-graphql/CHANGELOG.md | 6 ++++++ packages/vscode-graphql/package.json | 2 +- 7 files changed, 21 insertions(+), 10 deletions(-) delete mode 100644 .changeset/twelve-planes-breathe.md diff --git a/.changeset/twelve-planes-breathe.md b/.changeset/twelve-planes-breathe.md deleted file mode 100644 index 6b72b03eb9f..00000000000 --- a/.changeset/twelve-planes-breathe.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'vscode-graphql': patch -'vscode-graphql-execution': patch -'vscode-graphql-syntax': patch ---- - -bump ovsx diff --git a/packages/vscode-graphql-execution/CHANGELOG.md b/packages/vscode-graphql-execution/CHANGELOG.md index 1c71877a1d1..f8e72dbc41d 100644 --- a/packages/vscode-graphql-execution/CHANGELOG.md +++ b/packages/vscode-graphql-execution/CHANGELOG.md @@ -1,5 +1,11 @@ # vscode-graphql-execution +## 0.2.6 + +### Patch Changes + +- [#3519](https://github.com/graphql/graphiql/pull/3519) [`8188e3e6`](https://github.com/graphql/graphiql/commit/8188e3e6fd979bcf2fbdf9568deb0c88d0df99e2) Thanks [@acao](https://github.com/acao)! - bump ovsx + ## 0.2.5 ### Patch Changes diff --git a/packages/vscode-graphql-execution/package.json b/packages/vscode-graphql-execution/package.json index c2b1a241c5a..73ef2bb2048 100644 --- a/packages/vscode-graphql-execution/package.json +++ b/packages/vscode-graphql-execution/package.json @@ -1,6 +1,6 @@ { "name": "vscode-graphql-execution", - "version": "0.2.5", + "version": "0.2.6", "displayName": "GraphQL: Inline Operation Execution", "description": "Execute graphql operations from your code (revived!)", "publisher": "GraphQL", diff --git a/packages/vscode-graphql-syntax/CHANGELOG.md b/packages/vscode-graphql-syntax/CHANGELOG.md index 596aff4e18b..b01e280603c 100644 --- a/packages/vscode-graphql-syntax/CHANGELOG.md +++ b/packages/vscode-graphql-syntax/CHANGELOG.md @@ -1,5 +1,11 @@ # vscode-graphql-syntax +## 1.3.1 + +### Patch Changes + +- [#3519](https://github.com/graphql/graphiql/pull/3519) [`8188e3e6`](https://github.com/graphql/graphiql/commit/8188e3e6fd979bcf2fbdf9568deb0c88d0df99e2) Thanks [@acao](https://github.com/acao)! - bump ovsx + ## 1.3.0 ### Minor Changes diff --git a/packages/vscode-graphql-syntax/package.json b/packages/vscode-graphql-syntax/package.json index e1ebbb73931..035c69b6bbe 100644 --- a/packages/vscode-graphql-syntax/package.json +++ b/packages/vscode-graphql-syntax/package.json @@ -1,6 +1,6 @@ { "name": "vscode-graphql-syntax", - "version": "1.3.0", + "version": "1.3.1", "displayName": "GraphQL: Syntax Highlighting", "description": "Adds syntax highlighting support for .graphql & embedded support for javascript, typescript, vue, markdown, python, php, reason, ocaml and rescript", "publisher": "GraphQL", diff --git a/packages/vscode-graphql/CHANGELOG.md b/packages/vscode-graphql/CHANGELOG.md index 21a641def43..2fe42c7f9e0 100644 --- a/packages/vscode-graphql/CHANGELOG.md +++ b/packages/vscode-graphql/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 0.9.1 + +### Patch Changes + +- [#3519](https://github.com/graphql/graphiql/pull/3519) [`8188e3e6`](https://github.com/graphql/graphiql/commit/8188e3e6fd979bcf2fbdf9568deb0c88d0df99e2) Thanks [@acao](https://github.com/acao)! - bump ovsx + ## 0.9.0 ### Minor Changes diff --git a/packages/vscode-graphql/package.json b/packages/vscode-graphql/package.json index 590aef515c2..382e28b2a35 100644 --- a/packages/vscode-graphql/package.json +++ b/packages/vscode-graphql/package.json @@ -1,6 +1,6 @@ { "name": "vscode-graphql", - "version": "0.9.0", + "version": "0.9.1", "private": true, "license": "MIT", "displayName": "GraphQL: Language Feature Support", From 88d76cabe57aa99f89f569cb2787e2f06e0ab9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Bour=C3=A9?= Date: Thu, 1 Feb 2024 23:26:15 +0100 Subject: [PATCH 2/6] fix: Do not override existing json diagnostic schemas (#3523) --- .changeset/healthy-toes-grab.md | 5 +++++ packages/monaco-graphql/src/languageFeatures.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/healthy-toes-grab.md diff --git a/.changeset/healthy-toes-grab.md b/.changeset/healthy-toes-grab.md new file mode 100644 index 00000000000..fe78caacf35 --- /dev/null +++ b/.changeset/healthy-toes-grab.md @@ -0,0 +1,5 @@ +--- +'monaco-graphql': patch +--- + +Fix JSON diagnostics for multiple editors diff --git a/packages/monaco-graphql/src/languageFeatures.ts b/packages/monaco-graphql/src/languageFeatures.ts index 0dfc52d5046..66175f116b6 100644 --- a/packages/monaco-graphql/src/languageFeatures.ts +++ b/packages/monaco-graphql/src/languageFeatures.ts @@ -150,12 +150,17 @@ export class DiagnosticsAdapter { schema: jsonSchema, fileMatch: variablesUris, }; + const currentSchemas = + languages.json.jsonDefaults.diagnosticsOptions.schemas?.filter( + s => s.uri !== schemaUri, + ) || []; + // TODO: export from api somehow? languages.json.jsonDefaults.setDiagnosticsOptions({ schemaValidation: 'error', validate: true, ...this.defaults?.diagnosticSettings?.jsonDiagnosticSettings, - schemas: [configResult], + schemas: [...currentSchemas, configResult], enableSchemaRequest: false, }); } From 2b6ea3166c8d8e152f16d87c878aa8a66f1b3775 Mon Sep 17 00:00:00 2001 From: Benjie Date: Thu, 1 Feb 2024 22:28:48 +0000 Subject: [PATCH 3/6] Fix bug in Explorer plugin where characters are dropped when typing quickly (#3526) Use optimistic editor state when interfacing between explorer and GraphiQL --- .changeset/fresh-rabbits-move.md | 5 ++ .changeset/silent-spoons-shout.md | 5 ++ .../graphiql-plugin-explorer/src/index.tsx | 5 +- packages/graphiql-react/src/editor/hooks.ts | 75 ++++++++++++++++++- packages/graphiql-react/src/editor/index.ts | 1 + packages/graphiql-react/src/index.ts | 1 + 6 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 .changeset/fresh-rabbits-move.md create mode 100644 .changeset/silent-spoons-shout.md diff --git a/.changeset/fresh-rabbits-move.md b/.changeset/fresh-rabbits-move.md new file mode 100644 index 00000000000..d123b0ac769 --- /dev/null +++ b/.changeset/fresh-rabbits-move.md @@ -0,0 +1,5 @@ +--- +'@graphiql/plugin-explorer': patch +--- + +Fix bug whereby typing quickly into explorer sidebar would result in characters being dropped. diff --git a/.changeset/silent-spoons-shout.md b/.changeset/silent-spoons-shout.md new file mode 100644 index 00000000000..5c2f1ab9458 --- /dev/null +++ b/.changeset/silent-spoons-shout.md @@ -0,0 +1,5 @@ +--- +'@graphiql/react': patch +--- + +Add new `useOptimisticState` hook that can wrap a useState-like hook to perform optimistic caching of state changes, this helps to avoid losing characters when the user is typing rapidly. Example of usage: `const [state, setState] = useOptimisticState(useOperationsEditorState());` diff --git a/packages/graphiql-plugin-explorer/src/index.tsx b/packages/graphiql-plugin-explorer/src/index.tsx index 01d95386bc2..c7b4bb625fd 100644 --- a/packages/graphiql-plugin-explorer/src/index.tsx +++ b/packages/graphiql-plugin-explorer/src/index.tsx @@ -4,6 +4,7 @@ import { useExecutionContext, useSchemaContext, useOperationsEditorState, + useOptimisticState, } from '@graphiql/react'; import { Explorer as GraphiQLExplorer, @@ -139,7 +140,9 @@ function ExplorerPlugin(props: GraphiQLExplorerPluginProps) { ); // load the current editor tab state into the explorer - const [operationsString, handleEditOperations] = useOperationsEditorState(); + const [operationsString, handleEditOperations] = useOptimisticState( + useOperationsEditorState(), + ); return ( { return useEditorState('header'); }; + +/** + * Implements an optimistic caching strategy around a useState-like hook in + * order to prevent loss of updates when the hook has an internal delay and the + * update function is called again before the updated state is sent out. + * + * Use this as a wrapper around `useOperationsEditorState`, + * `useVariablesEditorState`, or `useHeadersEditorState` if you anticipate + * calling them with great frequency (due to, for instance, mouse, keyboard, or + * network events). + * + * Example: + * + * ```ts + * const [operationsString, handleEditOperations] = + * useOptimisticState(useOperationsEditorState()); + * ``` + */ +export function useOptimisticState([ + upstreamState, + upstreamSetState, +]: ReturnType): ReturnType { + const lastStateRef = useRef({ + /** The last thing that we sent upstream; we're expecting this back */ + pending: null as string | null, + /** The last thing we received from upstream */ + last: upstreamState, + }); + + const [state, setOperationsText] = useState(upstreamState); + + useEffect(() => { + if (lastStateRef.current.last === upstreamState) { + // No change; ignore + } else { + lastStateRef.current.last = upstreamState; + if (lastStateRef.current.pending === null) { + // Gracefully accept update from upstream + setOperationsText(upstreamState); + } else if (lastStateRef.current.pending === upstreamState) { + // They received our update and sent it back to us - clear pending, and + // send next if appropriate + lastStateRef.current.pending = null; + if (upstreamState !== state) { + // Change has occurred; upstream it + lastStateRef.current.pending = state; + upstreamSetState(state); + } + } else { + // They got a different update; overwrite our local state (!!) + lastStateRef.current.pending = null; + setOperationsText(upstreamState); + } + } + }, [upstreamState, state, upstreamSetState]); + + const setState = useCallback( + (newState: string) => { + setOperationsText(newState); + if ( + lastStateRef.current.pending === null && + lastStateRef.current.last !== newState + ) { + // No pending updates and change has occurred... send it upstream + lastStateRef.current.pending = newState; + upstreamSetState(newState); + } + }, + [upstreamSetState], + ); + + return useMemo(() => [state, setState], [state, setState]); +} diff --git a/packages/graphiql-react/src/editor/index.ts b/packages/graphiql-react/src/editor/index.ts index 8d593fcc579..c7a902c4307 100644 --- a/packages/graphiql-react/src/editor/index.ts +++ b/packages/graphiql-react/src/editor/index.ts @@ -18,6 +18,7 @@ export { usePrettifyEditors, useEditorState, useOperationsEditorState, + useOptimisticState, useVariablesEditorState, useHeadersEditorState, } from './hooks'; diff --git a/packages/graphiql-react/src/index.ts b/packages/graphiql-react/src/index.ts index add9f53e364..d52e3bffb24 100644 --- a/packages/graphiql-react/src/index.ts +++ b/packages/graphiql-react/src/index.ts @@ -18,6 +18,7 @@ export { useVariableEditor, useEditorState, useOperationsEditorState, + useOptimisticState, useVariablesEditorState, useHeadersEditorState, VariableEditor, From 28a101fb5d94347cbfd5dbed9c86ebe46b4f184c Mon Sep 17 00:00:00 2001 From: Rikki Schulte Date: Fri, 2 Feb 2024 00:29:53 +0100 Subject: [PATCH 4/6] Version Packages (#3527) Co-authored-by: github-actions[bot] --- .changeset/fresh-rabbits-move.md | 5 ----- .changeset/healthy-toes-grab.md | 5 ----- .changeset/silent-spoons-shout.md | 5 ----- examples/graphiql-webpack/package.json | 8 ++++---- examples/monaco-graphql-nextjs/package.json | 2 +- examples/monaco-graphql-react-vite/package.json | 2 +- examples/monaco-graphql-webpack/package.json | 2 +- packages/graphiql-plugin-code-exporter/CHANGELOG.md | 7 +++++++ packages/graphiql-plugin-code-exporter/package.json | 6 +++--- packages/graphiql-plugin-explorer/CHANGELOG.md | 9 +++++++++ packages/graphiql-plugin-explorer/package.json | 6 +++--- packages/graphiql-react/CHANGELOG.md | 6 ++++++ packages/graphiql-react/package.json | 2 +- packages/graphiql/CHANGELOG.md | 7 +++++++ packages/graphiql/package.json | 4 ++-- packages/monaco-graphql/CHANGELOG.md | 6 ++++++ packages/monaco-graphql/package.json | 2 +- 17 files changed, 52 insertions(+), 32 deletions(-) delete mode 100644 .changeset/fresh-rabbits-move.md delete mode 100644 .changeset/healthy-toes-grab.md delete mode 100644 .changeset/silent-spoons-shout.md diff --git a/.changeset/fresh-rabbits-move.md b/.changeset/fresh-rabbits-move.md deleted file mode 100644 index d123b0ac769..00000000000 --- a/.changeset/fresh-rabbits-move.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@graphiql/plugin-explorer': patch ---- - -Fix bug whereby typing quickly into explorer sidebar would result in characters being dropped. diff --git a/.changeset/healthy-toes-grab.md b/.changeset/healthy-toes-grab.md deleted file mode 100644 index fe78caacf35..00000000000 --- a/.changeset/healthy-toes-grab.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'monaco-graphql': patch ---- - -Fix JSON diagnostics for multiple editors diff --git a/.changeset/silent-spoons-shout.md b/.changeset/silent-spoons-shout.md deleted file mode 100644 index 5c2f1ab9458..00000000000 --- a/.changeset/silent-spoons-shout.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@graphiql/react': patch ---- - -Add new `useOptimisticState` hook that can wrap a useState-like hook to perform optimistic caching of state changes, this helps to avoid losing characters when the user is typing rapidly. Example of usage: `const [state, setState] = useOptimisticState(useOperationsEditorState());` diff --git a/examples/graphiql-webpack/package.json b/examples/graphiql-webpack/package.json index 0b49c73a0c9..8c3bc3c25bf 100644 --- a/examples/graphiql-webpack/package.json +++ b/examples/graphiql-webpack/package.json @@ -9,11 +9,11 @@ "start": "NODE_ENV=development webpack-cli serve" }, "dependencies": { - "@graphiql/plugin-code-exporter": "^1.0.3", - "@graphiql/plugin-explorer": "^1.0.2", + "@graphiql/plugin-code-exporter": "^1.0.4", + "@graphiql/plugin-explorer": "^1.0.3", "@graphiql/toolkit": "^0.9.1", - "@graphiql/react": "^0.20.2", - "graphiql": "^3.1.0", + "@graphiql/react": "^0.20.3", + "graphiql": "^3.1.1", "graphql": "^16.8.1", "graphql-ws": "^5.5.5", "react": "^18.2.0", diff --git a/examples/monaco-graphql-nextjs/package.json b/examples/monaco-graphql-nextjs/package.json index 471572894a1..05cef35efbf 100644 --- a/examples/monaco-graphql-nextjs/package.json +++ b/examples/monaco-graphql-nextjs/package.json @@ -16,7 +16,7 @@ "marked": "^4.2.12", "monaco-editor": "^0.39.0", "monaco-editor-webpack-plugin": "^7.0.1", - "monaco-graphql": "^1.5.0", + "monaco-graphql": "^1.5.1", "next": "13.4.7", "prettier": "3.0.0-alpha.12", "react": "^18.2.0", diff --git a/examples/monaco-graphql-react-vite/package.json b/examples/monaco-graphql-react-vite/package.json index 65a1cd0f657..6d526a81da8 100644 --- a/examples/monaco-graphql-react-vite/package.json +++ b/examples/monaco-graphql-react-vite/package.json @@ -8,7 +8,7 @@ "graphql-language-service": "^5.2.0", "jsonc-parser": "^3.2.0", "monaco-editor": "^0.39.0", - "monaco-graphql": "^1.5.0", + "monaco-graphql": "^1.5.1", "prettier": "3.0.0-alpha.12", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/examples/monaco-graphql-webpack/package.json b/examples/monaco-graphql-webpack/package.json index 2a84e78f093..326e255d60e 100644 --- a/examples/monaco-graphql-webpack/package.json +++ b/examples/monaco-graphql-webpack/package.json @@ -14,7 +14,7 @@ "json-schema": "^0.4.0", "jsonc-parser": "^3.2.0", "monaco-editor": "^0.39.0", - "monaco-graphql": "^1.5.0", + "monaco-graphql": "^1.5.1", "prettier": "3.0.0-alpha.12" }, "devDependencies": { diff --git a/packages/graphiql-plugin-code-exporter/CHANGELOG.md b/packages/graphiql-plugin-code-exporter/CHANGELOG.md index fdc37bbc59e..c16e5829eee 100644 --- a/packages/graphiql-plugin-code-exporter/CHANGELOG.md +++ b/packages/graphiql-plugin-code-exporter/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphiql/plugin-code-exporter +## 1.0.4 + +### Patch Changes + +- Updated dependencies [[`2b6ea316`](https://github.com/graphql/graphiql/commit/2b6ea3166c8d8e152f16d87c878aa8a66f1b3775)]: + - @graphiql/react@0.20.3 + ## 1.0.3 ### Patch Changes diff --git a/packages/graphiql-plugin-code-exporter/package.json b/packages/graphiql-plugin-code-exporter/package.json index a2a11eeb4d5..931c3db90aa 100644 --- a/packages/graphiql-plugin-code-exporter/package.json +++ b/packages/graphiql-plugin-code-exporter/package.json @@ -1,6 +1,6 @@ { "name": "@graphiql/plugin-code-exporter", - "version": "1.0.3", + "version": "1.0.4", "repository": { "type": "git", "url": "https://github.com/graphql/graphiql", @@ -33,13 +33,13 @@ "graphiql-code-exporter": "^3.0.3" }, "peerDependencies": { - "@graphiql/react": "^0.20.2", + "@graphiql/react": "^0.20.3", "graphql": "^15.5.0 || ^16.0.0", "react": "^16.8.0 || ^17 || ^18", "react-dom": "^16.8.0 || ^17 || ^18" }, "devDependencies": { - "@graphiql/react": "^0.20.2", + "@graphiql/react": "^0.20.3", "@vitejs/plugin-react": "^4.0.1", "graphql": "^16.8.1", "postcss-nesting": "^10.1.7", diff --git a/packages/graphiql-plugin-explorer/CHANGELOG.md b/packages/graphiql-plugin-explorer/CHANGELOG.md index 1d627816c35..3060ce25c69 100644 --- a/packages/graphiql-plugin-explorer/CHANGELOG.md +++ b/packages/graphiql-plugin-explorer/CHANGELOG.md @@ -1,5 +1,14 @@ # @graphiql/plugin-explorer +## 1.0.3 + +### Patch Changes + +- [#3526](https://github.com/graphql/graphiql/pull/3526) [`2b6ea316`](https://github.com/graphql/graphiql/commit/2b6ea3166c8d8e152f16d87c878aa8a66f1b3775) Thanks [@benjie](https://github.com/benjie)! - Fix bug whereby typing quickly into explorer sidebar would result in characters being dropped. + +- Updated dependencies [[`2b6ea316`](https://github.com/graphql/graphiql/commit/2b6ea3166c8d8e152f16d87c878aa8a66f1b3775)]: + - @graphiql/react@0.20.3 + ## 1.0.2 ### Patch Changes diff --git a/packages/graphiql-plugin-explorer/package.json b/packages/graphiql-plugin-explorer/package.json index 6f1d3707e12..c2d86c8eccd 100644 --- a/packages/graphiql-plugin-explorer/package.json +++ b/packages/graphiql-plugin-explorer/package.json @@ -1,6 +1,6 @@ { "name": "@graphiql/plugin-explorer", - "version": "1.0.2", + "version": "1.0.3", "repository": { "type": "git", "url": "https://github.com/graphql/graphiql", @@ -32,13 +32,13 @@ "graphiql-explorer": "^0.9.0" }, "peerDependencies": { - "@graphiql/react": "^0.20.2", + "@graphiql/react": "^0.20.3", "graphql": "^15.5.0 || ^16.0.0", "react": "^16.8.0 || ^17 || ^18", "react-dom": "^16.8.0 || ^17 || ^18" }, "devDependencies": { - "@graphiql/react": "^0.20.2", + "@graphiql/react": "^0.20.3", "@vitejs/plugin-react": "^4.0.1", "graphql": "^16.8.1", "react": "^18.2.0", diff --git a/packages/graphiql-react/CHANGELOG.md b/packages/graphiql-react/CHANGELOG.md index 0093a254838..bb8e2d91838 100644 --- a/packages/graphiql-react/CHANGELOG.md +++ b/packages/graphiql-react/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphiql/react +## 0.20.3 + +### Patch Changes + +- [#3526](https://github.com/graphql/graphiql/pull/3526) [`2b6ea316`](https://github.com/graphql/graphiql/commit/2b6ea3166c8d8e152f16d87c878aa8a66f1b3775) Thanks [@benjie](https://github.com/benjie)! - Add new `useOptimisticState` hook that can wrap a useState-like hook to perform optimistic caching of state changes, this helps to avoid losing characters when the user is typing rapidly. Example of usage: `const [state, setState] = useOptimisticState(useOperationsEditorState());` + ## 0.20.2 ### Patch Changes diff --git a/packages/graphiql-react/package.json b/packages/graphiql-react/package.json index 6fc7c768368..7d48807a3a9 100644 --- a/packages/graphiql-react/package.json +++ b/packages/graphiql-react/package.json @@ -1,6 +1,6 @@ { "name": "@graphiql/react", - "version": "0.20.2", + "version": "0.20.3", "repository": { "type": "git", "url": "https://github.com/graphql/graphiql", diff --git a/packages/graphiql/CHANGELOG.md b/packages/graphiql/CHANGELOG.md index 3d017f7cee5..468f934005e 100644 --- a/packages/graphiql/CHANGELOG.md +++ b/packages/graphiql/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 3.1.1 + +### Patch Changes + +- Updated dependencies [[`2b6ea316`](https://github.com/graphql/graphiql/commit/2b6ea3166c8d8e152f16d87c878aa8a66f1b3775)]: + - @graphiql/react@0.20.3 + ## 3.1.0 ### Minor Changes diff --git a/packages/graphiql/package.json b/packages/graphiql/package.json index 851c9b39d38..2a06646b43b 100644 --- a/packages/graphiql/package.json +++ b/packages/graphiql/package.json @@ -1,6 +1,6 @@ { "name": "graphiql", - "version": "3.1.0", + "version": "3.1.1", "description": "An graphical interactive in-browser GraphQL IDE.", "contributors": [ "Hyohyeon Jeong ", @@ -47,7 +47,7 @@ "webpack": "webpack-cli --config resources/webpack.config.js" }, "dependencies": { - "@graphiql/react": "^0.20.2", + "@graphiql/react": "^0.20.3", "@graphiql/toolkit": "^0.9.1", "graphql-language-service": "^5.2.0", "markdown-it": "^12.2.0" diff --git a/packages/monaco-graphql/CHANGELOG.md b/packages/monaco-graphql/CHANGELOG.md index 478fab242d8..a031ae46d7c 100644 --- a/packages/monaco-graphql/CHANGELOG.md +++ b/packages/monaco-graphql/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 1.5.1 + +### Patch Changes + +- [#3523](https://github.com/graphql/graphiql/pull/3523) [`88d76cab`](https://github.com/graphql/graphiql/commit/88d76cabe57aa99f89f569cb2787e2f06e0ab9c5) Thanks [@bboure](https://github.com/bboure)! - Fix JSON diagnostics for multiple editors + ## 1.5.0 ### Minor Changes diff --git a/packages/monaco-graphql/package.json b/packages/monaco-graphql/package.json index 0793c64e222..c9b32464ba4 100644 --- a/packages/monaco-graphql/package.json +++ b/packages/monaco-graphql/package.json @@ -1,7 +1,7 @@ { "name": "monaco-graphql", "description": "full service, official monaco mode for GraphQL", - "version": "1.5.0", + "version": "1.5.1", "license": "MIT", "main": "dist/monaco.contribution.js", "module": "esm/monaco.contribution.js", From a38152ef1248a480d5cad384780f82214a84f16d Mon Sep 17 00:00:00 2001 From: Rikki Schulte Date: Sun, 4 Feb 2024 14:58:56 +0100 Subject: [PATCH 5/6] fix triple quote comment syntax (#3529) --- .changeset/angry-pots-return.md | 5 +++++ .../vscode-graphql-syntax/grammars/graphql.js.json | 12 ++++++------ .../vscode-graphql-syntax/tests/__fixtures__/test.js | 2 ++ .../tests/__snapshots__/js-grammar.spec.ts.snap | 8 ++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 .changeset/angry-pots-return.md diff --git a/.changeset/angry-pots-return.md b/.changeset/angry-pots-return.md new file mode 100644 index 00000000000..71028585afa --- /dev/null +++ b/.changeset/angry-pots-return.md @@ -0,0 +1,5 @@ +--- +'vscode-graphql-syntax': patch +--- + +fix triple double quote comment syntax by disabling inline double quote js strings for now diff --git a/packages/vscode-graphql-syntax/grammars/graphql.js.json b/packages/vscode-graphql-syntax/grammars/graphql.js.json index 6d78e1c2818..9c65649db9d 100644 --- a/packages/vscode-graphql-syntax/grammars/graphql.js.json +++ b/packages/vscode-graphql-syntax/grammars/graphql.js.json @@ -4,7 +4,7 @@ "patterns": [ { "contentName": "meta.embedded.block.graphql", - "begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental)|(/\\* GraphQL \\*/))\\s*\\(?\\s*(`|'|\")", + "begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental)|(/\\* GraphQL \\*/))\\s*\\(?\\s*(`|')", "beginCaptures": { "1": { "name": "variable.other.class.js" @@ -22,7 +22,7 @@ "name": "punctuation.definition.string.template.begin.js" } }, - "end": "(`|'|\")", + "end": "(`|')", "endCaptures": { "0": { "name": "punctuation.definition.string.template.end.js" @@ -36,7 +36,7 @@ }, { "contentName": "meta.embedded.block.graphql", - "begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental))\\s*\\(?\\s*(?:<.*>)(`|'|\")", + "begin": "\\s*+(?:(?:(Relay)\\??\\.)(QL)|(gql|graphql|graphql\\.experimental))\\s*\\(?\\s*(?:<.*>)(`|')", "beginCaptures": { "1": { "name": "variable.other.class.js" @@ -51,7 +51,7 @@ "name": "punctuation.definition.string.template.begin.js" } }, - "end": "(`|'|\")", + "end": "(`|')", "endCaptures": { "0": { "name": "punctuation.definition.string.template.end.js" @@ -66,7 +66,7 @@ { "name": "taggedTemplates", "contentName": "meta.embedded.block.graphql", - "begin": "(`|'|\")(#graphql)", + "begin": "(`|')(#graphql)", "beginCaptures": { "1": { "name": "punctuation.definition.string.template.begin.js" @@ -75,7 +75,7 @@ "name": "comment.line.graphql.js" } }, - "end": "(`|'|\")", + "end": "(`|')", "endCaptures": { "0": { "name": "punctuation.definition.string.template.end.js" diff --git a/packages/vscode-graphql-syntax/tests/__fixtures__/test.js b/packages/vscode-graphql-syntax/tests/__fixtures__/test.js index 4c74f4045fc..1112c7adbfa 100644 --- a/packages/vscode-graphql-syntax/tests/__fixtures__/test.js +++ b/packages/vscode-graphql-syntax/tests/__fixtures__/test.js @@ -29,6 +29,7 @@ const graphql = graphql` `; const graphql = graphql(` + """ this is a comment """ query { user(id: "5", name: ${variable}) { something @@ -70,6 +71,7 @@ const queryWithInlineComment = ` const queryWithLeadingComment = /* GraphQL */ ` query { + """ this is a comment """ user(id: "5", name: boolean) { something } diff --git a/packages/vscode-graphql-syntax/tests/__snapshots__/js-grammar.spec.ts.snap b/packages/vscode-graphql-syntax/tests/__snapshots__/js-grammar.spec.ts.snap index f16fc4b554a..1be3ebd280f 100644 --- a/packages/vscode-graphql-syntax/tests/__snapshots__/js-grammar.spec.ts.snap +++ b/packages/vscode-graphql-syntax/tests/__snapshots__/js-grammar.spec.ts.snap @@ -114,6 +114,10 @@ graphql | entity.name.function.tagged-template.js ( | \` | punctuation.definition.string.template.begin.js | meta.embedded.block.graphql +""" | meta.embedded.block.graphql comment.line.graphql.js punctuation.whitespace.comment.leading.graphql + this is a comment | meta.embedded.block.graphql comment.line.graphql.js +""" | meta.embedded.block.graphql comment.line.graphql.js + | meta.embedded.block.graphql query | meta.embedded.block.graphql keyword.operation.graphql | meta.embedded.block.graphql meta.selectionset.graphql { | meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql @@ -292,6 +296,10 @@ query | meta.embedded.block.graphql keyword.ope | meta.embedded.block.graphql meta.selectionset.graphql { | meta.embedded.block.graphql meta.selectionset.graphql punctuation.operation.graphql | meta.embedded.block.graphql meta.selectionset.graphql +""" | meta.embedded.block.graphql meta.selectionset.graphql comment.line.graphql.js punctuation.whitespace.comment.leading.graphql + this is a comment | meta.embedded.block.graphql meta.selectionset.graphql comment.line.graphql.js +""" | meta.embedded.block.graphql meta.selectionset.graphql comment.line.graphql.js + | meta.embedded.block.graphql meta.selectionset.graphql user | meta.embedded.block.graphql meta.selectionset.graphql variable.graphql ( | meta.embedded.block.graphql meta.selectionset.graphql meta.arguments.graphql meta.brace.round.directive.graphql id | meta.embedded.block.graphql meta.selectionset.graphql meta.arguments.graphql variable.parameter.graphql From dfe083ad6f529c2492a1d5781641fea7f418942f Mon Sep 17 00:00:00 2001 From: Rikki Schulte Date: Sun, 4 Feb 2024 15:06:52 +0100 Subject: [PATCH 6/6] Version Packages (#3530) Co-authored-by: github-actions[bot] --- .changeset/angry-pots-return.md | 5 ----- packages/vscode-graphql-syntax/CHANGELOG.md | 6 ++++++ packages/vscode-graphql-syntax/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/angry-pots-return.md diff --git a/.changeset/angry-pots-return.md b/.changeset/angry-pots-return.md deleted file mode 100644 index 71028585afa..00000000000 --- a/.changeset/angry-pots-return.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'vscode-graphql-syntax': patch ---- - -fix triple double quote comment syntax by disabling inline double quote js strings for now diff --git a/packages/vscode-graphql-syntax/CHANGELOG.md b/packages/vscode-graphql-syntax/CHANGELOG.md index b01e280603c..fc7560540fb 100644 --- a/packages/vscode-graphql-syntax/CHANGELOG.md +++ b/packages/vscode-graphql-syntax/CHANGELOG.md @@ -1,5 +1,11 @@ # vscode-graphql-syntax +## 1.3.2 + +### Patch Changes + +- [#3529](https://github.com/graphql/graphiql/pull/3529) [`a38152ef`](https://github.com/graphql/graphiql/commit/a38152ef1248a480d5cad384780f82214a84f16d) Thanks [@acao](https://github.com/acao)! - fix triple double quote comment syntax by disabling inline double quote js strings for now + ## 1.3.1 ### Patch Changes diff --git a/packages/vscode-graphql-syntax/package.json b/packages/vscode-graphql-syntax/package.json index 035c69b6bbe..59eea43e2c7 100644 --- a/packages/vscode-graphql-syntax/package.json +++ b/packages/vscode-graphql-syntax/package.json @@ -1,6 +1,6 @@ { "name": "vscode-graphql-syntax", - "version": "1.3.1", + "version": "1.3.2", "displayName": "GraphQL: Syntax Highlighting", "description": "Adds syntax highlighting support for .graphql & embedded support for javascript, typescript, vue, markdown, python, php, reason, ocaml and rescript", "publisher": "GraphQL",