This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Fix VS Code extension issue by sending a different GQL query for VSCE#40621
Merged
Conversation
philipp-spiess
commented
Aug 19, 2022
| // GraphQL | ||
| const graphQL: typeof sourcegraph['graphQL'] = { | ||
| execute: (query, variables) => clientAPI.requestGraphQL(query, variables), | ||
| execute: ((query: any, variables: any) => clientAPI.requestGraphQL(query, variables)) as any, |
Contributor
Author
There was a problem hiding this comment.
I have absolutely no clue why but my VS Code builds kept on erroring here:
ERROR in /Users/philipp/dev/sourcegraph/client/shared/src/api/extension/extensionApi.ts
../shared/src/api/extension/extensionApi.ts 307:39-81
[tsl] ERROR in /Users/philipp/dev/sourcegraph/client/shared/src/api/extension/extensionApi.ts(307,40)
TS2322: Type 'Promise<SuccessGraphQLResult<any>> | Promise<ErrorGraphQLResult<any>>' is not assignable to type 'Promise<GraphQLResult<TResult>>'.
Type 'Promise<ErrorGraphQLResult<any>>' is not assignable to type 'Promise<GraphQLResult<TResult>>'.
Type 'ErrorGraphQLResult<any>' is not assignable to type 'GraphQLResult<TResult>'.
Type 'ErrorGraphQLResult<any>' is not assignable to type 'ErrorGraphQLResult<TResult>'.
Types of property 'errors' are incompatible.
Type 'readonly import("/Users/philipp/dev/sourcegraph/node_modules/graphql/error/GraphQLError").GraphQLError[]' is not assignable to type 'readonly import("/Users/philipp/dev/sourcegraph/client/vscode/code-intel-extensions/node_modules/graphql/error/GraphQLError").GraphQLError[]'.
Type 'import("/Users/philipp/dev/sourcegraph/node_modules/graphql/error/GraphQLError").GraphQLError' is not assignable to type 'import("/Users/philipp/dev/sourcegraph/client/vscode/code-intel-extensions/node_modules/graphql/error/GraphQLError").GraphQLError'.
Types of property 'extensions' are incompatible.
Type '{ [key: string]: any; } | undefined' is not assignable to type '{ [key: string]: any; }'.
Type 'undefined' is not assignable to type '{ [key: string]: any; }'.
webviews compiled in 325978 ms
[19:23:35] 'webpack' errored after 5.43 min
Since there was no other way to build main, I decide to merge this upstream. Extension API seems like something we will soon remove anyways!
philipp-spiess
commented
Aug 19, 2022
| "sourcegraph/verilog", | ||
| "sourcegraph/vhdl" | ||
| ] | ||
| ["sourcegraph/apex","sourcegraph/clojure","sourcegraph/cobol","sourcegraph/cpp","sourcegraph/csharp","sourcegraph/cuda","sourcegraph/dart","sourcegraph/elixir","sourcegraph/erlang","sourcegraph/go","sourcegraph/graphql","sourcegraph/groovy","sourcegraph/haskell","sourcegraph/java","sourcegraph/jsonnet","sourcegraph/kotlin","sourcegraph/lisp","sourcegraph/lua","sourcegraph/ocaml","sourcegraph/pascal","sourcegraph/perl","sourcegraph/php","sourcegraph/powershell","sourcegraph/protobuf","sourcegraph/python","sourcegraph/r","sourcegraph/ruby","sourcegraph/rust","sourcegraph/scala","sourcegraph/shell","sourcegraph/starlark","sourcegraph/strato","sourcegraph/swift","sourcegraph/tcl","sourcegraph/thrift","sourcegraph/typescript","sourcegraph/verilog","sourcegraph/vhdl"] No newline at end of file |
Contributor
Author
There was a problem hiding this comment.
This diff was always created when I ran yarn build-vsce so we might as well keep it in main.
olafurpg
reviewed
Aug 19, 2022
| }, | ||
| request: !IS_VSCE | ||
| ? gql` | ||
| query HighlightedFile( |
Contributor
There was a problem hiding this comment.
Nit: can we extract these large literals into toplevel consts with some helpful variable name and a comment explaining what this query is used for?
olafurpg
approved these changes
Aug 19, 2022
olafurpg
left a comment
Contributor
There was a problem hiding this comment.
Thank you for looking into this! LGTM 👍 just a minor nit suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A recent change changed one of the GraphQL queries that the VS Code extension is using to add a new field that was only recently added to the GraphQL backend (c.f. here).
This unfortunately is not available on "older" server versions including
3.42.1. This means that every person that updates their VS Code extension release now and is on an on-prem server that lags a bit behind will see the search broken.We do not yet have a system to get the server version and make decisions based on it so I decide to fix it by reverting to the previous query in the VS Code environment (the backend is written in a way that it can handle older clients, just not the other way around).
Test plan
I verified that this fixes the VSCE issue by running a query against
3.42.1.App preview:
Check out the client app preview documentation to learn more.