vscode-apollo 1.19.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/.circleci/config.yml +91 -0
- package/.eslintrc.js +10 -0
- package/.git-blame-ignore-revs +2 -0
- package/.gitattributes +1 -0
- package/.github/workflows/release.yml +95 -0
- package/.gitleaks.toml +26 -0
- package/.nvmrc +1 -0
- package/.prettierrc +5 -0
- package/.vscode/launch.json +66 -0
- package/.vscode/settings.json +16 -0
- package/.vscode/tasks.json +60 -0
- package/.vscodeignore +28 -1
- package/CHANGELOG.md +250 -1
- package/CODEOWNERS +4 -0
- package/LICENSE +2 -2
- package/README.md +104 -55
- package/codegen.yml +12 -0
- package/graphql.configuration.json +5 -1
- package/images/IconRun.svg +8 -0
- package/images/marketplace/apollo-wordmark.png +0 -0
- package/jest.config.ts +21 -0
- package/jest.e2e.config.js +17 -0
- package/package.json +102 -23
- package/renovate.json +30 -0
- package/sampleWorkspace/clientSchema/apollo.config.cjs +10 -0
- package/sampleWorkspace/clientSchema/src/clientSchema.js +16 -0
- package/sampleWorkspace/clientSchema/src/test.js +18 -0
- package/sampleWorkspace/fixtures/starwarsSchema.graphql +299 -0
- package/sampleWorkspace/httpSchema/apollo.config.ts +8 -0
- package/sampleWorkspace/httpSchema/src/test.js +9 -0
- package/sampleWorkspace/localSchema/apollo.config.js +8 -0
- package/sampleWorkspace/localSchema/src/test.js +8 -0
- package/sampleWorkspace/localSchemaArray/apollo.config.js +12 -0
- package/sampleWorkspace/localSchemaArray/planets.graphql +20 -0
- package/sampleWorkspace/localSchemaArray/src/test.js +12 -0
- package/sampleWorkspace/sampleWorkspace.code-workspace +20 -0
- package/sampleWorkspace/spotifyGraph/apollo.config.mjs +5 -0
- package/sampleWorkspace/spotifyGraph/src/test.js +11 -0
- package/src/__e2e__/mockServer.js +117 -0
- package/src/__e2e__/mocks.js +13094 -0
- package/src/__e2e__/run.js +23 -0
- package/src/__e2e__/runTests.js +44 -0
- package/src/__e2e__/setup.js +1 -0
- package/src/__e2e__/vscode-environment.js +16 -0
- package/src/__e2e__/vscode.js +1 -0
- package/src/__mocks__/fs.js +3 -0
- package/src/__tests__/statusBar.test.ts +8 -7
- package/src/build.js +57 -0
- package/src/debug.ts +2 -5
- package/src/env/index.ts +1 -0
- package/src/env/typescript-utility-types.ts +2 -0
- package/src/extension.ts +265 -170
- package/src/language-server/__e2e__/clientSchema.e2e.ts +147 -0
- package/src/language-server/__e2e__/httpSchema.e2e.ts +21 -0
- package/src/language-server/__e2e__/localSchema.e2e.ts +25 -0
- package/src/language-server/__e2e__/localSchemaArray.e2e.ts +31 -0
- package/src/language-server/__e2e__/studioGraph.e2e.ts +65 -0
- package/src/language-server/__e2e__/utils.ts +151 -0
- package/src/language-server/__tests__/diagnostics.test.ts +86 -0
- package/src/language-server/__tests__/document.test.ts +187 -0
- package/src/language-server/__tests__/fileSet.test.ts +46 -0
- package/src/language-server/__tests__/fixtures/starwarsSchema.ts +1917 -0
- package/src/language-server/config/__tests__/config.ts +54 -0
- package/src/language-server/config/__tests__/loadConfig.ts +384 -0
- package/src/language-server/config/__tests__/utils.ts +99 -0
- package/src/language-server/config/config.ts +284 -0
- package/src/language-server/config/index.ts +3 -0
- package/src/language-server/config/loadConfig.ts +101 -0
- package/src/language-server/config/utils.ts +45 -0
- package/src/language-server/diagnostics.ts +118 -0
- package/src/language-server/document.ts +277 -0
- package/src/language-server/engine/index.ts +123 -0
- package/src/language-server/engine/operations/frontendUrlRoot.ts +15 -0
- package/src/language-server/engine/operations/schemaTagsAndFieldStats.ts +32 -0
- package/src/language-server/errors/__tests__/NoMissingClientDirectives.test.ts +225 -0
- package/src/language-server/errors/logger.ts +58 -0
- package/src/language-server/errors/validation.ts +274 -0
- package/src/language-server/fileSet.ts +63 -0
- package/src/language-server/format.ts +48 -0
- package/src/language-server/graphqlTypes.ts +16741 -0
- package/src/language-server/index.ts +28 -0
- package/src/language-server/languageProvider.ts +795 -0
- package/src/language-server/loadingHandler.ts +47 -0
- package/src/language-server/project/base.ts +406 -0
- package/src/language-server/project/client.ts +568 -0
- package/src/language-server/project/defaultClientSchema.ts +70 -0
- package/src/language-server/providers/schema/__tests__/file.ts +191 -0
- package/src/language-server/providers/schema/base.ts +15 -0
- package/src/language-server/providers/schema/endpoint.ts +138 -0
- package/src/language-server/providers/schema/engine.ts +204 -0
- package/src/language-server/providers/schema/file.ts +176 -0
- package/src/language-server/providers/schema/index.ts +59 -0
- package/src/language-server/server.ts +274 -0
- package/src/language-server/typings/graphql.d.ts +27 -0
- package/src/language-server/utilities/__tests__/graphql.test.ts +399 -0
- package/src/language-server/utilities/__tests__/uri.ts +55 -0
- package/src/language-server/utilities/debouncer.ts +8 -0
- package/src/language-server/utilities/debug.ts +90 -0
- package/src/language-server/utilities/graphql.ts +433 -0
- package/src/language-server/utilities/index.ts +3 -0
- package/src/language-server/utilities/source.ts +182 -0
- package/src/language-server/utilities/uri.ts +19 -0
- package/src/language-server/workspace.ts +254 -0
- package/src/languageServerClient.ts +22 -15
- package/src/messages.ts +75 -0
- package/src/statusBar.ts +5 -5
- package/src/tools/__tests__/buildServiceDefinition.test.ts +491 -0
- package/src/tools/__tests__/snapshotSerializers/astSerializer.ts +19 -0
- package/src/tools/__tests__/snapshotSerializers/graphQLTypeSerializer.ts +14 -0
- package/src/tools/buildServiceDefinition.ts +241 -0
- package/src/tools/index.ts +6 -0
- package/src/tools/schema/index.ts +2 -0
- package/src/tools/schema/resolveObject.ts +18 -0
- package/src/tools/schema/resolverMap.ts +23 -0
- package/src/tools/utilities/graphql.ts +22 -0
- package/src/tools/utilities/index.ts +3 -0
- package/src/tools/utilities/invariant.ts +5 -0
- package/src/tools/utilities/predicates.ts +5 -0
- package/src/utils.ts +7 -21
- package/syntaxes/graphql.dart.json +2 -4
- package/syntaxes/graphql.ex.json +1 -4
- package/syntaxes/graphql.js.json +3 -3
- package/syntaxes/graphql.json +13 -9
- package/syntaxes/graphql.lua.json +51 -0
- package/syntaxes/graphql.rb.json +1 -1
- package/tsconfig.build.json +11 -0
- package/tsconfig.json +22 -7
- package/create-server-symlink.js +0 -8
- package/lib/debug.d.ts +0 -11
- package/lib/debug.d.ts.map +0 -1
- package/lib/debug.js +0 -48
- package/lib/debug.js.map +0 -1
- package/lib/extension.d.ts +0 -4
- package/lib/extension.d.ts.map +0 -1
- package/lib/extension.js +0 -187
- package/lib/extension.js.map +0 -1
- package/lib/languageServerClient.d.ts +0 -4
- package/lib/languageServerClient.d.ts.map +0 -1
- package/lib/languageServerClient.js +0 -57
- package/lib/languageServerClient.js.map +0 -1
- package/lib/statusBar.d.ts +0 -24
- package/lib/statusBar.d.ts.map +0 -1
- package/lib/statusBar.js +0 -46
- package/lib/statusBar.js.map +0 -1
- package/lib/testRunner/index.d.ts +0 -3
- package/lib/testRunner/index.d.ts.map +0 -1
- package/lib/testRunner/index.js +0 -49
- package/lib/testRunner/index.js.map +0 -1
- package/lib/testRunner/jest-config.d.ts +0 -14
- package/lib/testRunner/jest-config.d.ts.map +0 -1
- package/lib/testRunner/jest-config.js +0 -18
- package/lib/testRunner/jest-config.js.map +0 -1
- package/lib/testRunner/jest-vscode-environment.d.ts +0 -2
- package/lib/testRunner/jest-vscode-environment.d.ts.map +0 -1
- package/lib/testRunner/jest-vscode-environment.js +0 -19
- package/lib/testRunner/jest-vscode-environment.js.map +0 -1
- package/lib/testRunner/jest-vscode-framework-setup.d.ts +0 -1
- package/lib/testRunner/jest-vscode-framework-setup.d.ts.map +0 -1
- package/lib/testRunner/jest-vscode-framework-setup.js +0 -3
- package/lib/testRunner/jest-vscode-framework-setup.js.map +0 -1
- package/lib/testRunner/vscode-test-script.d.ts +0 -2
- package/lib/testRunner/vscode-test-script.d.ts.map +0 -1
- package/lib/testRunner/vscode-test-script.js +0 -23
- package/lib/testRunner/vscode-test-script.js.map +0 -1
- package/lib/utils.d.ts +0 -18
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -52
- package/lib/utils.js.map +0 -1
- package/src/testRunner/README.md +0 -23
- package/src/testRunner/index.ts +0 -72
- package/src/testRunner/jest-config.ts +0 -17
- package/src/testRunner/jest-vscode-environment.ts +0 -25
- package/src/testRunner/jest-vscode-framework-setup.ts +0 -10
- package/src/testRunner/jest.d.ts +0 -37
- package/src/testRunner/vscode-test-script.ts +0 -38
- package/tsconfig.test.json +0 -4
- package/tsconfig.tsbuildinfo +0 -2486
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,250 @@
|
|
|
1
|
-
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Remove Service projects
|
|
8
|
+
"Service"-type projects had almost no functionality in the Extension, so they were removed
|
|
9
|
+
|
|
10
|
+
- [#169](https://github.com/apollographql/vscode-graphql/pull/169) [`ff4f0de4`](https://github.com/apollographql/vscode-graphql/commit/ff4f0de4da4d80e8bd9ea9779a8c34678b47de0d) Thanks [@phryneas](https://github.com/phryneas)! - Bundle extension instead of just building it.
|
|
11
|
+
|
|
12
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Remove support for deprecated configuration environment variable `ENGINE_API_KEY`
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#153](https://github.com/apollographql/vscode-graphql/pull/153) [`a37cfaa6`](https://github.com/apollographql/vscode-graphql/commit/a37cfaa6bf20a8aa6ffd937e4a113ef808baf980) Thanks [@phryneas](https://github.com/phryneas)! - Add `@nonreactive` and `@defer` directives to Apollo Client schema
|
|
17
|
+
|
|
18
|
+
- [#149](https://github.com/apollographql/vscode-graphql/pull/149) [`a8fe79f6`](https://github.com/apollographql/vscode-graphql/commit/a8fe79f665f02f16e8df8d90e5134c7bc944a72e) Thanks [@phryneas](https://github.com/phryneas)! - Add support for `apollo.config.mjs`.
|
|
19
|
+
|
|
20
|
+
- [#148](https://github.com/apollographql/vscode-graphql/pull/148) [`39430fdf`](https://github.com/apollographql/vscode-graphql/commit/39430fdfd46557eff7615b3fa8e9a90ff3d6071f) Thanks [@phryneas](https://github.com/phryneas)! - Modernization:
|
|
21
|
+
|
|
22
|
+
- move from `apollo-link-*` packages to `@apollo/client` dependency
|
|
23
|
+
- move from `@apollo/federation` to `@apollo/subgraph`
|
|
24
|
+
- replace `apollo-graphql` usage with `@graphql-tools/schema`
|
|
25
|
+
- drop `core-js` dependency
|
|
26
|
+
- update internally-used `@graphql-codegen`
|
|
27
|
+
- update `graphql` to v16
|
|
28
|
+
- replace `graphql-language-service-*` packages with `graphql-language-service` package
|
|
29
|
+
- remove `apollo-server-errors` dependency
|
|
30
|
+
|
|
31
|
+
- [#164](https://github.com/apollographql/vscode-graphql/pull/164) [`54316f24`](https://github.com/apollographql/vscode-graphql/commit/54316f24dc598734da35d663c5a754060d40ee1c) Thanks [@phryneas](https://github.com/phryneas)! - Fix configuration error display
|
|
32
|
+
|
|
33
|
+
- [`a6e6b7c1`](https://github.com/apollographql/vscode-graphql/commit/a6e6b7c1f02bbf79291cdd0d3c79224276e2eca2) Thanks [@phryneas](https://github.com/phryneas)! - Try schema path resolution relative to configuration path.
|
|
34
|
+
|
|
35
|
+
- [#149](https://github.com/apollographql/vscode-graphql/pull/149) [`a8fe79f6`](https://github.com/apollographql/vscode-graphql/commit/a8fe79f665f02f16e8df8d90e5134c7bc944a72e) Thanks [@phryneas](https://github.com/phryneas)! - Modernization:
|
|
36
|
+
|
|
37
|
+
- update `cosmiconfig`
|
|
38
|
+
- drop now-obsolete `@endemolshinegroup/cosmiconfig-typescript-loader`
|
|
39
|
+
|
|
40
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Configuration parsing has been reworked based on `zod`.
|
|
41
|
+
|
|
42
|
+
- [#153](https://github.com/apollographql/vscode-graphql/pull/153) [`a37cfaa6`](https://github.com/apollographql/vscode-graphql/commit/a37cfaa6bf20a8aa6ffd937e4a113ef808baf980) Thanks [@phryneas](https://github.com/phryneas)! - Remove unused `clientOnlyDirectives`, `clientSchemaDirectives` and `addTypename` client project config options.
|
|
43
|
+
|
|
44
|
+
- [#146](https://github.com/apollographql/vscode-graphql/pull/146) [`0721afe9`](https://github.com/apollographql/vscode-graphql/commit/0721afe9108a7b8b540fd18e967b9b138aee58f5) Thanks [@phryneas](https://github.com/phryneas)! - Modernization:
|
|
45
|
+
|
|
46
|
+
- set minimum VSCode version to 1.90.0
|
|
47
|
+
- update build target to ES2020
|
|
48
|
+
- drop `node-fetch` and similar polyfills
|
|
49
|
+
- update `vscode-languageclient/-server` modules
|
|
50
|
+
- migrate from the deprecated `vscode` module to `@types/vscode`
|
|
51
|
+
- update `typescript` developement dependency to 5.5
|
|
52
|
+
|
|
53
|
+
- [#163](https://github.com/apollographql/vscode-graphql/pull/163) [`70f8895a`](https://github.com/apollographql/vscode-graphql/commit/70f8895a5f82fd6056cd47b95a0b93847bc767c6) Thanks [@phryneas](https://github.com/phryneas)! - Remove support for unused configuration options
|
|
54
|
+
The configuration options `client.name`, `client.referenceId`, `client.version`, `client.statsWindow`, `client.clientOnlyDirectives`, and `client.clientSchemaDirectives` had no effect in the extension, so they have been removed.
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- [#150](https://github.com/apollographql/vscode-graphql/pull/150) [`eeed0b8e`](https://github.com/apollographql/vscode-graphql/commit/eeed0b8e2bbb109c5796b3cda5516c5a6817059a) Thanks [@phryneas](https://github.com/phryneas)! - Modernization
|
|
59
|
+
|
|
60
|
+
- update `glob`
|
|
61
|
+
- add E2E tests
|
|
62
|
+
|
|
63
|
+
- [#149](https://github.com/apollographql/vscode-graphql/pull/149) [`a8fe79f6`](https://github.com/apollographql/vscode-graphql/commit/a8fe79f665f02f16e8df8d90e5134c7bc944a72e) Thanks [@phryneas](https://github.com/phryneas)! - Fixed a bug where changes in `apollo.config.ts` or `apollo.config.cjs` would require a manual extension reload.
|
|
64
|
+
|
|
65
|
+
- [#160](https://github.com/apollographql/vscode-graphql/pull/160) [`5312c6e8`](https://github.com/apollographql/vscode-graphql/commit/5312c6e8cd1cddb0ad762843c30e62caf5169f1d) Thanks [@phryneas](https://github.com/phryneas)! - Replace `graphql-datasource` usage with `@apollo/client`
|
|
66
|
+
|
|
67
|
+
- [#161](https://github.com/apollographql/vscode-graphql/pull/161) [`7fd57310`](https://github.com/apollographql/vscode-graphql/commit/7fd57310e5483584068550b762d91491379b90a5) Thanks [@phryneas](https://github.com/phryneas)! - Only show "Run in Studio" gutter action for local graphs if an endpoint is configured.
|
|
68
|
+
|
|
69
|
+
- [#159](https://github.com/apollographql/vscode-graphql/pull/159) [`952ef37d`](https://github.com/apollographql/vscode-graphql/commit/952ef37df0cf035a1af46918ef1f38868a7aa282) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where unrelated project configurations could be merged into each other.
|
|
70
|
+
|
|
71
|
+
- [#161](https://github.com/apollographql/vscode-graphql/pull/161) [`7fd57310`](https://github.com/apollographql/vscode-graphql/commit/7fd57310e5483584068550b762d91491379b90a5) Thanks [@phryneas](https://github.com/phryneas)! - Modernization
|
|
72
|
+
|
|
73
|
+
- update `minimatch` and `lz-string`
|
|
74
|
+
- drop `await-to-js`, `resolve-from`, `sha.js`
|
|
75
|
+
- drop `query-string`
|
|
76
|
+
|
|
77
|
+
- [#161](https://github.com/apollographql/vscode-graphql/pull/161) [`7fd57310`](https://github.com/apollographql/vscode-graphql/commit/7fd57310e5483584068550b762d91491379b90a5) Thanks [@phryneas](https://github.com/phryneas)! - Fix a bug where the "Run in Studio" button would link to a Studio Graph instead of Explorer for local projects.
|
|
78
|
+
|
|
79
|
+
- [#160](https://github.com/apollographql/vscode-graphql/pull/160) [`5312c6e8`](https://github.com/apollographql/vscode-graphql/commit/5312c6e8cd1cddb0ad762843c30e62caf5169f1d) Thanks [@phryneas](https://github.com/phryneas)! - Prevent accidental creation of multiple output channels
|
|
80
|
+
|
|
81
|
+
## 1.20.0
|
|
82
|
+
|
|
83
|
+
### Minor Changes
|
|
84
|
+
|
|
85
|
+
- [#105](https://github.com/apollographql/vscode-graphql/pull/105) [`43879da4`](https://github.com/apollographql/vscode-graphql/commit/43879da40f3a3b7c6327cf165fca9980e04b4bc7) Thanks [@zovits](https://github.com/zovits)! - Add inline syntax highlighting support for Lua
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- [#99](https://github.com/apollographql/vscode-graphql/pull/99) [`2a3fc1bb`](https://github.com/apollographql/vscode-graphql/commit/2a3fc1bb3c38245f09a5e5e0a19900ea0cfc58b3) Thanks [@pvinis](https://github.com/pvinis)! - Support tagging inside of parentheses
|
|
90
|
+
|
|
91
|
+
- [#73](https://github.com/apollographql/vscode-graphql/pull/73) [`d07b303d`](https://github.com/apollographql/vscode-graphql/commit/d07b303d31fdf0810f8be163bb3973c564cf0754) Thanks [@rachsmithcodes](https://github.com/rachsmithcodes)! - Return early instead of erroring on missing fields
|
|
92
|
+
|
|
93
|
+
- [#97](https://github.com/apollographql/vscode-graphql/pull/97) [`2b57a1af`](https://github.com/apollographql/vscode-graphql/commit/2b57a1afd9882a139a47af9b55496b7aa62fde2b) Thanks [@clf17222592](https://github.com/clf17222592)! - Support configuration files with .cjs file extension
|
|
94
|
+
|
|
95
|
+
- [#78](https://github.com/apollographql/vscode-graphql/pull/78) [`8b02374a`](https://github.com/apollographql/vscode-graphql/commit/8b02374a355ef9304e1fe9b0d89bcf559e618428) Thanks [@jtgrenz](https://github.com/jtgrenz)! - Fix regex for ruby heredoc
|
|
96
|
+
|
|
97
|
+
### 1.19.11
|
|
98
|
+
|
|
99
|
+
- Fix directive highlighting on enums and arguments [#6716](https://github.com/apollographql/vscode-graphql/pull/71)
|
|
100
|
+
|
|
101
|
+
### 1.19.10
|
|
102
|
+
|
|
103
|
+
- Fix highlighting on schema extension directives [#66](https://github.com/apollographql/vscode-graphql/pull/66)
|
|
104
|
+
|
|
105
|
+
### 1.19.9
|
|
106
|
+
|
|
107
|
+
- Add validation/completion for #graphql annotated strings in js [#47](https://github.com/apollographql/vscode-graphql/pull/47)
|
|
108
|
+
- Add config option for disabling 'Run in Studio' button [#46](https://github.com/apollographql/vscode-graphql/pull/46)
|
|
109
|
+
- Add config option to disable switching to output tab on error [#44](https://github.com/apollographql/vscode-graphql/pull/44)
|
|
110
|
+
|
|
111
|
+
### 1.19.8
|
|
112
|
+
|
|
113
|
+
- Move 'Run in Studio' icon to end of line [#42](https://github.com/apollographql/vscode-graphql/pull/42)
|
|
114
|
+
- Fix syntax highlighting for directives on types [#36](https://github.com/apollographql/vscode-graphql/pull/36)
|
|
115
|
+
|
|
116
|
+
### 1.19.7
|
|
117
|
+
|
|
118
|
+
- Specify files with conflicting documents for the 'There are multiple definitions' message. [#29](https://github.com/apollographql/vscode-graphql/pull/29)
|
|
119
|
+
- Dont watch non file documents. Diff view will no longer crash extension. [#28](https://github.com/apollographql/vscode-graphql/pull/28)
|
|
120
|
+
- Upgrade graphql version to 15.5 [#34](https://github.com/apollographql/vscode-graphql/pull/34)
|
|
121
|
+
|
|
122
|
+
### 1.19.6
|
|
123
|
+
|
|
124
|
+
- Fix 'Run in explorer' link. [#25](https://github.com/apollographql/vscode-graphql/pull/25)
|
|
125
|
+
|
|
126
|
+
### 1.19.5
|
|
127
|
+
|
|
128
|
+
- Add a 'Run in explorer' gutter action. [#20](https://github.com/apollographql/vscode-graphql/pull/20)
|
|
129
|
+
- Switch Studio query that fetches timing hints to use a newer field. This should have no user-observable impact, though we may eventually remove the old field once most users have upgraded their extensions. [#22](https://github.com/apollographql/vscode-graphql/pull/22)
|
|
130
|
+
- Add support for highlighting Svelte files [#17](https://github.com/apollographql/vscode-graphql/pull/17)
|
|
131
|
+
- Add support for `.cjs` files [#4](https://github.com/apollographql/vscode-graphql/pull/4)
|
|
132
|
+
- Exclude localSchemaFile when looking for graphql documents. This should fix the common case for hitting `VSCode Plugin: Loading Schema Twice` errors. [#8](https://github.com/apollographql/vscode-graphql/pull/8)
|
|
133
|
+
|
|
134
|
+
### 1.19.4
|
|
135
|
+
|
|
136
|
+
- Fix VS Code extension performance issues for larger projects [#1938](https://github.com/apollographql/apollo-tooling/pull/1938)
|
|
137
|
+
|
|
138
|
+
-> _Note:_ This project used to live in the [apollo-tooling](https://github.com/apollographql/apollo-tooling) repo. Refer to the [apollo-tooling CHANGELOG](https://github.com/apollographql/apollo-tooling/blob/master/CHANGELOG.md) for full list of changes before April 25, 2021. See below for filtered changelog from apollo-tooling.
|
|
139
|
+
|
|
140
|
+
## Legacy apollo-tooling Changelog
|
|
141
|
+
|
|
142
|
+
### apollo-tools@0.5.1
|
|
143
|
+
|
|
144
|
+
- Remove dependency on `apollo-env`, so using this package no longer installs polyfills.
|
|
145
|
+
|
|
146
|
+
### apollo-env@0.10.0
|
|
147
|
+
|
|
148
|
+
- deps: Updated `node-fetch` to v2.6.1
|
|
149
|
+
|
|
150
|
+
### apollo-env@0.9.0
|
|
151
|
+
|
|
152
|
+
- The following utility functions are no longer exported from `apollo-env` and can now be found in the `apollo-graphql` library:
|
|
153
|
+
- `createHash`
|
|
154
|
+
- `isNodeLike`
|
|
155
|
+
- `mapValues`
|
|
156
|
+
- `isNotNullOrDefined`
|
|
157
|
+
|
|
158
|
+
### `apollo-language-server@1.14.3`
|
|
159
|
+
|
|
160
|
+
- `apollo-language-server@1.14.3`
|
|
161
|
+
- Fix issue where fragment definitions only included in `@client` fields would not be stripped ((AP-682)(https://golinks.io/AP-682), [#1454](https://github.com/apollographql/apollo-tooling/pull/1454))
|
|
162
|
+
|
|
163
|
+
### `apollo-language-server@1.14.2`
|
|
164
|
+
|
|
165
|
+
- `apollo-language-server@1.14.2`
|
|
166
|
+
- Fix #735 caused #928 error implement [#1461](https://github.com/apollographql/apollo-tooling/pull/1461)
|
|
167
|
+
- Fix dirname parsing for ts config files [#1463](https://github.com/apollographql/apollo-tooling/pull/1463)
|
|
168
|
+
|
|
169
|
+
### `vscode-apollo@1.9.1`, `apollo-language-server@1.14.1`
|
|
170
|
+
|
|
171
|
+
- `apollo-language-server@1.14.1`
|
|
172
|
+
- Fix cache invalidation bug for reload schema which caused outdated results in autocomplete [#1446](https://github.com/apollographql/apollo-tooling/pull/1446)
|
|
173
|
+
|
|
174
|
+
### `vscode-apollo@1.9.0`, `apollo-language-server@1.14.0`, `apollo-codegen-swift@0.34.2`
|
|
175
|
+
|
|
176
|
+
- `vscode-apollo@1.9.0`
|
|
177
|
+
- Add Dart support for vscode [#1385](https://github.com/apollographql/apollo-tooling/pull/1385)
|
|
178
|
+
- `apollo-language-server@1.14.0`
|
|
179
|
+
- Add Dart operation extraction [#1385](https://github.com/apollographql/apollo-tooling/pull/1385)
|
|
180
|
+
- `apollo-codegen-swift@0.34.2`
|
|
181
|
+
- Prevent compiler warnings for redundant access-level modifiers when using `--namespace` [1241](https://github.com/apollographql/apollo-tooling/pull/1241)
|
|
182
|
+
|
|
183
|
+
### `apollo-language-server@1.5.2`, `vscode-apollo@1.5.2`
|
|
184
|
+
|
|
185
|
+
- `apollo-language-server@1.5.2`
|
|
186
|
+
- fix single apollo.config breaking others loaded at the same time [#1055](https://github.com/apollographql/apollo-tooling/pull/1055)
|
|
187
|
+
- Fix broken fileSet.includesFile to use full filepath [#1055](https://github.com/apollographql/apollo-tooling/pull/1055)
|
|
188
|
+
- `vscode-apollo@1.5.2`
|
|
189
|
+
|
|
190
|
+
### `apollo-env@0.3.1`
|
|
191
|
+
|
|
192
|
+
- `apollo-env@0.3.1`
|
|
193
|
+
- Fix core-js dependency by pinning to `3.0.0-beta.3` [#961](https://github.com/apollographql/apollo-tooling/pull/961)
|
|
194
|
+
|
|
195
|
+
### `apollo-language-server@1.4.1`
|
|
196
|
+
|
|
197
|
+
- `apollo-language-server` 1.4.1
|
|
198
|
+
- Fix edge case for empty operations [#959](https://github.com/apollographql/apollo-tooling/pull/959)
|
|
199
|
+
|
|
200
|
+
### `apollo-language-server@1.0.0`
|
|
201
|
+
|
|
202
|
+
> NOTE: Many of the updates and changes in this release came from a complete rebuild of the Apollo CLI in preparation for GraphQL summit. Many of these changes can be traced to [this commit](https://github.com/apollographql/apollo-tooling/commit/d2d73f9c597845355b7ee267e411d80d1c493043) but aren't tied to a specific pull request, and won't be linked.
|
|
203
|
+
|
|
204
|
+
- `apollo-language-server@1.0.0`
|
|
205
|
+
- Initial release of `apollo-language-server` to support `vscode-apollo`, and `apollo`
|
|
206
|
+
- Supports editor features for...
|
|
207
|
+
- Autocompletion of GraphQL documents
|
|
208
|
+
- Hover information for fields anr arguments
|
|
209
|
+
- Type definitions and references
|
|
210
|
+
- Code lenses for open files
|
|
211
|
+
- `vscode-apollo@1.0.0`
|
|
212
|
+
- Initial Release of `vscode-apollo`
|
|
213
|
+
- Switching of schema tags [#632](https://github.com/apollographql/apollo-tooling/pull/632)
|
|
214
|
+
- Supports all of the editor features exposed by `apollo-language-server`
|
|
215
|
+
|
|
216
|
+
#### :rocket: Feature
|
|
217
|
+
|
|
218
|
+
- `apollo-language-server`, `apollo-vscode`
|
|
219
|
+
- [#536](https://github.com/apollographql/apollo-tooling/pull/536) Display status of loading tasks for config and Engine stats ([@shadaj](https://github.com/shadaj))
|
|
220
|
+
|
|
221
|
+
#### :bug: Bug Fix
|
|
222
|
+
|
|
223
|
+
- `apollo-cli`, `apollo-language-server`, `apollo-vscode`
|
|
224
|
+
- [#519](https://github.com/apollographql/apollo-tooling/pull/519) [VSCode] Fix detection of projects inside folders ([@shadaj](https://github.com/shadaj))
|
|
225
|
+
|
|
226
|
+
#### :memo: Documentation
|
|
227
|
+
|
|
228
|
+
- `apollo-cli`, `apollo-vscode`
|
|
229
|
+
- [#521](https://github.com/apollographql/apollo-tooling/pull/521) Add README for the VS Code extension ([@shadaj](https://github.com/shadaj))
|
|
230
|
+
|
|
231
|
+
#### :rocket: Feature
|
|
232
|
+
|
|
233
|
+
- `apollo-language-server`
|
|
234
|
+
- [#516](https://github.com/apollographql/apollo-tooling/pull/516) Code complete default query variables ([@shadaj](https://github.com/shadaj))
|
|
235
|
+
- `apollo-language-server`, `apollo-vscode`
|
|
236
|
+
- [#515](https://github.com/apollographql/apollo-tooling/pull/515) Fix missing descriptions and add more hover information for arguments ([@shadaj](https://github.com/shadaj))
|
|
237
|
+
- `apollo-cli`, `apollo-codegen-core`, `apollo-language-server`, `apollo-vscode-webview`, `apollo-vscode`
|
|
238
|
+
- [#512](https://github.com/apollographql/apollo-tooling/pull/512) React UI for webviews, fix file tracking and fragment spreads ([@shadaj](https://github.com/shadaj))
|
|
239
|
+
- `apollo-cli`, `apollo-language-server`, `apollo-vscode`
|
|
240
|
+
- [#508](https://github.com/apollographql/apollo-tooling/pull/508) Support jumping to definitions in schema ([@shadaj](https://github.com/shadaj))
|
|
241
|
+
|
|
242
|
+
#### :house: Internal
|
|
243
|
+
|
|
244
|
+
- `apollo-cli`, `apollo-language-server`
|
|
245
|
+
- [#506](https://github.com/apollographql/apollo-tooling/pull/506) Share validation logic between CLI and language server ([@shadaj](https://github.com/shadaj))
|
|
246
|
+
|
|
247
|
+
#### :rocket: Feature
|
|
248
|
+
|
|
249
|
+
- `apollo-language-server`, `apollo-vscode`
|
|
250
|
+
- [#504](https://github.com/apollographql/apollo-tooling/pull/504) Add Apollo VS Code extension ([@shadaj](https://github.com/shadaj))
|
package/CODEOWNERS
ADDED
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2021 Apollo GraphQL
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,57 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://www.apollographql.com/"><img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/apollo-wordmark.png" height="100" alt=""></a>
|
|
5
|
+
</p>
|
|
6
|
+
<h1>Apollo GraphQL for VS Code</h1>
|
|
7
|
+
|
|
8
|
+
[](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo) [](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo) [](https://circleci.com/gh/apollographql/vscode-graphql) [](https://community.apollographql.com) [](https://discord.gg/graphos)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
2
11
|
|
|
3
12
|
GraphQL has the potential to create incredible developer experiences, thanks to its strongly typed schema and query language. The Apollo platform brings these possibilities to life by enhancing your editor with rich metadata from your graph API.
|
|
4
13
|
|
|
5
|
-

|
|
6
15
|
|
|
7
16
|
The Apollo GraphQL extension for VS Code brings an all-in-one tooling experience for developing apps with Apollo.
|
|
8
17
|
|
|
9
|
-
- Add [syntax highlighting](#syntax) for GraphQL files and gql templates inside JavaScript files
|
|
10
|
-
- Get instant feedback and [intelligent autocomplete](#autocomplete) for fields, arguments, types, and variables as you write queries
|
|
11
|
-
-
|
|
12
|
-
-
|
|
18
|
+
- Add [syntax highlighting](#syntax-highlighting) for GraphQL files and gql templates inside JavaScript files
|
|
19
|
+
- Get instant feedback and [intelligent autocomplete](#intelligent-autocomplete) for fields, arguments, types, and variables as you write queries
|
|
20
|
+
- Manage client side schema alongside remote schema
|
|
21
|
+
- See [performance information](#performance-insights) inline with your query definitions
|
|
13
22
|
- Validate field and argument usage in operations
|
|
14
|
-
- [Navigate projects](#navigating-projects)
|
|
23
|
+
- [Navigate projects more easily](#navigating-projects) with jump-to and peek-at definitions
|
|
15
24
|
- Manage [client-only](#client-only-schemas) schemas
|
|
16
|
-
- [Switch
|
|
25
|
+
- [Switch graph variants](#graph-variant-switching) to work with schemas running on different environments
|
|
17
26
|
|
|
18
27
|
<h2 id="getting-started">Getting started</h2>
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
To get all the benefits of the VS Code experience, it's best to link the schema that is being developed against before installing the extension. The best way to do that is by [publishing a schema](https://www.apollographql.com/docs/graphos/delivery/publishing-schemas/) to the Apollo schema registry. After that's done:
|
|
21
30
|
|
|
22
|
-
1. Create an `apollo.config.js` at the root of the project
|
|
23
|
-
|
|
31
|
+
1. Create an `apollo.config.js` file at the root of the project.
|
|
32
|
+
Alternatively, you can create a `cjs`, `mjs`, or `ts` file with the same configuration.
|
|
33
|
+
2. Obtain a [Personal API key](https://www.apollographql.com/docs/graphos/api-keys) from GraphOS Studio.
|
|
24
34
|
|
|
25
35
|
<h3 id="apollo-config">Setting up an Apollo config</h3>
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
For the VS Code plugin to know how to find the schema, it needs to be linked to either a published schema or a local one. To link a project to a published schema, edit the `apollo.config.js` file to look like this:
|
|
28
38
|
|
|
29
39
|
```js
|
|
30
40
|
module.exports = {
|
|
31
41
|
client: {
|
|
32
|
-
service: "my-graphql-app"
|
|
33
|
-
}
|
|
42
|
+
service: "my-graphql-app",
|
|
43
|
+
},
|
|
34
44
|
};
|
|
35
45
|
```
|
|
36
46
|
|
|
37
|
-
The service name is the
|
|
47
|
+
The `service` name is the name of the graph you've created in [GraphOS Studio](https://studio.apollographql.com).
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
See [additional configuration options](#additional-apollo-config-options).
|
|
40
50
|
|
|
41
|
-
<h3 id="api-key">Setting up
|
|
42
|
-
To authenticate with Apollo to pull down the schema, create a file next to the `apollo.config.js` called `.env`. This should be an untracked file (i.e. don't push it to GitHub). Go to the settings page of the published service and create a new API key.
|
|
51
|
+
<h3 id="api-key">Setting up the <code>.env</code> file</h3>
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
To authenticate with GraphOS Studio to pull down your schema, create a `.env` file in the same directory as the `apollo.config.js` file. This should be an untracked file (that is, don't commit it to Git).
|
|
45
54
|
|
|
46
|
-
|
|
55
|
+
Then go to your [User Settings page](https://studio.apollographql.com/user-settings/api-keys?referrer=docs-content) in GraphOS Studio to create a new Personal API key.
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
> It is best practice to create a new API key for each member of the team and name the key so its easy to find and revoke if needed. This will be easier to manage in the future.
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
After the key is found, add the following line to the `.env` file:
|
|
60
|
+
|
|
61
|
+
```bash showLineNumbers=false
|
|
51
62
|
APOLLO_KEY=<enter copied key here>
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
After this is done, VS Code
|
|
65
|
+
After this is done, VS Code can be reloaded and the Apollo integration will connect to GraphOS Studio to provide autocomplete, validation, and more.
|
|
55
66
|
|
|
56
67
|
<h3 id="local-schemas">Local schemas</h3>
|
|
57
68
|
|
|
@@ -62,95 +73,133 @@ module.exports = {
|
|
|
62
73
|
client: {
|
|
63
74
|
service: {
|
|
64
75
|
name: "my-graphql-app",
|
|
65
|
-
url: "http://localhost:4000/graphql"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
76
|
+
url: "http://localhost:4000/graphql",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
68
79
|
};
|
|
69
80
|
```
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
Linking to the local schema won't provide all features, such as switching graph variants and performance metrics.
|
|
72
83
|
|
|
73
|
-
|
|
84
|
+
<h3 id="local-schema-files">Local schema files</h3>
|
|
85
|
+
|
|
86
|
+
You might not always have a running server to link to, so the extension also supports linking to a local schema file.
|
|
87
|
+
This is useful for working on a schema in isolation or for testing out new features.
|
|
88
|
+
To link to a local schema file, add the following to the `apollo.config.js` file:
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
module.exports = {
|
|
92
|
+
client: {
|
|
93
|
+
service: {
|
|
94
|
+
// can be a string pointing to a single file or an array of strings
|
|
95
|
+
localSchemaFile: "./path/to/schema.graphql",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
```
|
|
74
100
|
|
|
75
101
|
<h3 id="client-only-schemas">Client-only schemas</h3>
|
|
76
102
|
|
|
77
|
-
One of the best features of the VS Code extension is the automatic merging of remote schemas and local ones when using integrated state management with Apollo Client. This happens automatically whenever schema definitions are found within a client project. By default, the VS Code extension will look for all files under `./src` to find both the operations and schema definitions for building a complete schema for the application.
|
|
103
|
+
One of the best features of the VS Code extension is the automatic merging of remote schemas and local ones when using integrated state management with Apollo Client. This happens automatically whenever schema definitions are found within a client project. By default, the VS Code extension will look for all JavaScript, TypeScript and GraphQL files under `./src` to find both the operations and schema definitions for building a complete schema for the application.
|
|
78
104
|
|
|
79
|
-
Client
|
|
105
|
+
Client side schema definitions can be spread throughout the client app project and will be merged together to create one single schema. The default behavior can be controlled by adding specifications to the `apollo.config.js`:
|
|
80
106
|
|
|
81
107
|
```js
|
|
82
108
|
module.exports = {
|
|
83
109
|
client: {
|
|
84
|
-
service: "my-graphql-app"
|
|
110
|
+
service: "my-graphql-app",
|
|
111
|
+
// array of glob patterns
|
|
85
112
|
includes: ["./src/**/*.js"],
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
113
|
+
// array of glob patterns
|
|
114
|
+
excludes: ["**/__tests__/**"],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
89
117
|
```
|
|
90
118
|
|
|
91
119
|
<h3 id="get-the-extension">Get the extension</h3>
|
|
92
120
|
|
|
93
|
-
Once you have a config set up and a schema published,
|
|
121
|
+
Once you have a config set up and a schema published, [install the Apollo GraphQL extension](https://marketplace.visualstudio.com/items?itemName=apollographql.vscode-apollo), then try opening a file containing a GraphQL operation.
|
|
94
122
|
|
|
95
123
|
When a file open, clicking the status bar icon will open the output window and print stats about the project associated with that file. This is helpful when confirming the project is setup properly.
|
|
96
124
|
|
|
97
|
-
<img src="https://raw.githubusercontent.com/apollographql/
|
|
125
|
+
<img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/stats.gif" alt="Clicking the status bar icon to open the output pane">
|
|
98
126
|
|
|
99
127
|
<h2 id="features">Features</h2>
|
|
100
128
|
|
|
101
129
|
Apollo for VS Code brings many helpful features for working on a GraphQL project.
|
|
102
130
|
|
|
103
|
-
<h3 id="autocomplete">Intelligent autocomplete</h3>
|
|
131
|
+
<h3 id="intelligent-autocomplete">Intelligent autocomplete</h3>
|
|
104
132
|
|
|
105
133
|
Once configured, VS Code has full knowledge of the schema clients are running operations against, including client-only schemas (for things like local state mutations). Because of this, it have the ability to autocomplete fields and arguments as you type.
|
|
106
134
|
|
|
107
|
-
<img src="https://raw.githubusercontent.com/apollographql/
|
|
135
|
+
<img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/autocomplete.gif" alt="vscode completing a field when typing">
|
|
108
136
|
|
|
109
137
|
<h3 id="errors-and-warnings">Inline errors and warnings</h3>
|
|
110
138
|
|
|
111
139
|
VS Code can use local or published schemas to validate operations before running them. **Syntax errors**, **invalid fields or arguments**, and even **deprecated fields** instantly appear as errors or warnings right in your editor, ensuring all developers are working with the most up-to-date production schemas.
|
|
112
140
|
|
|
113
|
-
<img src="https://raw.githubusercontent.com/apollographql/
|
|
141
|
+
<img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/warnings-and-errors.gif" alt="tooltip showing a field deprecation warning and error">
|
|
114
142
|
|
|
115
143
|
<h3 id="field-type-info">Inline field type information</h3>
|
|
116
144
|
|
|
117
145
|
Because of GraphQL's strongly-typed schema, VS Code not only know about which fields and arguments are valid, but also what types are expected. Hover over any type in a valid GraphQL operation to see what type that field returns and whether or not it can be null.
|
|
118
146
|
|
|
119
|
-
<img src="https://raw.githubusercontent.com/apollographql/
|
|
147
|
+
<img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/type-info.png" style="max-width:800px;" alt="a tooltip showing a Boolean type for a field">
|
|
120
148
|
|
|
121
149
|
<h3 id="performance-insights">Performance insights</h3>
|
|
122
150
|
|
|
123
151
|
GraphQL's flexibility can make it difficult to predict the cost of an operation. Without insight into how expensive an operation is, developers can accidentally write queries that place strain on their graph API's underlying backends. Thanks to the Apollo platform's integration with VS Code and our trace warehouse, teams can avoid these performance issues altogether by instantly seeing the cost of a query right in their editor.
|
|
124
152
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
The VS Code extension will show inline performance diagnostics when connected to a service with reported metrics in Apollo Studio. As operations are typed, any fields that take longer than 1ms to respond will be annotated to the right of the field inline! This gives team members a picture of how long the operation will take as more and more fields are added to operations or fragments.
|
|
153
|
+
The VS Code extension will show inline performance diagnostics when connected to a service with reported metrics in GraphOS Studio. As operations are typed, any fields that take longer than 1 ms to respond will be annotated to the right of the field inline! This gives team members a picture of how long the operation will take as more and more fields are added to operations or fragments.
|
|
128
154
|
|
|
129
|
-
<img
|
|
155
|
+
<img
|
|
156
|
+
src="https://raw.githubusercontent.com/apollographql/vscode-graphql/80a6ca4ae59173b8cef25020345e4ebe202eec41/images/marketplace/perf-annotation.png"
|
|
157
|
+
width="80%"
|
|
158
|
+
style="margin: 5%"
|
|
159
|
+
alt="Performance annotation next to a field"
|
|
160
|
+
/>
|
|
130
161
|
|
|
131
|
-
<h3 id="syntax">Syntax highlighting</h3>
|
|
162
|
+
<h3 id="syntax-highlighting">Syntax highlighting</h3>
|
|
132
163
|
|
|
133
|
-
Apollo's editor extension provides syntax highlighting for all things GraphQL, including schema definitions in `.graphql` files, complex queries in TypeScript, and even client-only schema extensions. Syntax highlighting for GraphQL works out-of-the-box for `.graphql`, `.gql`, `.js` and `.ts` file types
|
|
164
|
+
Apollo's editor extension provides syntax highlighting for all things GraphQL, including schema definitions in `.graphql` files, complex queries in TypeScript, and even client-only schema extensions. Syntax highlighting for GraphQL works out-of-the-box for `.graphql`, `.gql`, `.js` and `.ts` file types.
|
|
134
165
|
|
|
135
166
|
<h3 id="navigating-projects">Navigating projects</h3>
|
|
136
167
|
|
|
137
|
-
Navigating large codebases can be difficult, but the Apollo GraphQL extension makes this easier
|
|
168
|
+
Navigating large codebases can be difficult, but the Apollo GraphQL extension makes this easier. Right-clicking on any field in operations or schemas gives you the ability to jump to (or peek at) definitions, as well as find any other references to that field in your project.
|
|
138
169
|
|
|
139
|
-
<img src="https://raw.githubusercontent.com/apollographql/
|
|
170
|
+
<img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/jump-to-def.gif" alt="Using jump to definition on a fragment">
|
|
140
171
|
|
|
141
|
-
<h3 id="
|
|
172
|
+
<h3 id="graph-variant-switching">Schema tag switching</h3>
|
|
142
173
|
|
|
143
|
-
|
|
174
|
+
Apollo supports publishing multiple versions ([variants](https://www.apollographql.com/docs/graphos/graphs/#variants)) of a schema. This is useful for developing on a future development schema and preparing your clients to conform to that schema. To switch between graph variants, open the Command Palette (`cmd + shift + p` on mac), search "Apollo" and choose the "Apollo: Select Schema Tag" option.
|
|
144
175
|
|
|
145
176
|
<h2 id="troubleshooting">Troubleshooting</h2>
|
|
146
177
|
|
|
147
|
-
The most common errors are configuration errors, like a missing `.env` file
|
|
148
|
-
There is more information about configuring an Apollo projects [here](https://www.apollographql.com/docs/references/apollo-config.html).
|
|
178
|
+
The most common errors are configuration errors, like a missing `.env` file or incorrect service information in the `apollo.config.js` file. Please see [the Apollo config docs](https://www.apollographql.com/docs/devtools/apollo-config/) for more configuration guidance.
|
|
149
179
|
|
|
150
180
|
Other errors may be caused from an old version of a published schema. To reload a schema, open the Command Palette (`cmd + shift + p` on mac), search "Apollo" and choose the "Apollo: Reload Schema" option.
|
|
151
181
|
|
|
152
|
-
Sometimes errors will show up as a notification at the bottom of your editor. Other, less critical messages may be shown in the output pane of the editor. To open the output pane and get diagnostic information about the extension and the current service loaded (if working with a client project), just click the "Apollo GraphQL" icon in the status bar at the bottom.
|
|
182
|
+
Sometimes errors will show up as a notification at the bottom of your editor. Other, less critical, messages may be shown in the output pane of the editor. To open the output pane and get diagnostic information about the extension and the current service loaded (if working with a client project), just click the "Apollo GraphQL" icon in the status bar at the bottom.
|
|
183
|
+
|
|
184
|
+
<img src="https://raw.githubusercontent.com/apollographql/vscode-graphql/main/images/marketplace/stats.gif" alt="Clicking the status bar icon to open the output pane">
|
|
185
|
+
|
|
186
|
+
If problems persist or the error messages are unhelpful, open an [issue](https://github.com/apollographql/vscode-graphql/issues) in the `vscode-graphql` repository.
|
|
187
|
+
|
|
188
|
+
<h2 id="additional-apollo-config-options">Additional Apollo config options</h2>
|
|
189
|
+
|
|
190
|
+
You can add these configurations to your [Apollo config file](#setting-up-an-apollo-config).
|
|
191
|
+
|
|
192
|
+
<h3 id="option-client-tagName">client.tagName</h3>
|
|
153
193
|
|
|
154
|
-
|
|
194
|
+
_Optional_ - custom tagged template literal.
|
|
155
195
|
|
|
156
|
-
|
|
196
|
+
When using GraphQL with JavaScript or TypeScript projects, it is common to use the `gql` tagged template literal to write out operations. Apollo tools look through your files for the `gql` tag to extract your queries, so if you use a different template literal, you can configure it like so:
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
module.exports = {
|
|
200
|
+
client: {
|
|
201
|
+
tagName: "graphql", // highlight-line
|
|
202
|
+
service: ...
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
```
|
package/codegen.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Would be better to get the schema from the Studio registry once it can be a public variant.
|
|
2
|
+
schema: https://graphql.api.apollographql.com/api/graphql
|
|
3
|
+
generates:
|
|
4
|
+
./src/language-server/graphqlTypes.ts:
|
|
5
|
+
documents:
|
|
6
|
+
- src/**/*.ts
|
|
7
|
+
- "!src/**/__tests__**/*.ts"
|
|
8
|
+
plugins:
|
|
9
|
+
- typescript
|
|
10
|
+
- typescript-operations
|
|
11
|
+
config:
|
|
12
|
+
avoidOptionals: true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" viewBox="0 0 20 20" width="7" height="7">
|
|
2
|
+
<title>
|
|
3
|
+
Exported from Streamline App (https://app.streamlineicons.com)
|
|
4
|
+
</title>
|
|
5
|
+
<g transform="matrix(2.54 0 0 2.54 10 9.97)" id="LVKu-U2gXNoh456TxJx47" >
|
|
6
|
+
<path style="stroke: rgb(255,255,255); stroke-width: 1; stroke-dasharray: none; stroke-linecap: round; stroke-dashoffset: 0; stroke-linejoin: round; stroke-miterlimit: 4; fill: #2075D6; fill-rule: evenodd; opacity: 1;" vector-effect="non-scaling-stroke" transform=" translate(-10.25, -9.71)" d="M 7 6.502 L 7 12.926 C 7 13.293 7.317 13.534 7.592 13.379 L 13.259 10.166 C 13.408058725855952 10.063593398311438 13.49712261259461 9.89434694032026 13.49712261259461 9.7135 C 13.49712261259461 9.532653059679742 13.408058725855952 9.363406601688563 13.259 9.261000000000001 L 7.592 6.047 C 7.317 5.893 7 6.135 7 6.502 Z" stroke-linecap="round" />
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
Binary file
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Config } from "@jest/types";
|
|
2
|
+
|
|
3
|
+
const config: Config.InitialOptions = {
|
|
4
|
+
roots: ["<rootDir>/src"],
|
|
5
|
+
snapshotFormat: {
|
|
6
|
+
escapeString: true,
|
|
7
|
+
printBasicPrototype: true,
|
|
8
|
+
},
|
|
9
|
+
testMatch: ["**/__tests__/**/*.ts"],
|
|
10
|
+
testPathIgnorePatterns: [
|
|
11
|
+
"/node_modules/",
|
|
12
|
+
"/fixtures/",
|
|
13
|
+
"/snapshotSerializers/",
|
|
14
|
+
],
|
|
15
|
+
transform: {
|
|
16
|
+
"^.+\\.(ts)$": "ts-jest",
|
|
17
|
+
},
|
|
18
|
+
prettierPath: null,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// see https://github.com/microsoft/vscode-test/issues/37#issuecomment-700167820
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
moduleFileExtensions: ["js", "ts"],
|
|
6
|
+
testMatch: ["<rootDir>/src/**/*.e2e.ts"],
|
|
7
|
+
testEnvironment: "./src/__e2e__/vscode-environment.js",
|
|
8
|
+
setupFiles: ["./src/__e2e__/setup.js"],
|
|
9
|
+
verbose: true,
|
|
10
|
+
moduleNameMapper: {
|
|
11
|
+
vscode: path.join(__dirname, "src", "__e2e__", "vscode.js"),
|
|
12
|
+
},
|
|
13
|
+
transform: {
|
|
14
|
+
"^.+\\.(ts)$": "ts-jest",
|
|
15
|
+
},
|
|
16
|
+
prettierPath: null,
|
|
17
|
+
};
|