Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 0d1412d

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 1e98bc2 + 34b96c3 commit 0d1412d

File tree

15 files changed

+337
-84
lines changed

15 files changed

+337
-84
lines changed

.eslintplugin/code-no-test-only.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export = new class NoTestOnly implements eslint.Rule.RuleModule {
99

1010
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
1111
return {
12-
['MemberExpression[object.name="test"][property.name="only"]']: (node: any) => {
12+
['MemberExpression[object.name=/^(test|suite)$/][property.name="only"]']: (node: any) => {
1313
return context.report({
1414
node,
15-
message: 'test.only is a dev-time tool and CANNOT be pushed'
15+
message: 'only is a dev-time tool and CANNOT be pushed'
1616
});
1717
}
1818
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"@vscode/l10n-dev": "0.0.21",
134134
"@vscode/telemetry-extractor": "^1.9.8",
135135
"@vscode/test-web": "^0.0.32",
136-
"@vscode/vscode-perf": "^0.0.1",
136+
"@vscode/vscode-perf": "^0.0.2",
137137
"ansi-colors": "^3.2.3",
138138
"asar": "^3.0.3",
139139
"chromium-pickle-js": "^0.2.0",

src/vs/workbench/api/browser/mainThreadNotebook.ts

+18-6
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,40 @@ export class MainThreadNotebooks implements MainThreadNotebookShape {
4444
}
4545

4646
$registerNotebookSerializer(handle: number, extension: NotebookExtensionDescription, viewType: string, options: TransientOptions, data: INotebookContributionData | undefined): void {
47-
const registration = this._notebookService.registerNotebookSerializer(viewType, extension, {
47+
const disposables = new DisposableStore();
48+
49+
disposables.add(this._notebookService.registerNotebookSerializer(viewType, extension, {
4850
options,
4951
dataToNotebook: async (data: VSBuffer): Promise<NotebookData> => {
5052
const sw = new StopWatch(true);
5153
const dto = await this._proxy.$dataToNotebook(handle, data, CancellationToken.None);
5254
const result = NotebookDto.fromNotebookDataDto(dto.value);
53-
this._logService.trace('[NotebookSerializer] dataToNotebook DONE', extension.id, sw.elapsed());
55+
this._logService.trace(`[NotebookSerializer] dataToNotebook DONE after ${sw.elapsed()}ms`, {
56+
viewType,
57+
extensionId: extension.id.value,
58+
});
5459
return result;
5560
},
5661
notebookToData: (data: NotebookData): Promise<VSBuffer> => {
5762
const sw = new StopWatch(true);
5863
const result = this._proxy.$notebookToData(handle, new SerializableObjectWithBuffers(NotebookDto.toNotebookDataDto(data)), CancellationToken.None);
59-
this._logService.trace('[NotebookSerializer] notebookToData DONE', extension.id, sw.elapsed());
64+
this._logService.trace(`[NotebookSerializer] notebookToData DONE after ${sw.elapsed()}`, {
65+
viewType,
66+
extensionId: extension.id.value,
67+
});
6068
return result;
6169
}
62-
});
63-
const disposables = new DisposableStore();
64-
disposables.add(registration);
70+
}));
71+
6572
if (data) {
6673
disposables.add(this._notebookService.registerContributedNotebookType(viewType, data));
6774
}
6875
this._notebookSerializer.set(handle, disposables);
76+
77+
this._logService.trace('[NotebookSerializer] registered notebook serializer', {
78+
viewType,
79+
extensionId: extension.id.value,
80+
});
6981
}
7082

7183
$unregisterNotebookSerializer(handle: number): void {

src/vs/workbench/browser/parts/editor/editorConfiguration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class DynamicEditorConfigurations extends Disposable implements IWorkbenc
137137
properties: {
138138
'workbench.editorAssociations': {
139139
type: 'object',
140-
markdownDescription: localize('editor.editorAssociations', "Configure glob patterns to editors (for example `\"*.hex\": \"hexEditor.hexEdit\"`). These have precedence over the default behavior."),
140+
markdownDescription: localize('editor.editorAssociations', "Configure glob patterns to editors (for example `\"*.hex\": \"hexEditor.hexedit\"`). These have precedence over the default behavior."),
141141
patternProperties: {
142142
'.*': {
143143
type: 'string',

src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts

+39-7
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
3030
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
3131
import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration';
3232
import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
33-
import { IQuickInputButton, IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
33+
import { IQuickInputButton, IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
3434
import { ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
3535
import { ContextKeyExpr, ContextKeyExpression, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
3636
import { ICommandService } from 'vs/platform/commands/common/commands';
3737
import { getVirtualWorkspaceLocation } from 'vs/platform/workspace/common/virtualWorkspace';
3838
import { Schemas } from 'vs/base/common/network';
3939
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
40-
import { isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
40+
import { IExtensionService, isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
4141
import { EditSessionsLogService } from 'vs/workbench/contrib/editSessions/common/editSessionsLogService';
4242
import { IViewContainersRegistry, Extensions as ViewExtensions, ViewContainerLocation, IViewsService } from 'vs/workbench/common/views';
4343
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
@@ -61,10 +61,14 @@ import { ILocalizedString } from 'vs/platform/action/common/action';
6161
import { Codicon } from 'vs/base/common/codicons';
6262
import { CancellationError } from 'vs/base/common/errors';
6363
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
64+
import { IExtensionsViewPaneContainer, VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions';
65+
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
66+
6467

6568
registerSingleton(IEditSessionsLogService, EditSessionsLogService, InstantiationType.Delayed);
6669
registerSingleton(IEditSessionsStorageService, EditSessionsWorkbenchService, InstantiationType.Delayed);
6770

71+
6872
const continueWorkingOnCommand: IAction2Options = {
6973
id: '_workbench.editSessions.actions.continueEditSession',
7074
title: { value: localize('continue working on', "Continue Working On..."), original: 'Continue Working On...' },
@@ -82,6 +86,23 @@ const showOutputChannelCommand: IAction2Options = {
8286
title: { value: localize('show log', 'Show Log'), original: 'Show Log' },
8387
category: EDIT_SESSION_SYNC_CATEGORY
8488
};
89+
const installAdditionalContinueOnOptionsCommand = {
90+
id: 'workbench.action.continueOn.extensions',
91+
title: localize('continueOn.installAdditional', 'Install additional development environment options'),
92+
};
93+
registerAction2(class extends Action2 {
94+
constructor() {
95+
super({ ...installAdditionalContinueOnOptionsCommand, f1: false });
96+
}
97+
98+
async run(accessor: ServicesAccessor): Promise<void> {
99+
const paneCompositePartService = accessor.get(IPaneCompositePartService);
100+
const viewlet = await paneCompositePartService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true);
101+
const view = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer | undefined;
102+
view?.search('@tag:continueOn');
103+
}
104+
});
105+
85106
const resumeProgressOptionsTitle = `[${localize('resuming working changes window', 'Resuming working changes...')}](command:${showOutputChannelCommand.id})`;
86107
const resumeProgressOptions = {
87108
location: ProgressLocation.Window,
@@ -124,6 +145,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
124145
@IActivityService private readonly activityService: IActivityService,
125146
@IEditorService private readonly editorService: IEditorService,
126147
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService,
148+
@IExtensionService private readonly extensionService: IExtensionService,
127149
) {
128150
super();
129151

@@ -809,7 +831,8 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
809831
if (remoteGroup !== undefined) {
810832
MenuRegistry.appendMenuItem(MenuId.StatusBarRemoteIndicatorMenu, {
811833
group: remoteGroup,
812-
command: command
834+
command: command,
835+
when: command.precondition
813836
});
814837
}
815838
}
@@ -851,14 +874,22 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
851874
: this.contextService.getWorkspace().folders.map((folder) => folder.name).join(', ');
852875
quickPick.placeholder = localize('continueEditSessionPick.title.v2', "Select a development environment to continue working on {0} in", `'${workspaceContext}'`);
853876
quickPick.items = this.createPickItems();
877+
this.extensionService.onDidChangeExtensions(() => {
878+
quickPick.items = this.createPickItems();
879+
});
854880

855881
const command = await new Promise<string | undefined>((resolve, reject) => {
856882
quickPick.onDidHide(() => resolve(undefined));
857883

858884
quickPick.onDidAccept((e) => {
859885
const selection = quickPick.activeItems[0].command;
860-
resolve(selection);
861-
quickPick.hide();
886+
887+
if (selection === installAdditionalContinueOnOptionsCommand.id) {
888+
void this.commandService.executeCommand(installAdditionalContinueOnOptionsCommand.id);
889+
} else {
890+
resolve(selection);
891+
quickPick.hide();
892+
}
862893
});
863894

864895
quickPick.show();
@@ -912,7 +943,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
912943
}
913944
}
914945

915-
private createPickItems(): ContinueEditSessionItem[] {
946+
private createPickItems(): (ContinueEditSessionItem | IQuickPickSeparator)[] {
916947
const items = [...this.continueEditSessionOptions].filter((option) => option.when === undefined || this.contextKeyService.contextMatchesRules(option.when));
917948

918949
if (getVirtualWorkspaceLocation(this.contextService.getWorkspace()) !== undefined && isNative) {
@@ -923,7 +954,8 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
923954
));
924955
}
925956

926-
return items.sort((item1, item2) => item1.label.localeCompare(item2.label));
957+
const sortedItems: (ContinueEditSessionItem | IQuickPickSeparator)[] = items.sort((item1, item2) => item1.label.localeCompare(item2.label));
958+
return sortedItems.concat({ type: 'separator' }, new ContinueEditSessionItem(installAdditionalContinueOnOptionsCommand.title, installAdditionalContinueOnOptionsCommand.id));
927959
}
928960
}
929961

src/vs/workbench/contrib/editSessions/test/browser/editSessions.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
4141
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
4242
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
4343
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
44+
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
4445

4546
const folderName = 'test-folder';
4647
const folderUri = URI.file(`/${folderName}`);
@@ -75,6 +76,9 @@ suite('Edit session sync', () => {
7576
override onDidSignIn = Event.None;
7677
override onDidSignOut = Event.None;
7778
});
79+
instantiationService.stub(IExtensionService, new class extends mock<IExtensionService>() {
80+
override onDidChangeExtensions = Event.None;
81+
});
7882
instantiationService.stub(IProgressService, ProgressService);
7983
instantiationService.stub(ISCMService, SCMService);
8084
instantiationService.stub(IEnvironmentService, TestEnvironmentService);

src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.ts

+7-38
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,6 @@ async function webviewPreloads(ctx: PreloadContext) {
182182

183183
document.body.addEventListener('click', handleInnerClick);
184184

185-
async function loadScriptSource(url: string, originalUri: string): Promise<string> {
186-
const res = await fetch(url);
187-
const text = await res.text();
188-
if (!res.ok) {
189-
throw new Error(`Unexpected ${res.status} requesting ${originalUri}: ${text || res.statusText}`);
190-
}
191-
192-
return text;
193-
}
194-
195185
interface RendererContext extends rendererApi.RendererContext<unknown> {
196186
readonly settings: RenderOptions;
197187
}
@@ -224,24 +214,9 @@ async function webviewPreloads(ctx: PreloadContext) {
224214
});
225215
}
226216

227-
const invokeSourceWithGlobals = (functionSrc: string, globals: { [name: string]: unknown }) => {
228-
const args = Object.entries(globals);
229-
return new Function(...args.map(([k]) => k), functionSrc)(...args.map(([, v]) => v));
230-
};
231-
232-
async function runKernelPreload(url: string, originalUri: string, forceLoadAsModule: boolean): Promise<void> {
233-
if (forceLoadAsModule) {
234-
return activateModuleKernelPreload(url);
235-
}
236-
237-
const text = await loadScriptSource(url, originalUri);
238-
const isModule = /\bexport\b.*\bactivate\b/.test(text);
217+
async function runKernelPreload(url: string): Promise<void> {
239218
try {
240-
if (isModule) {
241-
return activateModuleKernelPreload(url);
242-
} else {
243-
return invokeSourceWithGlobals(text, { ...kernelPreloadGlobals, scriptUrl: url });
244-
}
219+
return await activateModuleKernelPreload(url);
245220
} catch (e) {
246221
console.error(e);
247222
throw e;
@@ -818,12 +793,6 @@ async function webviewPreloads(ctx: PreloadContext) {
818793

819794
const onDidReceiveKernelMessage = createEmitter<unknown>();
820795

821-
const kernelPreloadGlobals = {
822-
acquireVsCodeApi,
823-
onDidReceiveKernelMessage: onDidReceiveKernelMessage.event,
824-
postKernelMessage: (data: unknown) => postNotebookMessage('customKernelMessage', { message: data }),
825-
};
826-
827796
const ttPolicy = window.trustedTypes?.createPolicy('notebookRenderer', {
828797
createHTML: value => value,
829798
createScript: value => value,
@@ -1209,8 +1178,8 @@ async function webviewPreloads(ctx: PreloadContext) {
12091178
}
12101179
case 'preload': {
12111180
const resources = event.data.resources;
1212-
for (const { uri, originalUri } of resources) {
1213-
kernelPreloads.load(uri, originalUri, false);
1181+
for (const { uri } of resources) {
1182+
kernelPreloads.load(uri);
12141183
}
12151184
break;
12161185
}
@@ -1462,9 +1431,9 @@ async function webviewPreloads(ctx: PreloadContext) {
14621431
* @param uri URI to load from
14631432
* @param originalUri URI to show in an error message if the preload is invalid.
14641433
*/
1465-
public load(uri: string, originalUri: string, forceLoadAsModule: boolean) {
1434+
public load(uri: string) {
14661435
const promise = Promise.all([
1467-
runKernelPreload(uri, originalUri, forceLoadAsModule),
1436+
runKernelPreload(uri),
14681437
this.waitForAllCurrent(),
14691438
]);
14701439

@@ -2229,7 +2198,7 @@ async function webviewPreloads(ctx: PreloadContext) {
22292198
});
22302199

22312200
for (const preload of ctx.staticPreloadsData) {
2232-
kernelPreloads.load(preload.entrypoint, preload.entrypoint, true);
2201+
kernelPreloads.load(preload.entrypoint);
22332202
}
22342203

22352204
function postNotebookMessage<T extends webviewMessages.FromWebviewMessage>(

src/vs/workbench/contrib/search/common/searchModel.ts

+16
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
2424
import { IFileService, IFileStatWithPartialMetadata } from 'vs/platform/files/common/files';
2525
import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
2626
import { ILabelService } from 'vs/platform/label/common/label';
27+
import { ILogService, LogLevel } from 'vs/platform/log/common/log';
2728
import { IProgress, IProgressStep } from 'vs/platform/progress/common/progress';
2829
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2930
import { minimapFindMatch, overviewRulerFindMatchForeground } from 'vs/platform/theme/common/colorRegistry';
@@ -864,6 +865,7 @@ export class FolderMatchWorkspaceRoot extends FolderMatchWithResource {
864865
@IInstantiationService instantiationService: IInstantiationService,
865866
@ILabelService labelService: ILabelService,
866867
@IUriIdentityService uriIdentityService: IUriIdentityService,
868+
@ILogService private readonly _logService: ILogService,
867869
) {
868870
super(_resource, _id, _index, _query, _parent, _searchModel, null, replaceService, instantiationService, labelService, uriIdentityService);
869871
}
@@ -894,15 +896,29 @@ export class FolderMatchWorkspaceRoot extends FolderMatchWithResource {
894896
const normalizedResource = this.uriIdentityService.extUri.normalizePath(this.resource);
895897
let uri = this.normalizedUriParent(rawFileMatch.resource);
896898

899+
const debug: string[] = ['[search model building]'];
900+
901+
if (this._logService.getLevel() === LogLevel.Trace) {
902+
debug.push(`Starting with normalized resource ${normalizedResource}`);
903+
}
904+
897905
while (!this.uriEquals(normalizedResource, uri)) {
898906
fileMatchParentParts.unshift(uri);
899907
const prevUri = uri;
900908
uri = this.normalizedUriParent(uri);
909+
if (this._logService.getLevel() === LogLevel.Trace) {
910+
debug.push(`current uri parent ${uri} comparing with ${prevUri}`);
911+
}
901912
if (this.uriEquals(prevUri, uri)) {
913+
this._logService.trace(debug.join('\n\n'));
902914
throw Error(`${rawFileMatch.resource} is not correctly configured as a child of its ${normalizedResource}`);
903915
}
904916
}
905917

918+
if (this._logService.getLevel() === LogLevel.Trace) {
919+
this._logService.trace(debug.join('\n\n'));
920+
}
921+
906922
const root = this.closestRoot ?? this;
907923
let parent: FolderMatch = this;
908924
for (let i = 0; i < fileMatchParentParts.length; i++) {

src/vs/workbench/contrib/terminal/browser/terminal.ts

-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
1212
import { IKeyMods } from 'vs/platform/quickinput/common/quickInput';
1313
import { IMarkProperties, ITerminalCapabilityStore, ITerminalCommand } from 'vs/platform/terminal/common/capabilities/capabilities';
1414
import { IExtensionTerminalProfile, IReconnectionProperties, IShellIntegration, IShellLaunchConfig, ITerminalDimensions, ITerminalLaunchError, ITerminalProfile, ITerminalTabLayoutInfoById, TerminalExitReason, TerminalIcon, TerminalLocation, TerminalShellType, TerminalType, TitleEventSource, WaitOnExitValue } from 'vs/platform/terminal/common/terminal';
15-
import { ITerminalQuickFixOptions } from 'vs/platform/terminal/common/xterm/terminalQuickFix';
1615
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
1716
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
1817
import { IEditableData } from 'vs/workbench/common/views';
@@ -931,11 +930,6 @@ export interface ITerminalInstance {
931930
*/
932931
openRecentLink(type: 'localFile' | 'url'): Promise<void>;
933932

934-
/**
935-
* Registers quick fix providers
936-
*/
937-
registerQuickFixProvider(...options: ITerminalQuickFixOptions[]): void;
938-
939933
/**
940934
* Attempts to detect and kill the process listening on specified port.
941935
* If successful, places commandToRun on the command line

0 commit comments

Comments
 (0)