rokucommunity / vscode-brightscript-language

A Visual Studio Code extension for Roku's BrightScript language
MIT License
109 stars 41 forks source link

support source map resolution in stack traces #448

Open georgejecook opened 1 year ago

georgejecook commented 1 year ago

given a printed stack trace like:

AA({"backtrace":[{"filename":"pkg:/components/maestro/generated/ContentApiTask.brs","function":"exec() As Dynamic","line_number":24},{"filename":"pkg:/source/content-api/tasks/ContentApiTask.brs","function":"$anon_4d2(args As Dynamic) As Dynamic","line_number":48},{"filename":"pkg:/source/content-api/tasks/ContentApiTask.brs","function":"$anon_4d6() As Dynamic","line_number":123},{"filename":"pkg:/source/content-api/service/ContentApiParser.brs","function":"$anon_4b8(json As Dynamic, cardtype As Dynamic, moduletype As Dynamic) As Dynamic","line_number":210},{"filename":"pkg:/source/content-api/service/ContentApiParser.brs","function":"$anon_4b9(json As Dynamic, cardtype As Dynamic, moduletype As Dynamic) As Dynamic","line_number":256},{"filename":"pkg:/source/content-api/service/ContentApiParser.brs","function":"$anon_4bb(json As Dynamic, cardtype As Dynamic) As Dynamic","line_number":296},{"filename":"pkg:/source/content-api/service/ContentApiParser.brs(NaN)","function":"$anon_4bc(json As Dynamic, cardtype As Dynamic) As Dynamic","line_number":324}],"message":"'Dot' Operator attempted with invalid BrightScript Component or interface reference.","number":236,"rethrown":false})  

the Brightscript Log should convert this into a more consumable format, at very least linking to the correct .bs lines.. presently we have to go into the build folder and look these up.

TwitchBronBron commented 1 year ago

I agree, this would be really nice. This should realistically happen in roku-debug, right when we receive the log output, because roku-debug is the one that has rewritten the component library filenames, injected breakpoints (which offset line numbers), etc.