Skip to content

Commit

Permalink
Fix fetch call for VS Code before 1.82.0. (#11683)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-mcmanus authored Nov 14, 2023
1 parent 5325b37 commit 383579d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cpptools",
"displayName": "C/C++",
"description": "C/C++ IntelliSense, debugging, and code browsing.",
"version": "1.18.3-main",
"version": "1.18.4-main",
"publisher": "ms-vscode",
"icon": "LanguageCCPP_color_128x.png",
"readme": "README.md",
Expand Down Expand Up @@ -6312,6 +6312,7 @@
"@types/mkdirp": "^0.5.2",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.9",
"@types/node-fetch": "^2.6.9",
"@types/plist": "^3.0.2",
"@types/semver": "^7.1.0",
"@types/shell-quote": "^1.7.1",
Expand Down
2 changes: 2 additions & 0 deletions Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,8 @@ export async function preReleaseCheck(): Promise<void> {
// First we need to make sure the user isn't already on a pre-release version and hasn't dismissed this prompt before.
if (!isOnPreRelease.Value && !displayedPreReleasePrompt.Value && util.getCppToolsTargetPopulation() === TargetPopulation.Public) {
// Get the info on the latest version from the marketplace to check if there is a pre-release version available.
const nodeFetch = await import('node-fetch'); // dynamic import is required
const fetch = nodeFetch.default; // Node.js 18 fetch isn't available until VS 1.82.
const response = await fetch('https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery', {
method: 'POST',
headers: {
Expand Down
8 changes: 8 additions & 0 deletions Extension/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,14 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.1.tgz#2f4f65bb08bc368ac39c96da7b2f09140b26851b"
integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==

"@types/node-fetch@^2.6.9":
version "2.6.9"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e"
integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==
dependencies:
"@types/node" "*"
form-data "^4.0.0"

"@types/node@*":
version "20.4.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.1.tgz#a6033a8718653c50ac4962977e14d0f984d9527d"
Expand Down

0 comments on commit 383579d

Please sign in to comment.