Skip to content

Commit 15ecc8d

Browse files
committed
Only hide in serverless (fixes microsoft/vscode-dev#242)
1 parent 2cfe726 commit 15ecc8d

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

src/vs/workbench/contrib/welcome/walkThrough/browser/editor/vs_code_editor_walkthrough.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as platform from 'vs/base/common/platform';
7+
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
8+
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
79

8-
const isWeb = platform.isWeb;
9-
10-
export default () => `
10+
export default function content(accessor: ServicesAccessor) {
11+
const isServerless = platform.isWeb && !accessor.get(IWorkbenchEnvironmentService).remoteAuthority;
12+
return `
1113
## Interactive Editor Playground
1214
The core editor in VS Code is packed with features. This page highlights a number of them and lets you interactively try them out through the use of a number of embedded editors. For full details on the editor features for VS Code and more head over to our [documentation](command:workbench.action.openDocumentationUrl).
1315
1416
* [Multi-cursor Editing](#multi-cursor-editing) - block selection, select all occurrences, add additional cursors and more.
1517
* [IntelliSense](#intellisense) - get code assistance and parameter suggestions for your code and external modules.
16-
* [Line Actions](#line-actions) - quickly move lines around to re-order your code.${!isWeb ? `
18+
* [Line Actions](#line-actions) - quickly move lines around to re-order your code.${!isServerless ? `
1719
* [Rename Refactoring](#rename-refactoring) - quickly rename symbols across your code base.` : ''}
1820
* [Formatting](#formatting) - keep your code looking great with inbuilt document & selection formatting.
1921
* [Code Folding](#code-folding) - focus on the most relevant parts of your code by folding other areas.
@@ -72,7 +74,7 @@ Since it's very common to work with the entire text in a line we provide a set o
7274
>**Tip:** Another very common task is to comment out a block of code - you can toggle commenting by pressing kb(editor.action.commentLine).
7375
7476
75-
${!isWeb ? `
77+
${!isServerless ? `
7678
### Rename Refactoring
7779
It's easy to rename a symbol such as a function name or variable name. Hit kb(editor.action.rename) while in the symbol |Book| to rename all instances - this will occur across all files in a project. You also have |Rename Symbol| in the right-click context menu.
7880
@@ -189,3 +191,4 @@ That's all for now,
189191
Happy Coding! 🎉
190192
191193
`.replace(/\|/g, '`');
194+
}

src/vs/workbench/contrib/welcome/walkThrough/browser/walkThroughInput.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { isEqual } from 'vs/base/common/resources';
1414
import { requireToContent } from 'vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider';
1515
import { Dimension } from 'vs/base/browser/dom';
1616
import { IEditorInput, IUntypedEditorInput } from 'vs/workbench/common/editor';
17+
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1718

1819
export class WalkThroughModel extends EditorModel {
1920

@@ -59,6 +60,7 @@ export class WalkThroughInput extends EditorInput {
5960

6061
constructor(
6162
private readonly options: WalkThroughInputOptions,
63+
@IInstantiationService private readonly instantiationService: IInstantiationService,
6264
@ITextModelService private readonly textModelResolverService: ITextModelService
6365
) {
6466
super();
@@ -101,7 +103,7 @@ export class WalkThroughInput extends EditorInput {
101103

102104
override resolve(): Promise<WalkThroughModel> {
103105
if (!this.promise) {
104-
this.promise = requireToContent(this.options.resource)
106+
this.promise = requireToContent(this.instantiationService, this.options.resource)
105107
.then(content => {
106108
if (this.resource.path.endsWith('.html')) {
107109
return new WalkThroughModel(content, []);

src/vs/workbench/contrib/welcome/walkThrough/common/walkThroughContentProvider.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import { Schemas } from 'vs/base/common/network';
1414
import { Range } from 'vs/editor/common/core/range';
1515
import { createTextBufferFactory } from 'vs/editor/common/model/textModel';
1616
import { assertIsDefined } from 'vs/base/common/types';
17+
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1718

18-
export function requireToContent(resource: URI): Promise<string> {
19+
export function requireToContent(instantiationService: IInstantiationService, resource: URI): Promise<string> {
1920
if (!resource.query) {
2021
throw new Error('Welcome: invalid resource');
2122
}
@@ -28,7 +29,7 @@ export function requireToContent(resource: URI): Promise<string> {
2829
const content: Promise<string> = new Promise<string>((resolve, reject) => {
2930
require([query.moduleId], content => {
3031
try {
31-
resolve(content.default());
32+
resolve(instantiationService.invokeFunction(content.default));
3233
} catch (err) {
3334
reject(err);
3435
}
@@ -45,6 +46,7 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
4546
@ITextModelService private readonly textModelResolverService: ITextModelService,
4647
@IModeService private readonly modeService: IModeService,
4748
@IModelService private readonly modelService: IModelService,
49+
@IInstantiationService private readonly instantiationService: IInstantiationService,
4850
) {
4951
this.textModelResolverService.registerTextModelContentProvider(Schemas.walkThroughSnippet, this);
5052
}
@@ -53,7 +55,7 @@ export class WalkThroughSnippetContentProvider implements ITextModelContentProvi
5355
let ongoing = this.loads.get(resource.toString());
5456
if (!ongoing) {
5557
ongoing = new Promise(async c => {
56-
c(createTextBufferFactory(await requireToContent(resource)));
58+
c(createTextBufferFactory(await requireToContent(this.instantiationService, resource)));
5759
this.loads.delete(resource.toString());
5860
});
5961
this.loads.set(resource.toString(), ongoing);

0 commit comments

Comments
 (0)