@@ -204,8 +204,9 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
204204 this . _overlay . show ( HtmlHelper . getLoadingMessage ( 'Loading error view...' ) , this . errorOverlayId ) ;
205205 const errorDetails = await this . _analyticsProvider . getCodeObjectError ( e . errorSourceUID ) ;
206206 const codeObject = await this . getCurrentCodeObject ( ) || emptyCodeObject ;
207+ const { document } = await this . getCurrentDocumentContext ( ) ;
207208
208- const viewModels = await this . createViewModels ( errorDetails ) ;
209+ const viewModels = await this . createViewModels ( errorDetails , document ) ;
209210 const stackViewModel = viewModels . firstOrDefault ( ) ;
210211 this . _stackViewModel = stackViewModel ;
211212 this . _stackViewModels = viewModels ;
@@ -261,7 +262,10 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
261262 return result ;
262263 }
263264
264- private async createViewModels ( errorDetails : CodeObjectErrorDetails ) : Promise < ErrorFlowStackViewModel [ ] > {
265+ private async createViewModels (
266+ errorDetails : CodeObjectErrorDetails ,
267+ document ?: vscode . TextDocument ,
268+ ) : Promise < ErrorFlowStackViewModel [ ] > {
265269 const sourceFlows = errorDetails . errors ;
266270 const viewModels : ErrorFlowStackViewModel [ ] = [ ] ;
267271 let id = 0 ;
@@ -286,10 +290,14 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
286290 repeat,
287291 } = sourceFrame ;
288292
289- const workspaceUri = await this . _editorHelper . getWorkspaceFileUri ( {
290- moduleLogicalPath,
291- modulePhysicalPath,
292- } ) ;
293+ const workspaceUri = await this . _editorHelper . getWorkspaceFileUri (
294+ {
295+ codeObjectId,
296+ moduleLogicalPath,
297+ modulePhysicalPath,
298+ } ,
299+ document ,
300+ ) ;
293301
294302 const frame : FrameViewModel = {
295303 id : id ++ ,
@@ -333,13 +341,22 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
333341 return viewModels ;
334342 }
335343
336- private async getCurrentCodeObject ( ) : Promise < CodeObjectInfo | undefined > {
344+ private async getCurrentDocumentContext ( ) : Promise < DocumentContext > {
337345 const editor = vscode . window . activeTextEditor ;
338- if ( ! editor ) {
346+ const document = editor ?. document ;
347+
348+ return {
349+ editor,
350+ document,
351+ } ;
352+ }
353+
354+ private async getCurrentCodeObject ( ) : Promise < CodeObjectInfo | undefined > {
355+ const { editor, document } = await this . getCurrentDocumentContext ( ) ;
356+ if ( ! editor || ! document ) {
339357 return ;
340358 }
341359
342- const document = editor . document ;
343360 const position = editor . selection . anchor ;
344361
345362 const docInfo = this . _documentInfoProvider . symbolProvider . supportsDocument ( document )
@@ -403,3 +420,8 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
403420 this . _errorFlowParamDecorator . errorFlow = errorFlow ;
404421 }
405422}
423+
424+ type DocumentContext = {
425+ editor ?: vscode . TextEditor
426+ document ?: vscode . TextDocument
427+ } ;
0 commit comments