-
Notifications
You must be signed in to change notification settings - Fork 4.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
[wasm][debugger] Implement Runtime.evaluate. #62142
Conversation
Tagging subscribers to this area: @thaystg Issue DetailsImplement Runtime.Evaluate, the behavior is the same of Debugger.EvaluateOnCallFrame and use the first frame to evaluate. Fixes #61974
|
@@ -329,7 +329,7 @@ internal static async Task<JObject> CompileAndRunTheExpression(string expression | |||
expression = expression.Trim(); | |||
if (!expression.StartsWith('(')) | |||
{ | |||
expression = "(" + expression + ")"; | |||
expression = "(" + expression + "\n)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just for readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No! The code that VS tries to evaluate is like I added in the test case.
Something like this:
15 //evaluate from VS
So I added this \n to avoid to comment the ")".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add that as a code comment here? And maybe a \n
before the expression too?
if (context.CallStack != null) | ||
{ | ||
Frame scope = context.CallStack.First<Frame>(); | ||
return await OnEvaluateOnCallFrame(id, | ||
scope.Id, | ||
args?["expression"]?.Value<string>(), token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super-nit:
if (context.CallStack != null) | |
{ | |
Frame scope = context.CallStack.First<Frame>(); | |
return await OnEvaluateOnCallFrame(id, | |
scope.Id, | |
args?["expression"]?.Value<string>(), token); | |
if (context.CallStack?.Length > 0) | |
{ | |
return await OnEvaluateOnCallFrame(id, | |
context.CallStack[0].Id, | |
args?["expression"]?.Value<string>(), token); |
@@ -329,7 +329,7 @@ internal static async Task<JObject> CompileAndRunTheExpression(string expression | |||
expression = expression.Trim(); | |||
if (!expression.StartsWith('(')) | |||
{ | |||
expression = "(" + expression + ")"; | |||
expression = "(" + expression + "\n)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add that as a code comment here? And maybe a \n
before the expression too?
btw, can you add to the PR description why this is being added, referencing the original issue, and the jsdebugger issue too? |
Implement Runtime.Evaluate, the behavior is the same of Debugger.EvaluateOnCallFrame and use the first frame to evaluate.
Implementing it make possible to set variable value from VSCode and Visual Studio.
Fixes #61974
Original Issues: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1366427/
JSDebugger Issue: microsoft/vscode-js-debug#1143