-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Call native logging APIs when debugging in the extension host #104686
Comments
Since extension debugging is a private feature of VS Code, we can use any mechanism that works... However, there is the DAPTracker API and we have LiveShare that uses the tracker to do their magic. |
@connor4312 let me know you would like to tackle this with me? I am flexible. |
Sure. I'm available next week, feel free to send an invite or grab me whenever we're both online. |
Isi and I looked at this on a call this morning. The best way to deal with, among other alternatives, would be to have the extension host call the native methods, as in the title. This would also, as opposed to a custom dap message, allow us to expand and inspect logged objects link we normally would. It would also let us filter out messages that don't come from your extension, which I would personally love to have, since we get a stacktrace in CDP log messages. The log messages are replaced in bootstrap-fork: Lines 139 to 147 in 2a1c8bb
I've made these call native APIs in the linked commit. However, there's also manual handling of output, which results in duplicate log messages being output. vscode/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts Line 232 in 6f87c1c
It seems like @joaomoreno authored this code, a long time ago. I'm not sure what the best approach is. Ideally we could call the console log method and avoid writing to stdout, but that doesn't seem possible. You can make a new Console, but this does not result in the required CDP methods firing. Maybe we write a "marker" byte around the console messages so that the output handling skips them? |
I like the approach to call the native methods (and the "marker byte" workaround sounds OK to me). In general we should strive for minimising the amount of custom code for extension debugging. |
I also like this approach! Nice work @connor4312 |
ping @isidorn if you wanted to verify this 🙂 |
Thanks for the ping, I have verified that this works fine. |
Currently in extension host debugging, logged messages are placed directly in the Debug Console and bypass js-debug.
However, now (as of microsoft/vscode-js-debug#412) js-debug has the capability to replace paths stacktraces thrown from compiled code with their respective source locations, so there's a compelling benefit to change this behavior. Either to actually call the native APIs (which would be the easiest for me 😄) or implement some custom DAP message to pass the log through the debugger here
vscode/src/vs/workbench/contrib/debug/browser/debugService.ts
Line 144 in cc29a81
The text was updated successfully, but these errors were encountered: