-
Notifications
You must be signed in to change notification settings - Fork 747
fix(lsp): manifest resolver always reports "Failed to download" #7065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,25 +64,38 @@ export class ManifestResolver { | |
| }).getNewETagContent(this.getEtag()) | ||
|
|
||
| if (!resp.content) { | ||
| throw new ToolkitError( | ||
| `New content was not downloaded; fallback to the locally stored "${this.lsName}" manifest` | ||
| ) | ||
| const msg = `"${this.lsName}" manifest unchanged, skipping download: ${this.manifestURL}` | ||
|
Comment on lines
66
to
+67
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The old code would always report a failed |
||
| logger.debug(msg) | ||
|
|
||
| const localManifest = await this.getLocalManifest(true).catch(() => undefined) | ||
| if (localManifest) { | ||
| localManifest.location = 'remote' | ||
|
Comment on lines
+70
to
+72
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The common case is that etag didnt change. So that's handled here by re-using |
||
| return localManifest | ||
| } else { | ||
| // Will emit a `languageServer_setup` result=failed metric... | ||
| throw new ToolkitError(msg) | ||
| } | ||
| } | ||
|
|
||
| logger.debug(`fetched "${this.lsName}" manifest: ${this.manifestURL}`) | ||
| const manifest = this.parseManifest(resp.content) | ||
| await this.saveManifest(resp.eTag, resp.content) | ||
| await this.checkDeprecation(manifest) | ||
| manifest.location = 'remote' | ||
| return manifest | ||
| } | ||
|
|
||
| private async getLocalManifest(): Promise<Manifest> { | ||
| logger.info(`Failed to download latest "${this.lsName}" manifest. Falling back to local manifest.`) | ||
| private async getLocalManifest(silent: boolean = false): Promise<Manifest> { | ||
|
Comment on lines
-80
to
+88
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always reporting "failed to download" here is misleading because this will happen when "etag didnt change". |
||
| if (!silent) { | ||
| logger.info(`trying local "${this.lsName}" manifest...`) | ||
| } | ||
| const storage = this.getStorage() | ||
| const manifestData = storage[this.lsName] | ||
|
|
||
| if (!manifestData?.content) { | ||
| throw new ToolkitError(`Failed to download "${this.lsName}" manifest and no local manifest found.`) | ||
| const msg = `local "${this.lsName}" manifest not found` | ||
| logger.warn(msg) | ||
| throw new ToolkitError(msg) | ||
| } | ||
|
|
||
| const manifest = this.parseManifest(manifestData.content) | ||
|
|
@@ -145,6 +158,7 @@ export class ManifestResolver { | |
| ...storage, | ||
| [this.lsName]: { | ||
| etag, | ||
| // XXX: this stores the entire manifest. vscode warns about our globalStorage size... | ||
| content, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are storing the entire manifest in globalStorage :/ |
||
| }, | ||
| }) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this
finally. If an exception was thrown, it didn't really "finish" setup?