vscode-apollo 2.5.4 → 2.5.6

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.
@@ -25,7 +25,17 @@ jobs:
25
25
  - run: npm install
26
26
  - run: echo 'APOLLO_KEY="service:bob-123:489fhseo4"' > ./sampleWorkspace/spotifyGraph/.env
27
27
  shell: bash
28
+
29
+ # Print rover version per OS
28
30
  - name: Install & Configure Rover (Linux)
31
+ run: ./node_modules/.bin/rover --version
32
+ if: runner.os == 'Linux'
33
+ - name: Install Rover (Windows)
34
+ run: ./node_modules/.bin/rover.cmd --version
35
+ if: runner.os == 'Windows'
36
+
37
+ # auth rover per OS
38
+ - name: Configure Rover (Linux)
29
39
  run: |
30
40
  expect <<EOF
31
41
  spawn ./node_modules/.bin/rover config auth --profile VSCode-E2E
@@ -34,9 +44,6 @@ jobs:
34
44
  expect eof
35
45
  EOF
36
46
  if: runner.os == 'Linux'
37
- - name: Install Rover (Windows)
38
- run: ./node_modules/.bin/rover.cmd --version
39
- if: runner.os == 'Windows'
40
47
  - name: Configure Rover (Windows)
41
48
  run: |
