-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ovsx-client: introduce async
ovsx-client
provider (#10327)
The commit fixes an issue where the api version was not read properly or on time in the backend leading to installing a potentially incompatible version of an extension (as it would not respect the declared api). The code was refactored in a way to wait until the api version was ready from either the environment variable or cli contribution. The changes will now create the ovsclient only when the proper values are ready fixing any potential problems caused by previous timing issues. The changes should: - use the default api if required for both the frontend and backend - use the cli contribution (provided by `--vscode-api-version`) overriding the default for both the frontend and backend - use the environment variable overriding the default for both the frontend and backend The changes will now properly respect the api version when searching extension, and installing them (resolving them in the backend). Any potential breaking changes are documented in the `changelog`. Signed-off-by: vince-fugnitto <[email protected]> Co-authored-by: Paul Marechal <[email protected]>
- Loading branch information
1 parent
5049437
commit bf00fd0
Showing
12 changed files
with
131 additions
and
113 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2021 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
export const VSX_ENVIRONMENT_PATH = '/services/vsx-environment'; | ||
|
||
export const VSXEnvironment = Symbol('VSXEnvironment'); | ||
export interface VSXEnvironment { | ||
getRegistryUri(): Promise<string>; | ||
getRegistryApiUri(): Promise<string>; | ||
getVscodeApiVersion(): Promise<string>; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2020 TypeFox and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { injectable, inject } from '@theia/core/shared/inversify'; | ||
import URI from '@theia/core/lib/common/uri'; | ||
import { PluginVsCodeCliContribution } from '@theia/plugin-ext-vscode/lib/node/plugin-vscode-cli-contribution'; | ||
import { VSXEnvironment } from '../common/vsx-environment'; | ||
|
||
@injectable() | ||
export class VSXEnvironmentImpl implements VSXEnvironment { | ||
|
||
protected _registryUri = new URI(process.env['VSX_REGISTRY_URL']?.trim() || 'https://open-vsx.org'); | ||
|
||
@inject(PluginVsCodeCliContribution) | ||
protected readonly pluginVscodeCli: PluginVsCodeCliContribution; | ||
|
||
async getRegistryUri(): Promise<string> { | ||
return this._registryUri.toString(true); | ||
} | ||
|
||
async getRegistryApiUri(): Promise<string> { | ||
return this._registryUri.resolve('api').toString(true); | ||
} | ||
|
||
async getVscodeApiVersion(): Promise<string> { | ||
return this.pluginVscodeCli.vsCodeApiVersionPromise; | ||
} | ||
} |
This file contains 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
This file contains 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