diff --git a/.changeset/nervous-numbers-push.md b/.changeset/nervous-numbers-push.md deleted file mode 100644 index 0ad8006a086..00000000000 --- a/.changeset/nervous-numbers-push.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@graphiql/react': patch ---- - -Avoid using deprecated Component.defaultProps for icon titles diff --git a/.changeset/rotten-seahorses-fry.md b/.changeset/rotten-seahorses-fry.md deleted file mode 100644 index 0de3cf444b1..00000000000 --- a/.changeset/rotten-seahorses-fry.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -'graphql-language-service-server': minor -'vscode-graphql': minor -'graphql-language-service-cli': minor ---- - -Fix many schema and fragment lifecycle issues, not all of them, but many related to cacheing. -Note: this makes `cacheSchemaForLookup` enabled by default again for schema first contexts. - -This fixes multiple cacheing bugs, upon addomg some in-depth integration test coverage for the LSP server. -It also solves several bugs regarding loading config types, and properly restarts the server and invalidates schema when there are config changes. - -### Bugfix Summary - -- configurable polling updates for network and other code first schema configuration, set to a 30s interval by default. powered by `schemaCacheTTL` which can be configured in the IDE settings (vscode, nvim) or in the graphql config file. (1) -- jump to definition in embedded files offset bug, for both fragments and code files with SDL strings -- cache invalidation for fragments (fragment lookup/autcoomplete data is more accurate, but incomplete/invalid fragments still do not autocomplete or validate, and remember fragment options always filter/validate by the `on` type!) -- schema cache invalidation for schema files - schema updates as you change the SDL files, and the generated file for code first by the `schemaCacheTTL` setting -- schema definition lookups & autocomplete crossing over into the wrong project - -**Notes** - -1. If possible, configuring for your locally running framework or a schema registry client to handle schema updates and output to a `schema.graphql` or `introspection.json` will always provide a better experience. many graphql frameworks have this built in! Otherwise, we must use this new lazy polling approach if you provide a url schema (this includes both introspection URLs and remote file URLs, and the combination of these). - -### Known Bugs Fixed - -- #3318 -- #2357 -- #3469 -- #2422 -- #2820 -- many more! - -### Test Improvements - -- new, high level integration spec suite for the LSP with a matching test utility -- more unit test coverage -- **total increased test coverage of about 25% in the LSP server codebase.** -- many "happy paths" covered for both schema and code first contexts -- many bugs revealed (and their source) - -### What's next? - -Another stage of the rewrite is already almost ready. This will fix even more bugs and improve memory usage, eliminate redundant parsing and ensure that graphql config's loaders do _all_ of the parsing and heavy lifting, thus honoring all the configs as well. It also significantly reduces the code complexity. - -There is also a plan to match Relay LSP's lookup config for either IDE (vscode, nvm, etc) settings as they provide, or by loading modules into your `graphql-config`! diff --git a/.changeset/silly-yaks-bathe.md b/.changeset/silly-yaks-bathe.md deleted file mode 100644 index 6985c27c4ad..00000000000 --- a/.changeset/silly-yaks-bathe.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -'graphql-language-service': patch -'graphql-language-service-server': patch -'graphql-language-service-cli': patch -'codemirror-graphql': patch -'cm6-graphql': patch -'monaco-graphql': patch -'vscode-graphql': patch ---- - -Fixes several issues with Type System (SDL) completion across the ecosystem: - -- restores completion for object and input type fields when the document context is not detectable or parseable -- correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions -- `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown diff --git a/.changeset/wet-toes-mate.md b/.changeset/wet-toes-mate.md deleted file mode 100644 index e15788d5968..00000000000 --- a/.changeset/wet-toes-mate.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -'graphql-language-service-server': minor -'graphql-language-service-cli': patch -'vscode-graphql': patch ---- - -Introduce `locateCommand` based on Relay LSP `pathToLocateCommand`: - -Now with `.extensions.languageService.locateCommand`, you can specify either the [existing signature](https://marketplace.visualstudio.com/items?itemName=meta.relay#relay.pathtolocatecommand-default-null) for relay, with the same callback parameters and return signature (of a string delimited by `:` characters), or you can return an object with {uri, range} for the exact set of coordinates for the destination range. the function can be sync or async. - -Relay LSP currently supports `Type` and `Type.field` for the 2nd argument. Ours also returns `Type.field(argument)` as a point of reference. It works with object types, input types, fragments, executable definitions and their fields, and should work for directive definitions as well. - -In the case of unnamed types such as fragment spreads, they return the name of the implemented type currently, but I'm curious what users prefer here. I assumed that some people may want to not be limited to only using this for SDL type definition lookups. Also look soon to see `locateCommand` support added for symbols, outline, and coming references and implementations. - -The module at the path you specify in relay LSP for `pathToLocateCommand` should work as such. - -```ts -// import it -import { locateCommand } from './graphql/tooling/lsp/locate.js'; -export default { - languageService: { - locateCommand, - }, - - projects: { - a: { - schema: 'https://localhost:8000/graphql', - documents: './a/**/*.{ts,tsx,jsx,js,graphql}', - }, - b: { - schema: './schema/ascode.ts', - documents: './b/**/*.{ts,tsx,jsx,js,graphql}', - }, - }, -}; -``` - -```ts -// or define it inline - -import { type LocateCommand } from 'graphql-language-service-server'; - -// relay LSP style -const locateCommand = (projectName: string, typePath: string) => { - const { path, startLine, endLine } = ourLookupUtility(projectName, typePath); - return `${path}:${startLine}:${endLine}`; -}; - -// an example with our alternative return signature -const locateCommand: LocateCommand = (projectName, typePath, info) => { - // pass more info, such as GraphQLType with the ast node. info.project is also available if you need it - const { path, range } = ourLookupUtility( - projectName, - typePath, - info.type.node, - ); - return { uri: path, range }; // range.start.line/range.end.line -}; - -export default { - languageService: { - locateCommand, - }, - schema: 'https://localhost:8000/graphql', - documents: './**/*.{ts,tsx,jsx,js,graphql}', -}; -``` - -Passing a string as a module path to resolve is coming in a follow-up release. Then it can be used with `.yml`, `.toml`, `.json`, `package.json#graphql`, etc - -For now this was a quick baseline for a feature asked for in multiple channels! - -Let us know how this works, and about any other interoperability improvements between our graphql LSP and other language servers (relay, intellij, etc) used by you and colleauges in your engineering organisations. We are trying our best to keep up with the awesome innovations they have 👀! diff --git a/examples/graphiql-webpack/package.json b/examples/graphiql-webpack/package.json index 64bf041cae5..ae50adf54c4 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": "^3.0.1", - "@graphiql/plugin-explorer": "^3.0.1", + "@graphiql/plugin-code-exporter": "^3.0.2", + "@graphiql/plugin-explorer": "^3.0.2", "@graphiql/toolkit": "^0.9.1", - "@graphiql/react": "^0.22.1", - "graphiql": "^3.2.2", + "@graphiql/react": "^0.22.2", + "graphiql": "^3.2.3", "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 05cef35efbf..15fffa52554 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.1", + "monaco-graphql": "^1.5.2", "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 6d526a81da8..1d4b73d15c0 100644 --- a/examples/monaco-graphql-react-vite/package.json +++ b/examples/monaco-graphql-react-vite/package.json @@ -5,10 +5,10 @@ "dependencies": { "@graphiql/toolkit": "^0.9.1", "graphql": "^16.8.1", - "graphql-language-service": "^5.2.0", + "graphql-language-service": "^5.2.1", "jsonc-parser": "^3.2.0", "monaco-editor": "^0.39.0", - "monaco-graphql": "^1.5.1", + "monaco-graphql": "^1.5.2", "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 326e255d60e..c02fd42949c 100644 --- a/examples/monaco-graphql-webpack/package.json +++ b/examples/monaco-graphql-webpack/package.json @@ -10,11 +10,11 @@ }, "dependencies": { "graphql": "^16.8.1", - "graphql-language-service": "^5.2.0", + "graphql-language-service": "^5.2.1", "json-schema": "^0.4.0", "jsonc-parser": "^3.2.0", "monaco-editor": "^0.39.0", - "monaco-graphql": "^1.5.1", + "monaco-graphql": "^1.5.2", "prettier": "3.0.0-alpha.12" }, "devDependencies": { diff --git a/packages/cm6-graphql/CHANGELOG.md b/packages/cm6-graphql/CHANGELOG.md index 2ca0b97375d..840ee2a0c4d 100644 --- a/packages/cm6-graphql/CHANGELOG.md +++ b/packages/cm6-graphql/CHANGELOG.md @@ -1,5 +1,18 @@ # cm6-graphql +## 0.0.15 + +### Patch Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fixes several issues with Type System (SDL) completion across the ecosystem: + + - restores completion for object and input type fields when the document context is not detectable or parseable + - correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions + - `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown + +- Updated dependencies [[`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - graphql-language-service@5.2.1 + ## 0.0.14 ### Patch Changes diff --git a/packages/cm6-graphql/package.json b/packages/cm6-graphql/package.json index 2bccde915c4..74a3fb5832c 100644 --- a/packages/cm6-graphql/package.json +++ b/packages/cm6-graphql/package.json @@ -1,6 +1,6 @@ { "name": "cm6-graphql", - "version": "0.0.14", + "version": "0.0.15", "description": "GraphQL language support for CodeMirror 6", "scripts": { "build": "cm-buildhelper src/index.ts", @@ -16,7 +16,7 @@ "types": "dist/index.d.ts", "sideEffects": false, "dependencies": { - "graphql-language-service": "^5.2.0" + "graphql-language-service": "^5.2.1" }, "devDependencies": { "@codemirror/autocomplete": "6.2.0", diff --git a/packages/codemirror-graphql/CHANGELOG.md b/packages/codemirror-graphql/CHANGELOG.md index 764d8d84630..5d9c7a482b8 100644 --- a/packages/codemirror-graphql/CHANGELOG.md +++ b/packages/codemirror-graphql/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## 2.0.12 + +### Patch Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fixes several issues with Type System (SDL) completion across the ecosystem: + + - restores completion for object and input type fields when the document context is not detectable or parseable + - correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions + - `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown + +- Updated dependencies [[`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - graphql-language-service@5.2.1 + ## 2.0.11 ### Patch Changes diff --git a/packages/codemirror-graphql/package.json b/packages/codemirror-graphql/package.json index 378130d9bc5..2d0f1e79f23 100644 --- a/packages/codemirror-graphql/package.json +++ b/packages/codemirror-graphql/package.json @@ -1,6 +1,6 @@ { "name": "codemirror-graphql", - "version": "2.0.11", + "version": "2.0.12", "description": "GraphQL mode and helpers for CodeMirror.", "contributors": [ "Hyohyeon Jeong ", @@ -45,7 +45,7 @@ "// TEMPORARILY PINNED until we fix graphql 15 support": "", "dependencies": { "@types/codemirror": "^0.0.90", - "graphql-language-service": "5.2.0" + "graphql-language-service": "5.2.1" }, "devDependencies": { "@codemirror/language": "^6.0.0", diff --git a/packages/graphiql-plugin-code-exporter/CHANGELOG.md b/packages/graphiql-plugin-code-exporter/CHANGELOG.md index 78b3b38bf64..dcf374850fb 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 +## 3.0.2 + +### Patch Changes + +- Updated dependencies [[`03ab3a6b`](https://github.com/graphql/graphiql/commit/03ab3a6b76378591ef79a828d80cc69b0b8f2842)]: + - @graphiql/react@0.22.2 + ## 3.0.1 ### Patch Changes diff --git a/packages/graphiql-plugin-code-exporter/package.json b/packages/graphiql-plugin-code-exporter/package.json index 7f4b2d55114..37e6628d68a 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": "3.0.1", + "version": "3.0.2", "repository": { "type": "git", "url": "https://github.com/graphql/graphiql", @@ -33,13 +33,13 @@ "graphiql-code-exporter": "^3.0.3" }, "peerDependencies": { - "@graphiql/react": "^0.22.1", + "@graphiql/react": "^0.22.2", "graphql": "^15.5.0 || ^16.0.0", "react": "^16.8.0 || ^17 || ^18", "react-dom": "^16.8.0 || ^17 || ^18" }, "devDependencies": { - "@graphiql/react": "^0.22.1", + "@graphiql/react": "^0.22.2", "@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 33b80a5f6cb..77ad2a056dc 100644 --- a/packages/graphiql-plugin-explorer/CHANGELOG.md +++ b/packages/graphiql-plugin-explorer/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphiql/plugin-explorer +## 3.0.2 + +### Patch Changes + +- Updated dependencies [[`03ab3a6b`](https://github.com/graphql/graphiql/commit/03ab3a6b76378591ef79a828d80cc69b0b8f2842)]: + - @graphiql/react@0.22.2 + ## 3.0.1 ### Patch Changes diff --git a/packages/graphiql-plugin-explorer/package.json b/packages/graphiql-plugin-explorer/package.json index 6af385e41ec..52cb8104603 100644 --- a/packages/graphiql-plugin-explorer/package.json +++ b/packages/graphiql-plugin-explorer/package.json @@ -1,6 +1,6 @@ { "name": "@graphiql/plugin-explorer", - "version": "3.0.1", + "version": "3.0.2", "repository": { "type": "git", "url": "https://github.com/graphql/graphiql", @@ -32,13 +32,13 @@ "graphiql-explorer": "^0.9.0" }, "peerDependencies": { - "@graphiql/react": "^0.22.1", + "@graphiql/react": "^0.22.2", "graphql": "^15.5.0 || ^16.0.0", "react": "^16.8.0 || ^17 || ^18", "react-dom": "^16.8.0 || ^17 || ^18" }, "devDependencies": { - "@graphiql/react": "^0.22.1", + "@graphiql/react": "^0.22.2", "@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 15895848fcb..173d9b1079e 100644 --- a/packages/graphiql-react/CHANGELOG.md +++ b/packages/graphiql-react/CHANGELOG.md @@ -1,5 +1,15 @@ # @graphiql/react +## 0.22.2 + +### Patch Changes + +- [#3602](https://github.com/graphql/graphiql/pull/3602) [`03ab3a6b`](https://github.com/graphql/graphiql/commit/03ab3a6b76378591ef79a828d80cc69b0b8f2842) Thanks [@thomasheyenbrock](https://github.com/thomasheyenbrock)! - Avoid using deprecated Component.defaultProps for icon titles + +- Updated dependencies [[`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - graphql-language-service@5.2.1 + - codemirror-graphql@2.0.12 + ## 0.22.1 ### Patch Changes diff --git a/packages/graphiql-react/package.json b/packages/graphiql-react/package.json index 37c2a69330a..fe982ae5dab 100644 --- a/packages/graphiql-react/package.json +++ b/packages/graphiql-react/package.json @@ -1,6 +1,6 @@ { "name": "@graphiql/react", - "version": "0.22.1", + "version": "0.22.2", "repository": { "type": "git", "url": "https://github.com/graphql/graphiql", @@ -57,10 +57,10 @@ "@types/codemirror": "^5.60.8", "clsx": "^1.2.1", "codemirror": "^5.65.3", - "codemirror-graphql": "^2.0.11", + "codemirror-graphql": "^2.0.12", "copy-to-clipboard": "^3.2.0", "framer-motion": "^6.5.1", - "graphql-language-service": "^5.2.0", + "graphql-language-service": "^5.2.1", "markdown-it": "^14.1.0", "set-value": "^4.1.0" }, diff --git a/packages/graphiql/CHANGELOG.md b/packages/graphiql/CHANGELOG.md index 2cfd2642d34..1b252105180 100644 --- a/packages/graphiql/CHANGELOG.md +++ b/packages/graphiql/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 3.2.3 + +### Patch Changes + +- Updated dependencies [[`03ab3a6b`](https://github.com/graphql/graphiql/commit/03ab3a6b76378591ef79a828d80cc69b0b8f2842), [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - @graphiql/react@0.22.2 + - graphql-language-service@5.2.1 + ## 3.2.2 ### Patch Changes diff --git a/packages/graphiql/package.json b/packages/graphiql/package.json index 787cb1051d3..75af4899c98 100644 --- a/packages/graphiql/package.json +++ b/packages/graphiql/package.json @@ -1,6 +1,6 @@ { "name": "graphiql", - "version": "3.2.2", + "version": "3.2.3", "description": "An graphical interactive in-browser GraphQL IDE.", "contributors": [ "Hyohyeon Jeong ", @@ -47,9 +47,9 @@ "webpack": "webpack-cli --config resources/webpack.config.js" }, "dependencies": { - "@graphiql/react": "^0.22.1", + "@graphiql/react": "^0.22.2", "@graphiql/toolkit": "^0.9.1", - "graphql-language-service": "^5.2.0", + "graphql-language-service": "^5.2.1", "markdown-it": "^14.1.0" }, "peerDependencies": { diff --git a/packages/graphql-language-service-cli/CHANGELOG.md b/packages/graphql-language-service-cli/CHANGELOG.md index 7434288d1e4..d2f63744376 100644 --- a/packages/graphql-language-service-cli/CHANGELOG.md +++ b/packages/graphql-language-service-cli/CHANGELOG.md @@ -1,5 +1,131 @@ # graphql-language-service-cli +## 3.4.0 + +### Minor Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fix many schema and fragment lifecycle issues, not all of them, but many related to cacheing. Note: this makes `cacheSchemaForLookup` enabled by default again for schema first contexts. + + This fixes multiple cacheing bugs, upon addomg some in-depth integration test coverage for the LSP server. It also solves several bugs regarding loading config types, and properly restarts the server and invalidates schema when there are config changes. + + ### Bugfix Summary + + - configurable polling updates for network and other code first schema configuration, set to a 30s interval by default. powered by `schemaCacheTTL` which can be configured in the IDE settings (vscode, nvim) or in the graphql config file. (1) + - jump to definition in embedded files offset bug, for both fragments and code files with SDL strings + - cache invalidation for fragments (fragment lookup/autcoomplete data is more accurate, but incomplete/invalid fragments still do not autocomplete or validate, and remember fragment options always filter/validate by the `on` type!) + - schema cache invalidation for schema files - schema updates as you change the SDL files, and the generated file for code first by the `schemaCacheTTL` setting + - schema definition lookups & autocomplete crossing over into the wrong project + + **Notes** + + 1. If possible, configuring for your locally running framework or a schema registry client to handle schema updates and output to a `schema.graphql` or `introspection.json` will always provide a better experience. many graphql frameworks have this built in! Otherwise, we must use this new lazy polling approach if you provide a url schema (this includes both introspection URLs and remote file URLs, and the combination of these). + + ### Known Bugs Fixed + + - #3318 + - #2357 + - #3469 + - #2422 + - #2820 + - many more! + + ### Test Improvements + + - new, high level integration spec suite for the LSP with a matching test utility + - more unit test coverage + - **total increased test coverage of about 25% in the LSP server codebase.** + - many "happy paths" covered for both schema and code first contexts + - many bugs revealed (and their source) + + ### What's next? + + Another stage of the rewrite is already almost ready. This will fix even more bugs and improve memory usage, eliminate redundant parsing and ensure that graphql config's loaders do _all_ of the parsing and heavy lifting, thus honoring all the configs as well. It also significantly reduces the code complexity. + + There is also a plan to match Relay LSP's lookup config for either IDE (vscode, nvm, etc) settings as they provide, or by loading modules into your `graphql-config`! + +### Patch Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fixes several issues with Type System (SDL) completion across the ecosystem: + + - restores completion for object and input type fields when the document context is not detectable or parseable + - correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions + - `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Introduce `locateCommand` based on Relay LSP `pathToLocateCommand`: + + Now with `.extensions.languageService.locateCommand`, you can specify either the [existing signature](https://marketplace.visualstudio.com/items?itemName=meta.relay#relay.pathtolocatecommand-default-null) for relay, with the same callback parameters and return signature (of a string delimited by `:` characters), or you can return an object with {uri, range} for the exact set of coordinates for the destination range. the function can be sync or async. + + Relay LSP currently supports `Type` and `Type.field` for the 2nd argument. Ours also returns `Type.field(argument)` as a point of reference. It works with object types, input types, fragments, executable definitions and their fields, and should work for directive definitions as well. + + In the case of unnamed types such as fragment spreads, they return the name of the implemented type currently, but I'm curious what users prefer here. I assumed that some people may want to not be limited to only using this for SDL type definition lookups. Also look soon to see `locateCommand` support added for symbols, outline, and coming references and implementations. + + The module at the path you specify in relay LSP for `pathToLocateCommand` should work as such. + + ```ts + // import it + import { locateCommand } from './graphql/tooling/lsp/locate.js'; + export default { + languageService: { + locateCommand, + }, + + projects: { + a: { + schema: 'https://localhost:8000/graphql', + documents: './a/**/*.{ts,tsx,jsx,js,graphql}', + }, + b: { + schema: './schema/ascode.ts', + documents: './b/**/*.{ts,tsx,jsx,js,graphql}', + }, + }, + }; + ``` + + ```ts + // or define it inline + + import { type LocateCommand } from 'graphql-language-service-server'; + + // relay LSP style + const locateCommand = (projectName: string, typePath: string) => { + const { path, startLine, endLine } = ourLookupUtility( + projectName, + typePath, + ); + return `${path}:${startLine}:${endLine}`; + }; + + // an example with our alternative return signature + const locateCommand: LocateCommand = (projectName, typePath, info) => { + // pass more info, such as GraphQLType with the ast node. info.project is also available if you need it + const { path, range } = ourLookupUtility( + projectName, + typePath, + info.type.node, + ); + return { uri: path, range }; // range.start.line/range.end.line + }; + + export default { + languageService: { + locateCommand, + }, + schema: 'https://localhost:8000/graphql', + documents: './**/*.{ts,tsx,jsx,js,graphql}', + }; + ``` + + Passing a string as a module path to resolve is coming in a follow-up release. Then it can be used with `.yml`, `.toml`, `.json`, `package.json#graphql`, etc + + For now this was a quick baseline for a feature asked for in multiple channels! + + Let us know how this works, and about any other interoperability improvements between our graphql LSP and other language servers (relay, intellij, etc) used by you and colleauges in your engineering organisations. We are trying our best to keep up with the awesome innovations they have 👀! + +- Updated dependencies [[`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d), [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d), [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - graphql-language-service-server@2.13.0 + - graphql-language-service@5.2.1 + ## 3.3.33 ### Patch Changes diff --git a/packages/graphql-language-service-cli/package.json b/packages/graphql-language-service-cli/package.json index 01983e5cf36..fee9a466fd3 100644 --- a/packages/graphql-language-service-cli/package.json +++ b/packages/graphql-language-service-cli/package.json @@ -1,6 +1,6 @@ { "name": "graphql-language-service-cli", - "version": "3.3.33", + "version": "3.4.0", "description": "An interface for building GraphQL language services for IDEs", "contributors": [ "Hyohyeon Jeong ", @@ -37,8 +37,8 @@ "dependencies": { "@babel/polyfill": "^7.12.1", "@types/yargs": "16.0.5", - "graphql-language-service": "^5.2.0", - "graphql-language-service-server": "^2.12.0", + "graphql-language-service": "^5.2.1", + "graphql-language-service-server": "^2.13.0", "yargs": "^16.2.0" }, "devDependencies": { diff --git a/packages/graphql-language-service-server/CHANGELOG.md b/packages/graphql-language-service-server/CHANGELOG.md index 52f894a5908..7fcb3ca71dc 100644 --- a/packages/graphql-language-service-server/CHANGELOG.md +++ b/packages/graphql-language-service-server/CHANGELOG.md @@ -1,5 +1,130 @@ # graphql-language-service-server +## 2.13.0 + +### Minor Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fix many schema and fragment lifecycle issues, not all of them, but many related to cacheing. Note: this makes `cacheSchemaForLookup` enabled by default again for schema first contexts. + + This fixes multiple cacheing bugs, upon addomg some in-depth integration test coverage for the LSP server. It also solves several bugs regarding loading config types, and properly restarts the server and invalidates schema when there are config changes. + + ### Bugfix Summary + + - configurable polling updates for network and other code first schema configuration, set to a 30s interval by default. powered by `schemaCacheTTL` which can be configured in the IDE settings (vscode, nvim) or in the graphql config file. (1) + - jump to definition in embedded files offset bug, for both fragments and code files with SDL strings + - cache invalidation for fragments (fragment lookup/autcoomplete data is more accurate, but incomplete/invalid fragments still do not autocomplete or validate, and remember fragment options always filter/validate by the `on` type!) + - schema cache invalidation for schema files - schema updates as you change the SDL files, and the generated file for code first by the `schemaCacheTTL` setting + - schema definition lookups & autocomplete crossing over into the wrong project + + **Notes** + + 1. If possible, configuring for your locally running framework or a schema registry client to handle schema updates and output to a `schema.graphql` or `introspection.json` will always provide a better experience. many graphql frameworks have this built in! Otherwise, we must use this new lazy polling approach if you provide a url schema (this includes both introspection URLs and remote file URLs, and the combination of these). + + ### Known Bugs Fixed + + - #3318 + - #2357 + - #3469 + - #2422 + - #2820 + - many more! + + ### Test Improvements + + - new, high level integration spec suite for the LSP with a matching test utility + - more unit test coverage + - **total increased test coverage of about 25% in the LSP server codebase.** + - many "happy paths" covered for both schema and code first contexts + - many bugs revealed (and their source) + + ### What's next? + + Another stage of the rewrite is already almost ready. This will fix even more bugs and improve memory usage, eliminate redundant parsing and ensure that graphql config's loaders do _all_ of the parsing and heavy lifting, thus honoring all the configs as well. It also significantly reduces the code complexity. + + There is also a plan to match Relay LSP's lookup config for either IDE (vscode, nvm, etc) settings as they provide, or by loading modules into your `graphql-config`! + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Introduce `locateCommand` based on Relay LSP `pathToLocateCommand`: + + Now with `.extensions.languageService.locateCommand`, you can specify either the [existing signature](https://marketplace.visualstudio.com/items?itemName=meta.relay#relay.pathtolocatecommand-default-null) for relay, with the same callback parameters and return signature (of a string delimited by `:` characters), or you can return an object with {uri, range} for the exact set of coordinates for the destination range. the function can be sync or async. + + Relay LSP currently supports `Type` and `Type.field` for the 2nd argument. Ours also returns `Type.field(argument)` as a point of reference. It works with object types, input types, fragments, executable definitions and their fields, and should work for directive definitions as well. + + In the case of unnamed types such as fragment spreads, they return the name of the implemented type currently, but I'm curious what users prefer here. I assumed that some people may want to not be limited to only using this for SDL type definition lookups. Also look soon to see `locateCommand` support added for symbols, outline, and coming references and implementations. + + The module at the path you specify in relay LSP for `pathToLocateCommand` should work as such. + + ```ts + // import it + import { locateCommand } from './graphql/tooling/lsp/locate.js'; + export default { + languageService: { + locateCommand, + }, + + projects: { + a: { + schema: 'https://localhost:8000/graphql', + documents: './a/**/*.{ts,tsx,jsx,js,graphql}', + }, + b: { + schema: './schema/ascode.ts', + documents: './b/**/*.{ts,tsx,jsx,js,graphql}', + }, + }, + }; + ``` + + ```ts + // or define it inline + + import { type LocateCommand } from 'graphql-language-service-server'; + + // relay LSP style + const locateCommand = (projectName: string, typePath: string) => { + const { path, startLine, endLine } = ourLookupUtility( + projectName, + typePath, + ); + return `${path}:${startLine}:${endLine}`; + }; + + // an example with our alternative return signature + const locateCommand: LocateCommand = (projectName, typePath, info) => { + // pass more info, such as GraphQLType with the ast node. info.project is also available if you need it + const { path, range } = ourLookupUtility( + projectName, + typePath, + info.type.node, + ); + return { uri: path, range }; // range.start.line/range.end.line + }; + + export default { + languageService: { + locateCommand, + }, + schema: 'https://localhost:8000/graphql', + documents: './**/*.{ts,tsx,jsx,js,graphql}', + }; + ``` + + Passing a string as a module path to resolve is coming in a follow-up release. Then it can be used with `.yml`, `.toml`, `.json`, `package.json#graphql`, etc + + For now this was a quick baseline for a feature asked for in multiple channels! + + Let us know how this works, and about any other interoperability improvements between our graphql LSP and other language servers (relay, intellij, etc) used by you and colleauges in your engineering organisations. We are trying our best to keep up with the awesome innovations they have 👀! + +### Patch Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fixes several issues with Type System (SDL) completion across the ecosystem: + + - restores completion for object and input type fields when the document context is not detectable or parseable + - correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions + - `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown + +- Updated dependencies [[`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - graphql-language-service@5.2.1 + ## 2.12.0 ### Minor Changes diff --git a/packages/graphql-language-service-server/package.json b/packages/graphql-language-service-server/package.json index c7eba908a12..c05661ed8cd 100644 --- a/packages/graphql-language-service-server/package.json +++ b/packages/graphql-language-service-server/package.json @@ -1,6 +1,6 @@ { "name": "graphql-language-service-server", - "version": "2.12.0", + "version": "2.13.0", "description": "Server process backing the GraphQL Language Service", "contributors": [ "Greg Hurrell (https://greg.hurrell.net/)", @@ -49,7 +49,7 @@ "fast-glob": "^3.2.7", "glob": "^7.2.0", "graphql-config": "5.0.3", - "graphql-language-service": "^5.2.0", + "graphql-language-service": "^5.2.1", "lru-cache": "^10.2.0", "mkdirp": "^1.0.4", "node-abort-controller": "^3.0.1", diff --git a/packages/graphql-language-service/CHANGELOG.md b/packages/graphql-language-service/CHANGELOG.md index d8589296583..00a9cd70ddf 100644 --- a/packages/graphql-language-service/CHANGELOG.md +++ b/packages/graphql-language-service/CHANGELOG.md @@ -1,5 +1,15 @@ # graphql-language-service +## 5.2.1 + +### Patch Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fixes several issues with Type System (SDL) completion across the ecosystem: + + - restores completion for object and input type fields when the document context is not detectable or parseable + - correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions + - `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown + ## 5.2.0 ### Minor Changes diff --git a/packages/graphql-language-service/package.json b/packages/graphql-language-service/package.json index d83127558bf..14543d361d7 100644 --- a/packages/graphql-language-service/package.json +++ b/packages/graphql-language-service/package.json @@ -1,6 +1,6 @@ { "name": "graphql-language-service", - "version": "5.2.0", + "version": "5.2.1", "description": "The official, runtime independent Language Service for GraphQL", "contributors": [ "GraphQL Contributors" diff --git a/packages/monaco-graphql/CHANGELOG.md b/packages/monaco-graphql/CHANGELOG.md index a031ae46d7c..91eefdf320a 100644 --- a/packages/monaco-graphql/CHANGELOG.md +++ b/packages/monaco-graphql/CHANGELOG.md @@ -1,5 +1,18 @@ # Change Log +## 1.5.2 + +### Patch Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fixes several issues with Type System (SDL) completion across the ecosystem: + + - restores completion for object and input type fields when the document context is not detectable or parseable + - correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions + - `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown + +- Updated dependencies [[`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - graphql-language-service@5.2.1 + ## 1.5.1 ### Patch Changes diff --git a/packages/monaco-graphql/package.json b/packages/monaco-graphql/package.json index c9b32464ba4..fc5e3333719 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.1", + "version": "1.5.2", "license": "MIT", "main": "dist/monaco.contribution.js", "module": "esm/monaco.contribution.js", @@ -66,7 +66,7 @@ "test": "vitest run" }, "dependencies": { - "graphql-language-service": "^5.2.0", + "graphql-language-service": "^5.2.1", "picomatch-browser": "^2.2.6" }, "devDependencies": { diff --git a/packages/vscode-graphql/CHANGELOG.md b/packages/vscode-graphql/CHANGELOG.md index e931025739e..e8d51c0a0c6 100644 --- a/packages/vscode-graphql/CHANGELOG.md +++ b/packages/vscode-graphql/CHANGELOG.md @@ -1,5 +1,130 @@ # Change Log +## 0.11.0 + +### Minor Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fix many schema and fragment lifecycle issues, not all of them, but many related to cacheing. Note: this makes `cacheSchemaForLookup` enabled by default again for schema first contexts. + + This fixes multiple cacheing bugs, upon addomg some in-depth integration test coverage for the LSP server. It also solves several bugs regarding loading config types, and properly restarts the server and invalidates schema when there are config changes. + + ### Bugfix Summary + + - configurable polling updates for network and other code first schema configuration, set to a 30s interval by default. powered by `schemaCacheTTL` which can be configured in the IDE settings (vscode, nvim) or in the graphql config file. (1) + - jump to definition in embedded files offset bug, for both fragments and code files with SDL strings + - cache invalidation for fragments (fragment lookup/autcoomplete data is more accurate, but incomplete/invalid fragments still do not autocomplete or validate, and remember fragment options always filter/validate by the `on` type!) + - schema cache invalidation for schema files - schema updates as you change the SDL files, and the generated file for code first by the `schemaCacheTTL` setting + - schema definition lookups & autocomplete crossing over into the wrong project + + **Notes** + + 1. If possible, configuring for your locally running framework or a schema registry client to handle schema updates and output to a `schema.graphql` or `introspection.json` will always provide a better experience. many graphql frameworks have this built in! Otherwise, we must use this new lazy polling approach if you provide a url schema (this includes both introspection URLs and remote file URLs, and the combination of these). + + ### Known Bugs Fixed + + - #3318 + - #2357 + - #3469 + - #2422 + - #2820 + - many more! + + ### Test Improvements + + - new, high level integration spec suite for the LSP with a matching test utility + - more unit test coverage + - **total increased test coverage of about 25% in the LSP server codebase.** + - many "happy paths" covered for both schema and code first contexts + - many bugs revealed (and their source) + + ### What's next? + + Another stage of the rewrite is already almost ready. This will fix even more bugs and improve memory usage, eliminate redundant parsing and ensure that graphql config's loaders do _all_ of the parsing and heavy lifting, thus honoring all the configs as well. It also significantly reduces the code complexity. + + There is also a plan to match Relay LSP's lookup config for either IDE (vscode, nvm, etc) settings as they provide, or by loading modules into your `graphql-config`! + +### Patch Changes + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Fixes several issues with Type System (SDL) completion across the ecosystem: + + - restores completion for object and input type fields when the document context is not detectable or parseable + - correct top-level completions for either of the unknown, type system or executable definitions. this leads to mixed top level completions when the document is unparseable, but now you are not seemingly restricted to only executable top level definitions + - `.graphqls` ad-hoc standard functionality remains, but is not required, as it is not part of the official spec, and the spec also allows mixed mode documents in theory, and this concept is required when the type is unknown + +- [#3521](https://github.com/graphql/graphiql/pull/3521) [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d) Thanks [@acao](https://github.com/acao)! - Introduce `locateCommand` based on Relay LSP `pathToLocateCommand`: + + Now with `.extensions.languageService.locateCommand`, you can specify either the [existing signature](https://marketplace.visualstudio.com/items?itemName=meta.relay#relay.pathtolocatecommand-default-null) for relay, with the same callback parameters and return signature (of a string delimited by `:` characters), or you can return an object with {uri, range} for the exact set of coordinates for the destination range. the function can be sync or async. + + Relay LSP currently supports `Type` and `Type.field` for the 2nd argument. Ours also returns `Type.field(argument)` as a point of reference. It works with object types, input types, fragments, executable definitions and their fields, and should work for directive definitions as well. + + In the case of unnamed types such as fragment spreads, they return the name of the implemented type currently, but I'm curious what users prefer here. I assumed that some people may want to not be limited to only using this for SDL type definition lookups. Also look soon to see `locateCommand` support added for symbols, outline, and coming references and implementations. + + The module at the path you specify in relay LSP for `pathToLocateCommand` should work as such. + + ```ts + // import it + import { locateCommand } from './graphql/tooling/lsp/locate.js'; + export default { + languageService: { + locateCommand, + }, + + projects: { + a: { + schema: 'https://localhost:8000/graphql', + documents: './a/**/*.{ts,tsx,jsx,js,graphql}', + }, + b: { + schema: './schema/ascode.ts', + documents: './b/**/*.{ts,tsx,jsx,js,graphql}', + }, + }, + }; + ``` + + ```ts + // or define it inline + + import { type LocateCommand } from 'graphql-language-service-server'; + + // relay LSP style + const locateCommand = (projectName: string, typePath: string) => { + const { path, startLine, endLine } = ourLookupUtility( + projectName, + typePath, + ); + return `${path}:${startLine}:${endLine}`; + }; + + // an example with our alternative return signature + const locateCommand: LocateCommand = (projectName, typePath, info) => { + // pass more info, such as GraphQLType with the ast node. info.project is also available if you need it + const { path, range } = ourLookupUtility( + projectName, + typePath, + info.type.node, + ); + return { uri: path, range }; // range.start.line/range.end.line + }; + + export default { + languageService: { + locateCommand, + }, + schema: 'https://localhost:8000/graphql', + documents: './**/*.{ts,tsx,jsx,js,graphql}', + }; + ``` + + Passing a string as a module path to resolve is coming in a follow-up release. Then it can be used with `.yml`, `.toml`, `.json`, `package.json#graphql`, etc + + For now this was a quick baseline for a feature asked for in multiple channels! + + Let us know how this works, and about any other interoperability improvements between our graphql LSP and other language servers (relay, intellij, etc) used by you and colleauges in your engineering organisations. We are trying our best to keep up with the awesome innovations they have 👀! + +- Updated dependencies [[`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d), [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d), [`aa6dbbb4`](https://github.com/graphql/graphiql/commit/aa6dbbb45bf51c1966537640fbe5c4f375735c8d)]: + - graphql-language-service-server@2.13.0 + ## 0.9.3 ### Patch Changes diff --git a/packages/vscode-graphql/package.json b/packages/vscode-graphql/package.json index 876b65103ef..3038b1dea03 100644 --- a/packages/vscode-graphql/package.json +++ b/packages/vscode-graphql/package.json @@ -1,6 +1,6 @@ { "name": "vscode-graphql", - "version": "0.10.2", + "version": "0.11.0", "private": true, "license": "MIT", "displayName": "GraphQL: Language Feature Support", @@ -180,7 +180,7 @@ }, "dependencies": { "graphql": "^16.8.1", - "graphql-language-service-server": "^2.12.0", + "graphql-language-service-server": "^2.13.0", "vscode-languageclient": "8.0.2", "typescript": "^5.3.3" }