42
49
  [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
@@ -48,6 +55,15 @@ jobs:
48
55
  [System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
49
56
  if: runner.os == 'Windows'
50
57
  shell: powershell
58
+
59
+ # Print profiles per OS
60
+ - name: Print Rover profiles (Linux)
61
+ run: ./node_modules/.bin/rover config list
62
+ if: runner.os == 'Linux'
63
+ - name: Print Rover profiles (Windows)
64
+ run: ./node_modules/.bin/rover.cmd config list
65
+ if: runner.os == 'Windows'
66
+
51
67
  - name: Adjust configuration (Windows)
52
68
  run: |
53
69
  sed -i -e 's/\(bin:.*\)/\1.exe/' sampleWorkspace/rover/apollo.config.yaml
@@ -56,7 +72,10 @@ jobs:
56
72
  echo "module.exports = require('./jest.e2e.config')" > jest.config.ts
57
73
  shell: bash
58
74
  if: runner.os == 'Windows'
75
+
59
76
  - run: npm run build:production
77
+
78
+ # Run test per OS
60
79
  - name: "Run Extension E2E tests (Linux)"
61
80
  run: xvfb-run -a npm run test:extension
62
81
  env:
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.5.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#290](https://github.com/apollographql/vscode-graphql/pull/290) [`84d0503`](https://github.com/apollographql/vscode-graphql/commit/84d05030c253c0b8c3c26dc273527a33ac5e7129) Thanks [@Jephuff](https://github.com/Jephuff)! - Fix subgraph detection on windows
8
+
9
+ - [#282](https://github.com/apollographql/vscode-graphql/pull/282) [`52017e3`](https://github.com/apollographql/vscode-graphql/commit/52017e3479cfe8c07d19fa52c2ebe10f65de766c) Thanks [@pubmodmatt](https://github.com/pubmodmatt)! - Improve syntax highlighting for GraphQL block strings
10
+
11
+ ## 2.5.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [#280](https://github.com/apollographql/vscode-graphql/pull/280) [`ce6b4a8`](https://github.com/apollographql/vscode-graphql/commit/ce6b4a840d94c95efa19b645077230c422f0616e) Thanks [@pubmodmatt](https://github.com/pubmodmatt)! - Fix an issue where adding a new Apollo configuration file would not be detected
16
+
17
+ - [#278](https://github.com/apollographql/vscode-graphql/pull/278) [`ff969e6`](https://github.com/apollographql/vscode-graphql/commit/ff969e6d64b6aa8ed865215d71344c41e85da19f) Thanks [@Meschreiber](https://github.com/Meschreiber)! - Update README/Marketplace page
18
+
3
19
  ## 2.5.4
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -15,24 +15,31 @@ Thanks to its strongly typed schema and query language, GraphQL has the potentia
15
15
 
16
16
  The Apollo GraphQL extension for VS Code brings an all-in-one tooling experience for developing apps with Apollo.
17
17
 
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
22
- - Extra features to help you with [supergraph editing](#supergraph-editing)
23
- - Validate field and argument usage in operations
24
- - [Navigate projects more easily](#navigating-projects) with jump-to and peek-at definitions
25
- - Manage [client-only](#client-only-schemas) schemas
18
+ The extension provides:
19
+
20
+ - [Syntax highlighting](#syntax-highlighting) for GraphQL files and `gql` templates in JavaScript
21
+ - Real-time feedback, including [intelligent autocomplete](#intelligent-autocomplete) for fields, arguments, types, and variables as you write queries
22
+ - Client-side and remote schema management, including [client-only](#client-only-schemas) schemas
23
+ - Inline [performance information](#performance-insights) and [supergraph editing](#supergraph-editing) tool
24
+ - [Streamlined project navigation](#navigating-projects) with jump-to and peek-at definitions
26
25
  - [Switch graph variants](#graph-variant-switching) to work with schemas running on different environments
26
+ - (Experimental) [Apollo Client DevTools](#devtools) in your IDE
27
+
28
+ Starting with version 2.3.3, the extension also works with Apollo Connectors. [Learn more.](#developing-connectors)
27
29
 
28
30
  <h2 id="getting-started">Getting started</h2>
29
31
 
30
- The VS Code plugin must be linked to a published or local schema. To do so, create an `apollo.config.json` file at the root of the project.
32
+
33
+ The VS Code extension must be linked to a published or local schema via a configuration file.
34
+
35
+ <h3 id="configuration">Configuration</h3>
36
+
37
+ The VS Code extension requires a `apollo.config.json` configuration file at the root of the project.
31
38
  Alternatively, you can create a `yaml`, `cjs`, `mjs`, or `ts` file with the same configuration.
32
39
 
33
- For the contents of this configuration file, select one of these options:
40
+ Select one of the options below to define the contents of this configuration file.
34
41
 
35
- <h3>Configure extension for client development with schemas published to Apollo GraphOS</h3>
42
+ <h4>Configure extension for client development with schemas published to Apollo GraphOS</h4>
36
43
  <details>
37
44
  <summary>
38
45
  <i>Expand for instructions.</i>
@@ -70,7 +77,7 @@ Afterward, reload VS Code. The Apollo integration will connect to GraphOS Studio
70
77
 
71
78
  </details>
72
79
 
73
- <h3>Configure extension for supergraph schema development</h3>
80
+ <h4>Configure extension for supergraph schema development</h4>
74
81
  <details>
75
82
  <summary>
76
83
  <i>Expand for instructions.</i>
@@ -107,7 +114,7 @@ Afterward, reload VS Code. The Apollo extension will start using Rover to help y
107
114
 
108
115
  </details>
109
116
 
110
- <h3 id="local-schemas">Configure extension for client development with introspection from a locally running service</h3>
117
+ <h4 id="local-schemas">Configure extension for client development with introspection from a locally running service</h4>
111
118
  <details>
112
119
  <summary>
113
120
  <i>Expand for instructions.</i>
@@ -130,7 +137,7 @@ Linking to local schemas won't provide all extension features, such as switching
130
137
 
131
138
  </details>
132
139
 
133
- <h3 id="local-schema-files">Configure extension for client development with local schema files</h3>
140
+ <h4 id="local-schema-files">Configure extension for client development with local schema files</h4>
134
141
  <details>
135
142
  <summary>
136
143
  <i>Expand for instructions.</i>
@@ -153,7 +160,7 @@ To link to a local schema file, add the following to the `apollo.config.json` fi
153
160
 
154
161
  </details>
155
162
 
156
- <h3 id="client-only-schemas">Bonus: Adding client-only schemas</h3>
163
+ <h4 id="client-only-schemas">Bonus: Adding client-only schemas</h4>
157
164
  <details>
158
165
  <summary>
159
166
  <i>Expand for instructions.</i>
@@ -243,6 +250,64 @@ Navigating large codebases can be difficult, but the Apollo GraphQL extension ma
243
250
 
244
251
  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.
245
252
 
253
+ <h3 id="developing-connectors">Developing Connectors</h3>
254
+
255
+ Starting with version 2.3.3, the Apollo GraphQL VS Code extension can give you fast feedback on your Apollo Connectors in VS Code. Through it, you can get the _same_ validations that composition provides, with errors and hints highlighted in your schema file on each save.
256
+
257
+ <h4 id="prerequisites">Prerequisites</h4>
258
+
259
+ These composition-based diagnostics are powered by Rover. You'll need Rover version 0.27.0 or later [installed](/rover/getting-started) to use composition-based diagnostics.
260
+
261
+ <h4 id="connector-configuration">Connector Configuration</h4>
262
+
263
+ By default, you need two files in the root of your project to enable connector validations in VS Code:
264
+
265
+ 1. An `apollo.config.yaml` file containing `rover: {}`
266
+ 2. A `supergraph.yaml` file that's the
267
+ [configuration file](/rover/commands/supergraphs#yaml-configuration-file)
268
+ used for `rover dev`, `rover supergraph compose`, and this VS Code extension.
269
+ 1. Make sure to set the composition version to {products.federation.version("connectors").version}.
270
+ 2. Make sure every file you want feedback on is included in the `subgraphs` section.
271
+
272
+ You can use a different location for your `supergraph.yaml` by setting the `rover.supergraphConfig` option in
273
+ `apollo.config.yaml`, like this:
274
+
275
+ ```yaml title="apollo.config.yaml"
276
+ rover:
277
+ supergraphConfig: path/to/supergraph.yaml
278
+ ```
279
+
280
+ <h3 id="devtools">(Experimental) Apollo Client DevTools in your IDE</h3>
281
+
282
+ The Apollo VSCode extension ships with an instance of the [Apollo Client Devtools](https://chromewebstore.google.com/detail/apollo-client-devtools/jdkknkkbebbapilgoeccciglkfbmbnfm).
283
+ You can use it to remotely debug your client, making it easier to debug React Native and Node.js applications.
284
+
285
+ To configure it, follow these steps:
286
+
287
+ 1. In the VS code settings dialog, set the **Apollographql > Dev Tools: Show Panel** setting to `detect` or `always`.
288
+ 1. In your code base, install the `@apollo/client-devtools-vscode` package:
289
+
290
+ ```sh
291
+ npm install @apollo/client-devtools-vscode
292
+ ```
293
+
294
+ 1. After initializing your `ApolloClient` instance, call `connectApolloClientToVSCodeDevTools` with your client instance.
295
+
296
+ ```js
297
+ import { connectApolloClientToVSCodeDevTools } from "@apollo/client-devtools-vscode";
298
+
299
+ const client = new ApolloClient({ /* ... */ });
300
+
301
+ // We recommend wrapping this statement in a check for e.g. process.env.NODE_ENV === "development"
302
+ const devtoolsRegistration = connectApolloClientToVSCodeDevTools(
303
+ client,
304
+ // the default port of the VSCode DevTools is 7095
305
+ "ws://localhost:7095",
306
+ );
307
+ ```
308
+ 1. Open the **Apollo Client DevTools** panel in VS Code.
309
+ 1. Start your application. It should automatically connect to the DevTools.
310
+
246
311
  <h2 id="troubleshooting">Troubleshooting</h2>
247
312
 
248
313
  The most common errors are configuration errors, like a missing `.env` file or incorrect service information in the `apollo.config.json` file. Please see [the Apollo config docs](https://www.apollographql.com/docs/devtools/apollo-config/) for more configuration guidance.
@@ -255,6 +320,30 @@ Sometimes, errors will appear as a notification at the bottom of your editor. Ot
255
320
 
256
321
  If problems persist or the error messages are unhelpful, open an [issue](https://github.com/apollographql/vscode-graphql/issues) in the `vscode-graphql` repository.
257
322
 
323
+ <h3 id="reloading-extension">Reloading the extension</h3>
324
+
325
+ If you aren't seeing diagnostics, try reloading the extension by running the `Apollo: Reload schema` command from the command palette.
326
+
327
+ <h3 id="turn-on-autosave">Turn on autosave</h3>
328
+
329
+ Most diagnostics will only appear when you save your schema file.
330
+ If you enable autosave in VS Code, you'll see feedback each time you finish typing.
331
+
332
+ <h3 id="double-check-rover-version">Double-check your Rover version</h3>
333
+
334
+ If you aren't seeing diagnostics for Apollo Connectors, run `rover --version` in a terminal to ensure you have version 0.27.0 or later.
335
+ You can also specify a path to a specific Rover binary in your `apollo.config.yaml` file:
336
+
337
+ ```yaml title="apollo.config.yaml"
338
+ rover:
339
+ bin: /path/to/rover
340
+ ```
341
+
342
+ <h3 id="debug-logging">Debug logging</h3>
343
+
344
+ If the extension isn't working as expected, you can set the apollographql.trace.server setting to verbose in your VS Code settings.
345
+ This setting adds detailed logs to the output panel of the extension, which can aid in debugging.
346
+
258
347
  <h2 id="additional-apollo-config-options">Additional Apollo config options</h2>
259
348
 
260
349
  You can add these configurations to your [Apollo config file](#setting-up-an-apollo-config).
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vscode-apollo",
3
3
  "displayName": "Apollo GraphQL",
4
4
  "description": "Rich editor support for GraphQL client and server development that seamlessly integrates with the Apollo platform",
5
- "version": "2.5.4",
5
+ "version": "2.5.6",
6
6
  "referenceID": "87197759-7617-40d0-b32e-46d378e907c7",
7
7
  "author": "Apollo GraphQL <opensource@apollographql.com>",
8
8
  "license": "MIT",
@@ -56,7 +56,7 @@
56
56
  "minimatch": "10.0.1",
57
57
  "moment": "2.30.1",
58
58
  "semver": "7.6.3",
59
- "undici": "6.21.0",
59
+ "undici": "6.21.1",
60
60
  "vscode-languageclient": "9.0.1",
61
61
  "vscode-languageserver": "9.0.1",
62
62
  "vscode-languageserver-textdocument": "1.0.12",
@@ -67,7 +67,7 @@
67
67
  "zod-validation-error": "3.4.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@apollo/rover": "0.27.0-preview.0",
70
+ "@apollo/rover": "0.27.0",
71
71
  "@changesets/changelog-github": "0.5.0",
72
72
  "@changesets/cli": "2.27.10",
73
73
  "@graphql-codegen/cli": "5.0.2",
@@ -83,7 +83,7 @@
83
83
  "@vscode/test-cli": "0.0.10",
84
84
  "@vscode/test-electron": "2.4.1",
85
85
  "@wry/trie": "0.5.0",
86
- "esbuild": "0.23.0",
86
+ "esbuild": "0.25.0",
87
87
  "eslint": "8.52.0",
88
88
  "eslint-config-prettier": "9.1.0",
89
89
  "eslint-plugin-prettier": "5.2.1",
@@ -1,3 +1,3 @@
1
1
  rover:
2
2
  profile: VSCode-E2E
3
- bin: ../../node_modules/@apollo/rover/binary/rover-0.27.0-alpha.0
3
+ bin: ../../node_modules/@apollo/rover/binary/rover-0.27.0
@@ -0,0 +1,4 @@
1
+ subgraphs:
2
+ subgraph:
3
+ schema:
4
+ file: src/test.graphql
@@ -21,14 +21,14 @@ test.each([
21
21
  ] as const)("%s with `type: '%s'`", async (project, moduleType) => {
22
22
  await writeFile(
23
23
  resolveRelativeToSampleWorkspace(`configFileTypes/${project}/package.json`),
24
- JSON.stringify(
24
+ `${JSON.stringify(
25
25
  {
26
26
  name: "test",
27
27
  type: moduleType,
28
28
  },
29
29
  undefined,
30
30
  2,
31
- ),
31
+ )}\n`,
32
32
  "utf-8",
33
33
  );
34
34
  await reloadService();
@@ -1,9 +1,3 @@
1
- import { test as origTest } from "@jest/globals";
2
- import { load } from "js-yaml";
3
- import { readFileSync } from "node:fs";
4
- import { execFileSync } from "node:child_process";
5
- import { join } from "node:path";
6
- import { ParsedApolloConfigFormat } from "../config";
7
1
  import { TextEditor } from "vscode";
8
2
  import {
9
3
  closeAllEditors,
@@ -16,36 +10,6 @@ import {
16
10
  getDefinitions,
17
11
  } from "./utils";
18
12
 
19
- // we want to skip these tests unless the user running them has a rover config profile named "VSCode-E2E"
20
- let test = origTest.skip;
21
- try {
22
- const roverProjectDir = join(__dirname, "../../../sampleWorkspace/rover");
23
- const config = load(
24
- readFileSync(join(roverProjectDir, "apollo.config.yaml"), "utf-8"),
25
- ) as ParsedApolloConfigFormat;
26
- const roverBin = join(roverProjectDir, config.rover!.bin);
27
- const result = execFileSync(roverBin, [
28
- "config",
29
- "list",
30
- "--format=json",
31
- ]).toString("utf8");
32
- const parsed = JSON.parse(result);
33
- if (parsed.data.profiles.includes("VSCode-E2E")) {
34
- test = origTest;
35
- }
36
- } catch (e) {}
37
- if (test === origTest.skip) {
38
- console.info(
39
- "Skipping rover E2E tests: no profile with the name 'VSCode-E2E'\n" +
40
- "You can create one by running `rover config auth --profile VSCode-E2E`",
41
- );
42
- }
43
-
44
- if (process.platform === "win32") {
45
- console.info("Skipping rover E2E tests in Windows");
46
- test = origTest.skip;
47
- }
48
-
49
13
  let editor: TextEditor;
50
14
  let getPosition: GetPositionFn;
51
15
  beforeAll(async () => {
@@ -73,47 +37,71 @@ test("completion", async () => {
73
37
  [
74
38
  {
75
39
  "detail": undefined,
40
+ "label": "@authenticated",
41
+ },
42
+ {
43
+ "detail": "",
76
44
  "label": "@deprecated",
77
45
  },
78
46
  {
79
- "detail": undefined,
47
+ "detail": "",
80
48
  "label": "@external",
81
49
  },
82
50
  {
83
51
  "detail": undefined,
84
- "label": "@federation__authenticated",
52
+ "label": "@inaccessible",
85
53
  },
86
54
  {
87
- "detail": undefined,
88
- "label": "@federation__inaccessible",
55
+ "detail": "",
56
+ "label": "@override(…)",
89
57
  },
90
58
  {
91
59
  "detail": undefined,
92
- "label": "@federation__policy(…)",
60
+ "label": "@policy(…)",
93
61
  },
94
62
  {
95
63
  "detail": undefined,
96
- "label": "@federation__provides(…)",
64
+ "label": "@provides(…)",
97
65
  },
98
66
  {
99
- "detail": undefined,
100
- "label": "@federation__requiresScopes(…)",
67
+ "detail": "",
68
+ "label": "@requires(…)",
101
69
  },
102
70
  {
103
71
  "detail": undefined,
104
- "label": "@federation__tag(…)",
72
+ "label": "@requiresScopes(…)",
105
73
  },
106
74
  {
107
- "detail": undefined,
108
- "label": "@override(…)",
75
+ "detail": "",
76
+ "label": "@shareable",
109
77
  },
110
78
  {
111
79
  "detail": undefined,
112
- "label": "@requires(…)",
80
+ "label": "@tag(…)",
81
+ },
82
+ {
83
+ "detail": "",
84
+ "label": "@federation__authenticated",
85
+ },
86
+ {
87
+ "detail": "",
88
+ "label": "@federation__inaccessible",
89
+ },
90
+ {
91
+ "detail": "",
92
+ "label": "@federation__policy(…)",
93
+ },
94
+ {
95
+ "detail": "",
96
+ "label": "@federation__provides(…)",
97
+ },
98
+ {
99
+ "detail": "",
100
+ "label": "@federation__requiresScopes(…)",
113
101
  },
114
102
  {
115
103
  "detail": undefined,
116
- "label": "@shareable",
104
+ "label": "@federation__tag(…)",
117
105
  },
118
106
  ]
119
107
  `);
@@ -322,8 +322,10 @@ export abstract class ApolloConfig {
322
322
  get configDirURI() {
323
323
  // if the filepath has a _file_ in it, then we get its dir
324
324
  return this.configURI &&
325
- this.configURI.fsPath.match(/\.(ts|js|cjs|mjs|yaml|yml|json)$/i)
326
- ? URI.parse(dirname(this.configURI.fsPath))
325
+ this.configURI.path.match(/\.(ts|js|cjs|mjs|yaml|yml|json)$/i)
326
+ ? URI.from(this.configURI).with({
327
+ path: dirname(this.configURI.path),
328
+ })
327
329
  : this.configURI;
328
330
  }
329
331
 
@@ -228,12 +228,12 @@ export class GraphQLWorkspace {
228
228
  folder: { uri: folderUri } as WorkspaceFolder,
229
229
  });
230
230
 
231
+ this.reloadService();
231
232
  const existingProjects = this.projectsByFolderUri.get(folderUri) || [];
232
233
  this.projectsByFolderUri.set(folderUri, [
233
234
  ...existingProjects,
234
235
  newProject,
235
236
  ]);
236
- this.reloadService();
237
237
  }
238
238
  }
239
239
 
@@ -52,9 +52,8 @@ export function getLanguageServerClient(
52
52
  documentSelector: supportedLanguageIds,
53
53
  synchronize: {
54
54
  fileEvents: [
55
- workspace.createFileSystemWatcher(
56
- "**/{.env?(.local),apollo.config.{json,yml,yaml}}",
57
- ),
55
+ workspace.createFileSystemWatcher("**/{.env?(.local)}"),
56
+ workspace.createFileSystemWatcher("**/apollo.config.{json,yml,yaml}"),
58
57
  workspace.createFileSystemWatcher(
59
58
  "**/*{" + supportedExtensions.join(",") + "}",
60
59
  ),
@@ -485,6 +485,19 @@
485
485
  "1": { "name": "constant.language.null.graphql" }
486
486
  }
487
487
  },
488
+ "graphql-block-string-value": {
489
+ "contentName": "string.quoted.triple.block.graphql",
490
+ "begin": "\\s*+((\"\"\"))",
491
+ "end": "\\s*+((\"\"\"))",
492
+ "beginCaptures": {
493
+ "1": { "name": "string.quoted.triple.block.graphql" },
494
+ "2": { "name": "punctuation.definition.string.begin.graphql" }
495
+ },
496
+ "endCaptures": {
497
+ "1": { "name": "string.quoted.triple.block.graphql" },
498
+ "2": { "name": "punctuation.definition.string.end.graphql" }
499
+ }
500
+ },
488
501
  "graphql-string-value": {
489
502
  "contentName": "string.quoted.double.graphql",
490
503
  "begin": "\\s*+((\"))",
@@ -553,6 +566,7 @@
553
566
  "patterns": [
554
567
  { "include": "#graphql-variable-name" },
555
568
  { "include": "#graphql-float-value" },
569
+ { "include": "#graphql-block-string-value" },
556
570
  { "include": "#graphql-string-value" },
557
571
  { "include": "#graphql-boolean-value" },
558
572
  { "include": "#graphql-null-value" },