-
Notifications
You must be signed in to change notification settings - Fork 58
Add support for LogPoints in Node #163
Comments
@auchenberg I'm confused by your usage of "DAP" (e.g in "Asks outside of this DAP"). |
@weinand I meant DA. Updated. |
@auchenberg @changsi-an A fundamental question: Is the LogPoints concept really something that we want to add to VS Code as an extension or is it a built-in feature of VS Code that is available for every debugger? E.g. VS for Mac supports LogPoints as an orthogonal feature for all breakpoint types: or VS's peek UI: I'm asking because adding LogPoints as a builtin feature to VS Code is really simple, whereas opening up VS Code for adding LogPoint functionality as an extension will increase our API surface area substantially. @changsi-an If LogPoints would be a built-in feature of VS Code, what would this mean for your request microsoft/vscode#38568 and your planned work? |
So far we have designed LogPoints to be enabled in an extension. When you say it's easier to make this feature built-in, is it just UI interface or your "built-in" suggest that work will be done on your side to implement LogPoints for all langauges, all frameworks? If it is just interface, who will be responsible for implementing LogPoints, for example, C#? Our LogPoints implementation is not trivial, it involves remote procedures to set up one log point. And it only works for a scoped scenario for Azure. I don't think it is a good idea to have this implementation piece built-in to VS Code. Please provide more details on the API in your mind when we say "adding LogPoints as a builtin feature to VS Code" |
If VS and VS for Mac support already LogPoint generically, I do not see why VS Code should not be allowed to do the same. UI-wise the LogPoint feature could be added on top of a VS Code SourceBreakpoint (like VS's UI suggests). On VS for Mac a LogPoint is an exclusive option: either the breakpoint breaks or it logs and continues. On VS breaking and logging are independent (non-exclusive). Datastructure-wise a LogPoint is just another string based attribute of the SourceBreakpoint that contains the message to be logged (basically the expression passed to a console.log(...)). Node-debug and other "real" debug extensions could just wrap the expression in a "console.log" and combine it with the "condition" and "hitcount" attribute already supported. With this approach we would get local LogPoints basically for free. For your non-trivial LogPoint implementation involving remote procedures you could create your own Debug Extension and DA that gets the same LogPoints passed and you could do your remote target instrumentation based on the information available in every LogPoint. With this approach you could first develop and run a program locally and create and try LogPoints with the regular debug extensions. If everything works locally you would then deploy the program, and via your extension apply the LogPoints to the remote program. |
@changsi-an We are looking to add Logpoints as a local experience and not just as a remote experience so with respect to that we should have something that is native within VSCode. @weinand We do have our own DA that is does everything you mention above. At the very least, we should have something that allows us to setup a logpoint (with an expression from customer), show it in the gutter with a different icon to differentiate it from a regular breakpoint and allow the DA (launched by the extension) to interact with the logpoint to enable, disable, update the expression. |
If we would add builtin LogPoints, the following functionality would become available almost immediately:
Please note that this functionality is always available, even if no debug extension and no debug session (DA) is active. @isidorn did I miss anything? |
@weinand can you clarify what you mean by |
Sure, for instance in the (already exisiting) gutter menu there would be an additional action "Add LogPoint" between the first and second action: And this action opens the Peek UI in the editor with the focus on the text box where the "LogPoint" expression is entered: Imagine that "Hit Count" would read "Log Point Expression". |
Thanks @weinand for the details. @auchenberg If we think of logpoints as a springboard for customers to discover debug adapters and debugging of Node apps/programs, I think we should have a way to turn logpoints into breakpoints. I imagine that we can auto launch a DA with logpoints experience by default which can be thought of as a lightweight debugging experience where you dont break your app execution but are also able to log state easily. When you set a breakpoint (or convert a log point to a breakpoint), we automatically pause the program and give the full blown debugging experience. What happens when a logpoint <-> breakpoint conversion happens should be something that the DA should be able to determine I think as some breakpoint scenarios might not make sense in remote contexts. |
At this point in time we don't have enough validation to make the decision to ship LogPoints built-into our Node.js debugger and provide this as a default local experience. I imagine LogPoints could be functionality that many debug adaptors would like to implement if proven useful, but first I would like to us to find a way for us to explore the LogPoints concept without taking a big investment. This is the reason for idea of having extension contributing new breakpoint types instead of building in into the core, as we can ship and iterate independently. So it's interesting that it's cheaper to skip the extension model altogether. We would want all the behavior described in #163 (comment) Questions
Ultimately it all comes down to: What is the easiest way we can ship a prototype of LogPoints with a better UI in VS Code? By being built-in we would get the default UI of VS Code which also would address the UX feedback we already have received in the LogPoints MVP. To me it sounds like the cheapest way would be:
|
@auchenberg What is the difference between your notion of (local) LogPoints and the concept that already exists in VS and VS for Mac? Yes, exploring new concepts (or introducing debugger specific functionality) as an VS Code extension is the preferred approach and I did this for the "loaded scripts" functionality (which only waits for the last step of being pushed into core). But this approach only works if either the API already exists or is at least "in reach." If most of the needed API doesn't exist (e.g. most of the functionality listed in APIs are not just a few interfaces and structure definitions but they involve basically an RCP implementation that works between different processes (i.e. address spaces) and does not break down in a remote EH setup. In addition, if adding new APIs is already hard, removing APIs is almost impossible. So we do not want to introduce new APIs only for the purpose of a one-shot exploration. Answers to your questions:
Our proposal:
|
I've created microsoft/vscode-debugadapter-node#162 for the corresponding DAP changes. |
@weinand I would agree that we could look to VS and VS for Mac as validation of LogPoints as a debugging concept, but in relation to LogPoints for Node.js we are yet to verify that as as valid concept. Today we are shipping "tracepoint" in Edge DevTools that essentially are LogPoints, and we don't see much usage. Whether this is cased by little awareness, Edge dynamics or the concept simply doesn't resonate is yet to be identified. I want us to explore LogPoints for Node.js specifically, and if adding LogPoints as a general concept to VS Code is the cheapest way to explore this, I'm all in. This would also as you mentioned bring parity for VS Code with VS/VS Mac. Comments
|
|
|
I've created:
|
@roblourens we got the first glimpse of Log Point UI. I've already implemented minimal Log Point support in "legacy" node with these two commits: microsoft/vscode-node-debug@f6f2317 and microsoft/vscode-node-debug@ddd4fbe. It would be great if you could do something similar for "inspector". What is still missing on our side is microsoft/vscode#45127 and the code that extracts and evaluates embedded |
Added those changes |
@roblourens I've closed this issue because there is nothing left to do for node-debug2. |
@auchenberg let's continue further LogPoint discussions in microsoft/vscode#45128 |
@roblourens I've added support for interpolating expressions in logMessages. Please see microsoft/vscode-node-debug@1233378 |
I'm lost, what does that change do vs @auchenberg's PR? |
The log message is plain text (as in VS and VS for Mac), not an expression. Expressions are only interpolated within curly brackets. @auchenberg's PR assumed that the logMessage is an evaluatable language construct (which is not the case). Please see the VS and "VS for Mac" screenshots above in my comment #163 (comment) |
Got it, added the same. |
This is a part of a series of requests to enable "custom breakpoints" support in VS Code. See microsoft/vscode#38568
We want to light up LogPoints for the local Node debugging scenario in VS Code, so developers can get comfortable with LogPoints while debugging locally, and because we believe LogPoints will enable more people to get comfortable by using a debugger, as it's an experience that's closer to using console.log's.
Functionality
I imagine LogPoints can be enabled as a conditional breakpoint over CDP, where the passed expression simply is
console.log(<x>)
which will get evaluated in the scope of where the breakpoint hauls execution. The log message should then be surfaced in the Debug Console, as this is already working.LogPoints should be set using a UX that is similar to the conditional breakpoint logic, but use a different gutter icon.
The expression of a LogPoint should be validated to make sure it can be executed
Asks outside of this DA:
VS code:
VS Code Debug Protocol
Considerations:
Debugger.addLogPoint
in CDP and move the responsibility on level deeper, or have the implementation in inside this DA? Does the Debug Protocol (DAP) need to be extended?(@dhanvikapila, @digeff, @changsi-an, @roblourens, @weinand )
The text was updated successfully, but these errors were encountered: