@@ -26,13 +26,13 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
26
26
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
27
27
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs' ;
28
28
import { IFileService } from 'vs/platform/files/common/files' ;
29
+ import { ILogger , ILoggerService , ILogService } from 'vs/platform/log/common/log' ;
29
30
import { IOpenerService , matchesScheme , matchesSomeScheme } from 'vs/platform/opener/common/opener' ;
30
31
import { IStorageService } from 'vs/platform/storage/common/storage' ;
31
32
import { editorFindMatch , editorFindMatchHighlight } from 'vs/platform/theme/common/colorRegistry' ;
32
33
import { IThemeService , Themable } from 'vs/platform/theme/common/themeService' ;
33
34
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
34
35
import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust' ;
35
- import { asWebviewUri , webviewGenericCspSource } from 'vs/workbench/contrib/webview/common/webview' ;
36
36
import { CellEditState , ICellOutputViewModel , ICellViewModel , ICommonCellInfo , IDisplayOutputLayoutUpdateRequest , IDisplayOutputViewModel , IFocusNotebookCellOptions , IGenericCellViewModel , IInsetRenderOutput , INotebookEditorCreationOptions , INotebookWebviewMessage , RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
37
37
import { NOTEBOOK_WEBVIEW_BOUNDARY } from 'vs/workbench/contrib/notebook/browser/view/notebookCellList' ;
38
38
import { preloadsScriptStr } from 'vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads' ;
@@ -44,8 +44,10 @@ import { IScopedRendererMessaging } from 'vs/workbench/contrib/notebook/common/n
44
44
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService' ;
45
45
import { IWebviewElement , IWebviewService , WebviewContentPurpose , WebviewOriginStore } from 'vs/workbench/contrib/webview/browser/webview' ;
46
46
import { WebviewWindowDragMonitor } from 'vs/workbench/contrib/webview/browser/webviewWindowDragMonitor' ;
47
+ import { asWebviewUri , webviewGenericCspSource } from 'vs/workbench/contrib/webview/common/webview' ;
47
48
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService' ;
48
49
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
50
+ import { registerLogChannel } from 'vs/workbench/services/output/common/output' ;
49
51
import { FromWebviewMessage , IAckOutputHeight , IClickedDataUrlMessage , ICodeBlockHighlightRequest , IContentWidgetTopRequest , IControllerPreload , ICreationContent , ICreationRequestMessage , IFindMatch , IMarkupCellInitialization , RendererMetadata , StaticPreloadMetadata , ToWebviewMessage } from './webviewMessages' ;
50
52
51
53
export interface ICachedInset < K extends ICommonCellInfo > {
@@ -99,6 +101,8 @@ interface BacklayerWebviewOptions {
99
101
readonly outputLineHeight : number ;
100
102
}
101
103
104
+ const logChannelId = 'notebook.rendering' ;
105
+
102
106
export class BackLayerWebView < T extends ICommonCellInfo > extends Themable {
103
107
104
108
private static _originStore ?: WebviewOriginStore ;
@@ -126,6 +130,8 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
126
130
private firstInit = true ;
127
131
private initializeMarkupPromise ?: { readonly requestId : string ; readonly p : DeferredPromise < void > ; readonly isFirstInit : boolean } ;
128
132
133
+ private readonly _renderLogger : ILogger ;
134
+
129
135
private readonly nonce = UUID . generateUuid ( ) ;
130
136
131
137
constructor (
@@ -150,10 +156,18 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
150
156
@IWorkspaceContextService private readonly workspaceContextService : IWorkspaceContextService ,
151
157
@IEditorGroupsService private readonly editorGroupService : IEditorGroupsService ,
152
158
@IStorageService private readonly storageService : IStorageService ,
159
+ @ILoggerService loggerService : ILoggerService ,
160
+ @ILogService logService : ILogService ,
153
161
@IThemeService themeService : IThemeService ,
154
162
) {
155
163
super ( themeService ) ;
156
164
165
+ const logsPath = joinPath ( environmentService . windowLogsPath , 'notebook.rendering.log' ) ;
166
+ this . _renderLogger = this . _register ( loggerService . createLogger ( logsPath , { name : 'notebook.rendering' } ) ) ;
167
+ registerLogChannel ( logChannelId , nls . localize ( 'renderChannelName' , "Notebook rendering" ) , logsPath , fileService , logService ) ;
168
+
169
+ this . _logRendererDebugMessage ( 'Creating backlayer webview for notebook' ) ;
170
+
157
171
this . element = document . createElement ( 'div' ) ;
158
172
159
173
this . element . style . height = '1400px' ;
@@ -198,6 +212,10 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
198
212
this . _updateOptions ( ) ;
199
213
}
200
214
215
+ private _logRendererDebugMessage ( msg : string ) {
216
+ this . _renderLogger . debug ( `${ this . id } - ${ msg } ` ) ;
217
+ }
218
+
201
219
private _updateStyles ( ) {
202
220
this . _sendMessageToWebview ( {
203
221
type : 'notebookStyles' ,
@@ -861,6 +879,10 @@ var requirejs = (function() {
861
879
} ) ;
862
880
break ;
863
881
}
882
+ case 'logRendererDebugMessage' : {
883
+ this . _logRendererDebugMessage ( `${ data . message } ${ data . data ? ' ' + JSON . stringify ( data . data , null , 4 ) : '' } ` ) ;
884
+ break ;
885
+ }
864
886
}
865
887
} ) ) ;
866
888
}
0 commit comments