Skip to content

Commit 0122f8b

Browse files
authored
Re microsoft#153850. Add logs for iw creation. (microsoft#153862)
1 parent e443613 commit 0122f8b

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
183183
const extHostWebviewViews = rpcProtocol.set(ExtHostContext.ExtHostWebviewViews, new ExtHostWebviewViews(rpcProtocol, extHostWebviews));
184184
const extHostTesting = rpcProtocol.set(ExtHostContext.ExtHostTesting, new ExtHostTesting(rpcProtocol, extHostCommands));
185185
const extHostUriOpeners = rpcProtocol.set(ExtHostContext.ExtHostUriOpeners, new ExtHostUriOpeners(rpcProtocol));
186-
rpcProtocol.set(ExtHostContext.ExtHostInteractive, new ExtHostInteractive(rpcProtocol, extHostNotebook, extHostDocumentsAndEditors, extHostCommands));
186+
rpcProtocol.set(ExtHostContext.ExtHostInteractive, new ExtHostInteractive(rpcProtocol, extHostNotebook, extHostDocumentsAndEditors, extHostCommands, extHostLogService));
187187

188188
// Check that no named customers are missing
189189
const expected = Object.values<ProxyIdentifier<any>>(ExtHostContext);

src/vs/workbench/api/common/extHostInteractive.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { URI, UriComponents } from 'vs/base/common/uri';
7+
import { ILogService } from 'vs/platform/log/common/log';
78
import { ExtHostInteractiveShape, IMainContext } from 'vs/workbench/api/common/extHost.protocol';
89
import { ApiCommand, ApiCommandArgument, ApiCommandResult, ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
910
import { ExtHostDocumentsAndEditors } from 'vs/workbench/api/common/extHostDocumentsAndEditors';
@@ -15,7 +16,8 @@ export class ExtHostInteractive implements ExtHostInteractiveShape {
1516
mainContext: IMainContext,
1617
private _extHostNotebooks: ExtHostNotebookController,
1718
private _textDocumentsAndEditors: ExtHostDocumentsAndEditors,
18-
private _commands: ExtHostCommands
19+
private _commands: ExtHostCommands,
20+
_logService: ILogService
1921
) {
2022
const openApiCommand = new ApiCommand(
2123
'interactive.open',
@@ -28,10 +30,13 @@ export class ExtHostInteractive implements ExtHostInteractiveShape {
2830
new ApiCommandArgument('title', 'Interactive editor title', v => true, v => v)
2931
],
3032
new ApiCommandResult<{ notebookUri: UriComponents; inputUri: UriComponents; notebookEditorId?: string }, { notebookUri: URI; inputUri: URI; notebookEditor?: NotebookEditor }>('Notebook and input URI', (v: { notebookUri: UriComponents; inputUri: UriComponents; notebookEditorId?: string }) => {
33+
_logService.debug('[ExtHostInteractive] open iw with notebook editor id', v.notebookEditorId);
3134
if (v.notebookEditorId !== undefined) {
3235
const editor = this._extHostNotebooks.getEditorById(v.notebookEditorId);
36+
_logService.debug('[ExtHostInteractive] notebook editor found', editor.id);
3337
return { notebookUri: URI.revive(v.notebookUri), inputUri: URI.revive(v.inputUri), notebookEditor: editor.apiEditor };
3438
}
39+
_logService.debug('[ExtHostInteractive] notebook editor not found, uris for the interactive document', v.notebookUri, v.inputUri);
3540
return { notebookUri: URI.revive(v.notebookUri), inputUri: URI.revive(v.inputUri) };
3641
})
3742
);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
3131
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
3232
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
3333
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
34+
import { ILogService } from 'vs/platform/log/common/log';
3435
import { Registry } from 'vs/platform/registry/common/platform';
3536
import { contrastBorder, listInactiveSelectionBackground, registerColor, transparent } from 'vs/platform/theme/common/colorRegistry';
3637
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
@@ -344,16 +345,19 @@ registerAction2(class extends Action2 {
344345
const editorGroupService = accessor.get(IEditorGroupsService);
345346
const historyService = accessor.get(IInteractiveHistoryService);
346347
const kernelService = accessor.get(INotebookKernelService);
348+
const logService = accessor.get(ILogService);
347349
const group = columnToEditorGroup(editorGroupService, typeof showOptions === 'number' ? showOptions : showOptions?.viewColumn);
348350
const editorOptions = {
349351
activation: EditorActivation.PRESERVE,
350352
preserveFocus: typeof showOptions !== 'number' ? (showOptions?.preserveFocus ?? false) : false
351353
};
352354

353355
if (resource && resource.scheme === Schemas.vscodeInteractive) {
356+
logService.debug('Open interactive window from resource:', resource.toString());
354357
const resourceUri = URI.revive(resource);
355358
const editors = editorService.findEditors(resourceUri).filter(id => id.editor instanceof InteractiveEditorInput && id.editor.resource?.toString() === resourceUri.toString());
356359
if (editors.length) {
360+
logService.debug('Find existing interactive window:', resource.toString());
357361
const editorInput = editors[0].editor as InteractiveEditorInput;
358362
const currentGroup = editors[0].groupId;
359363
const editor = await editorService.openEditor(editorInput, editorOptions, currentGroup);
@@ -384,6 +388,8 @@ registerAction2(class extends Action2 {
384388
counter++;
385389
} while (existingNotebookDocument.has(notebookUri.toString()));
386390

391+
logService.debug('Open new interactive window:', notebookUri.toString(), inputUri.toString());
392+
387393
if (id) {
388394
const allKernels = kernelService.getMatchingKernel({ uri: notebookUri, viewType: 'interactive' }).all;
389395
const preferredKernel = allKernels.find(kernel => kernel.id === id);
@@ -397,6 +403,7 @@ registerAction2(class extends Action2 {
397403
const editorPane = await editorService.openEditor(editorInput, editorOptions, group);
398404
const editorControl = editorPane?.getControl() as { notebookEditor: NotebookEditorWidget | undefined; codeEditor: CodeEditorWidget } | undefined;
399405
// Extensions must retain references to these URIs to manipulate the interactive editor
406+
logService.debug('New interactive window opened. Notebook editor id', editorControl?.notebookEditor?.getId());
400407
return { notebookUri, inputUri, notebookEditorId: editorControl?.notebookEditor?.getId() };
401408
}
402409
});

0 commit comments

Comments
 (0)