Skip to content

Commit

Permalink
Merge branch 'master' into bamurtaugh/install-debug-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
bamurtaugh authored Aug 4, 2020
2 parents 6520fb2 + 6250371 commit a733898
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/vs/platform/webview/common/resourceLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function normalizeRequestPath(requestUri: URI) {
//

// Encode requestUri.path so that URI.parse can properly parse special characters like '#', '?', etc.
const resourceUri = URI.parse(encodeURIComponent(requestUri.path).replace(/%2F/g, '/').replace(/^\/([a-z0-9\-]+)\/{1,2}/i, (_: string, scheme: string, sep: string) => {
const resourceUri = URI.parse(encodeURIComponent(requestUri.path).replace(/%2F/gi, '/').replace(/^\/([a-z0-9\-]+)(\/{1,2})/i, (_: string, scheme: string, sep: string) => {
if (sep.length === 1) {
return `${scheme}:///`; // Add empty authority.
} else {
Expand Down
46 changes: 23 additions & 23 deletions src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {

private accountsActivityAction: ActivityAction | undefined;

private accountsActivity: ICompositeActivity[] = [];

private readonly compositeActions = new Map<string, { activityAction: ViewContainerActivityAction, pinnedAction: ToggleCompositePinnedAction }>();
private readonly viewContainerDisposables = new Map<string, IDisposable>();

Expand Down Expand Up @@ -319,53 +321,49 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}

if (viewContainerOrActionId === GLOBAL_ACTIVITY_ID) {
return this.showGlobalActivity(badge, clazz, priority);
return this.showGlobalActivity(this.globalActivity, this.globalActivityAction, badge, clazz, priority);
}

if (viewContainerOrActionId === ACCOUNTS_ACTIIVTY_ID) {
if (this.accountsActivityAction) {
this.accountsActivityAction.setBadge(badge, clazz);

return toDisposable(() => this.accountsActivityAction?.setBadge(undefined));
}
return this.showGlobalActivity(this.accountsActivity, this.accountsActivityAction, badge, clazz, priority);
}

return Disposable.None;
}

private showGlobalActivity(badge: IBadge, clazz?: string, priority?: number): IDisposable {
private showGlobalActivity(activityCache: ICompositeActivity[], activityAction: ActivityAction | undefined, badge: IBadge, clazz?: string, priority?: number): IDisposable {
if (typeof priority !== 'number') {
priority = 0;
}
const activity: ICompositeActivity = { badge, clazz, priority };

for (let i = 0; i <= this.globalActivity.length; i++) {
if (i === this.globalActivity.length) {
this.globalActivity.push(activity);
for (let i = 0; i <= activityCache.length; i++) {
if (i === activityCache.length) {
activityCache.push(activity);
break;
} else if (this.globalActivity[i].priority <= priority) {
this.globalActivity.splice(i, 0, activity);
} else if (activityCache[i].priority <= priority) {
activityCache.splice(i, 0, activity);
break;
}
}
this.updateGlobalActivity();
this.updateGlobalActivity(activityCache, activityAction);

return toDisposable(() => this.removeGlobalActivity(activity));
return toDisposable(() => this.removeGlobalActivity(activityCache, activityAction, activity));
}

private removeGlobalActivity(activity: ICompositeActivity): void {
const index = this.globalActivity.indexOf(activity);
private removeGlobalActivity(activityCache: ICompositeActivity[], activityAction: ActivityAction | undefined, activity: ICompositeActivity): void {
const index = activityCache.indexOf(activity);
if (index !== -1) {
this.globalActivity.splice(index, 1);
this.updateGlobalActivity();
activityCache.splice(index, 1);
this.updateGlobalActivity(activityCache, activityAction);
}
}

private updateGlobalActivity(): void {
const globalActivityAction = assertIsDefined(this.globalActivityAction);
if (this.globalActivity.length) {
const [{ badge, clazz, priority }] = this.globalActivity;
if (badge instanceof NumberBadge && this.globalActivity.length > 1) {
private updateGlobalActivity(activityCache: ICompositeActivity[], activityAction: ActivityAction | undefined): void {
const globalActivityAction = assertIsDefined(activityAction);
if (activityCache.length) {
const [{ badge, clazz, priority }] = activityCache;
if (badge instanceof NumberBadge && activityCache.length > 1) {
const cumulativeNumberBadge = this.getCumulativeNumberBadge(priority);
globalActivityAction.setBadge(cumulativeNumberBadge);
} else {
Expand Down Expand Up @@ -626,6 +624,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.globalActivityActionBar.push(this.accountsActivityAction, { index: ActivitybarPart.ACCOUNTS_ACTION_INDEX });
}
}

this.updateGlobalActivity(this.accountsActivity, this.accountsActivityAction);
}

private getCompositeActions(compositeId: string): { activityAction: ViewContainerActivityAction, pinnedAction: ToggleCompositePinnedAction } {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ExtensionRecommendationReason } from 'vs/workbench/services/extensionMa
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService';

type ExeExtensionRecommendationsClassification = {
extensionId: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' };
Expand All @@ -31,6 +32,7 @@ export class ExeBasedRecommendations extends ExtensionRecommendations {
isExtensionAllowedToBeRecommended: (extensionId: string) => boolean,
@IExtensionTipsService private readonly extensionTipsService: IExtensionTipsService,
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
@ITASExperimentService private readonly tasExperimentService: ITASExperimentService,
@IInstantiationService instantiationService: IInstantiationService,
@IConfigurationService configurationService: IConfigurationService,
@INotificationService notificationService: INotificationService,
Expand Down Expand Up @@ -76,7 +78,7 @@ export class ExeBasedRecommendations extends ExtensionRecommendations {
this.promptImportantExeBasedRecommendations(uninstalled, importantExeBasedRecommendations);
}

private promptImportantExeBasedRecommendations(recommendations: string[], importantExeBasedRecommendations: IStringDictionary<IExecutableBasedExtensionTip>): void {
private async promptImportantExeBasedRecommendations(recommendations: string[], importantExeBasedRecommendations: IStringDictionary<IExecutableBasedExtensionTip>): Promise<void> {
if (this.hasToIgnoreRecommendationNotifications()) {
return;
}
Expand All @@ -86,6 +88,10 @@ export class ExeBasedRecommendations extends ExtensionRecommendations {
}

for (const extensionId of recommendations) {
if (extensionId === 'ms-vscode-remote.remote-wsl') {
await this.tasExperimentService.getTreatment<boolean>('wslpopupaa');
}

const tip = importantExeBasedRecommendations[extensionId];
const message = tip.isExtensionPack ? localize('extensionPackRecommended', "The '{0}' extension pack is recommended as you have {1} installed on your system.", tip.extensionName!, tip.exeFriendlyName || basename(tip.windowsPath!))
: localize('exeRecommended', "The '{0}' extension is recommended as you have {1} installed on your system.", tip.extensionName!, tip.exeFriendlyName || basename(tip.windowsPath!));
Expand Down

0 comments on commit a733898

Please sign in to comment.