Skip to content

Commit

Permalink
Clean up getting started (#177505)
Browse files Browse the repository at this point in the history
Clean up getting started area
  • Loading branch information
bhavyaus authored Mar 17, 2023
1 parent 8c9d9ea commit 7d98e08
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,6 @@ configurationRegistry.registerConfiguration({
default: true,
description: localize('workbench.welcomePage.walkthroughs.openOnInstall', "When enabled, an extension's walkthrough will open upon install of the extension.")
},
'workbench.welcomePage.experimental.videoTutorials': {
scope: ConfigurationScope.MACHINE,
type: 'string',
enum: [
'off',
'on',
'experimental'
],
tags: ['experimental'],
default: 'off',
description: localize('workbench.welcomePage.videoTutorials', "When enabled, the get started page has additional links to video tutorials.")
},
'workbench.startupEditor': {
'scope': ConfigurationScope.RESOURCE,
'type': 'string',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten


export class GettingStartedDetailsRenderer {
private mdCache = new ResourceMap<Promise<string>>();
private svgCache = new ResourceMap<Promise<string>>();
private mdCache = new ResourceMap<string>();
private svgCache = new ResourceMap<string>();

constructor(
@IFileService private readonly fileService: IFileService,
Expand Down Expand Up @@ -204,18 +204,19 @@ export class GettingStartedDetailsRenderer {
</html>`;
}

private readAndCacheSVGFile(path: URI): Promise<string> {
private async readAndCacheSVGFile(path: URI): Promise<string> {
if (!this.svgCache.has(path)) {
this.svgCache.set(path, this.readContentsOfPath(path, false));
const contents = await this.readContentsOfPath(path, false);
this.svgCache.set(path, contents);
}
return assertIsDefined(this.svgCache.get(path));
}

private readAndCacheStepMarkdown(path: URI, base: URI): Promise<string> {
private async readAndCacheStepMarkdown(path: URI, base: URI): Promise<string> {
if (!this.mdCache.has(path)) {
this.mdCache.set(path,
this.readContentsOfPath(path).then(rawContents =>
renderMarkdownDocument(transformUris(rawContents, base), this.extensionService, this.languageService, true, true)));
const contents = await this.readContentsOfPath(path);
const markdownContents = await renderMarkdownDocument(transformUris(contents, base), this.extensionService, this.languageService, true, true);
this.mdCache.set(path, markdownContents);
}
return assertIsDefined(this.mdCache.get(path));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,8 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
this.metadata.set(categoryID, { firstSeen: +new Date(), stepIDs: walkthrough.steps?.map(s => s.id) ?? [], manaullyOpened: false });
}

const override = await Promise.race([
this.tasExperimentService?.getTreatment<string>(`gettingStarted.overrideCategory.${extension.identifier.value + '.' + walkthrough.id}.when`),
new Promise<string | undefined>(resolve => setTimeout(() => resolve(walkthrough.when), 5000))
]);

if (
this.sessionInstalledExtensions.has(extension.identifier.value.toLowerCase())
&& this.contextService.contextMatchesRules(ContextKeyExpr.deserialize(override ?? walkthrough.when) ?? ContextKeyExpr.true())
if (this.sessionInstalledExtensions.has(extension.identifier.value.toLowerCase())
&& this.contextService.contextMatchesRules(ContextKeyExpr.deserialize(walkthrough.when) ?? ContextKeyExpr.true())
) {
this.sessionInstalledExtensions.delete(extension.identifier.value.toLowerCase());
if (index < sectionToOpenIndex && isNewlyInstalled) {
Expand Down Expand Up @@ -460,7 +454,7 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
? FileAccess.uriToBrowserUri(joinPath(extension.extensionLocation, iconStr)).toString(true)
: DefaultIconPath
},
when: ContextKeyExpr.deserialize(override ?? walkthrough.when) ?? ContextKeyExpr.true(),
when: ContextKeyExpr.deserialize(walkthrough.when) ?? ContextKeyExpr.true(),
} as const;

this._registerWalkthrough(walkthoughDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ export const startEntries: GettingStartedStartEntryContent = [
command: 'command:welcome.showNewFileEntries',
}
},
// {
// id: 'welcome.showNewFolderEntries',
// title: localize('gettingStarted.newFolder.title', "New Folder..."),
// description: localize('gettingStarted.newFolder.description', "Create a folder from a Git repo or an extension contributed template folder"),
// icon: Codicon.newFolder,
// content: {
// type: 'startEntry',
// command: 'welcome.showNewFolderEntries',
// }
// },
{
id: 'topLevelOpenMac',
title: localize('gettingStarted.openMac.title', "Open..."),
Expand Down Expand Up @@ -152,28 +142,6 @@ export const startEntries: GettingStartedStartEntryContent = [
command: 'command:welcome.showAllWalkthroughs',
}
},
{
id: 'topLevelVideoTutorials',
title: localize('gettingStarted.topLevelVideoTutorials.title', "Watch Video Tutorials"),
description: localize('gettingStarted.topLevelVideoTutorials.description', "Watch our series of short & practical video tutorials for VS Code's key features."),
icon: Codicon.playCircle,
when: 'config.workbench.welcomePage.experimental.videoTutorials == on',
content: {
type: 'startEntry',
command: 'https://aka.ms/vscode-getting-started-video',
}
},
{
id: 'topLevelVideoTutorialsExperimental',
title: localize('gettingStarted.topLevelVideoTutorials.title', "Watch Video Tutorials"),
description: localize('gettingStarted.topLevelVideoTutorials.description', "Watch our series of short & practical video tutorials for VS Code's key features."),
when: 'config.workbench.welcomePage.experimental.videoTutorials == experimental',
icon: Codicon.playCircle,
content: {
type: 'startEntry',
command: 'https://aka.ms/vscode-videos',
}
},
{
id: 'topLevelRemoteOpen',
title: localize('gettingStarted.topLevelRemoteOpen.title', "Connect to..."),
Expand Down

0 comments on commit 7d98e08

Please sign in to comment.