mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Support filtering remoteExtensionTips by platform (#175246)
This commit is contained in:
parent
7cfe4e043b
commit
cc99387a09
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.76.0",
|
||||
"distro": "ef7b3fe403fb76194fc61bc83b4b53af19a8f704",
|
||||
"distro": "30820417178d1e9f8ca7347ab291696ee134692f",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
|
@ -135,7 +135,9 @@ export const enum Platform {
|
|||
Linux,
|
||||
Windows
|
||||
}
|
||||
export function PlatformToString(platform: Platform) {
|
||||
export type PlatformName = 'Web' | 'Windows' | 'Mac' | 'Linux';
|
||||
|
||||
export function PlatformToString(platform: Platform): PlatformName {
|
||||
switch (platform) {
|
||||
case Platform.Web: return 'Web';
|
||||
case Platform.Mac: return 'Mac';
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import { PlatformName } from 'vs/base/common/platform';
|
||||
|
||||
export interface IBuiltInExtension {
|
||||
readonly name: string;
|
||||
|
@ -198,11 +199,13 @@ export interface IExeBasedExtensionTip {
|
|||
export interface IRemoteExtensionTip {
|
||||
friendlyName: string;
|
||||
extensionId: string;
|
||||
supportedPlatforms?: PlatformName[];
|
||||
}
|
||||
|
||||
export interface IVirtualWorkspaceExtensionTip {
|
||||
friendlyName: string;
|
||||
extensionId: string;
|
||||
supportedPlatforms?: PlatformName[];
|
||||
}
|
||||
|
||||
export interface ISurveyData {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
import { ExtensionRecommendations, ExtensionRecommendation } from 'vs/workbench/contrib/extensions/browser/extensionRecommendations';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { ExtensionRecommendationReason } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
|
||||
import { PlatformToString, platform } from 'vs/base/common/platform';
|
||||
|
||||
export class RemoteRecommendations extends ExtensionRecommendations {
|
||||
|
||||
|
@ -20,7 +21,8 @@ export class RemoteRecommendations extends ExtensionRecommendations {
|
|||
|
||||
protected async doActivate(): Promise<void> {
|
||||
const extensionTips = { ...this.productService.remoteExtensionTips, ...this.productService.virtualWorkspaceExtensionTips };
|
||||
this._recommendations = Object.entries(extensionTips).map(([_, extension]) => ({
|
||||
const currentPlatform = PlatformToString(platform);
|
||||
this._recommendations = Object.values(extensionTips).filter(({ supportedPlatforms }) => !supportedPlatforms || supportedPlatforms.includes(currentPlatform)).map(extension => ({
|
||||
extensionId: extension.extensionId.toLowerCase(),
|
||||
reason: {
|
||||
reasonId: ExtensionRecommendationReason.Application,
|
||||
|
|
|
@ -21,7 +21,7 @@ import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/envir
|
|||
import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection';
|
||||
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { isWeb } from 'vs/base/common/platform';
|
||||
import { PlatformToString, isWeb, platform } from 'vs/base/common/platform';
|
||||
import { once } from 'vs/base/common/functional';
|
||||
import { truncate } from 'vs/base/common/strings';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
|
@ -513,11 +513,14 @@ export class RemoteStatusIndicator extends Disposable implements IWorkbenchContr
|
|||
|
||||
private hasAdditionalRemoteExtensions() {
|
||||
const extensionTips = { ...this.productService.remoteExtensionTips, ...this.productService.virtualWorkspaceExtensionTips };
|
||||
for (const [_, extension] of Object.entries(extensionTips)) {
|
||||
const { extensionId: recommendedExtensionId } = extension;
|
||||
// if this recommended extension isn't already installed, return early
|
||||
if (!this.extensionService.extensions.some((extension) => extension.id?.toLowerCase() === recommendedExtensionId.toLowerCase())) {
|
||||
return true;
|
||||
const currentPlatform = PlatformToString(platform);
|
||||
for (const extension of Object.values(extensionTips)) {
|
||||
const { extensionId: recommendedExtensionId, supportedPlatforms } = extension;
|
||||
if (!supportedPlatforms || supportedPlatforms.includes(currentPlatform)) {
|
||||
// if this recommended extension isn't already installed, return early
|
||||
if (!this.extensionService.extensions.some((extension) => extension.id?.toLowerCase() === recommendedExtensionId.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue