microsoft / ClearScript

A library for adding scripting to .NET applications. Supports V8 (Windows, Linux, macOS) and JScript/VBScript (Windows).
https://microsoft.github.io/ClearScript/
MIT License
1.74k stars 148 forks source link

Implement JavaScript script step-by-step debugging mode to monitor changes in JavaScript variable values #512

Closed Rison-Hub closed 1 year ago

Rison-Hub commented 1 year ago

My JavaScript script is in a self-developed script editor, and I want to implement a step-by-step debugging feature similar to the one in Google Chrome's developer tools. How can I achieve this? Are there any guidelines or directions available? Alternatively, is it possible to integrate with VS Code to execute C# code in Visual Studio and debug JavaScript code in VS Code?

ClearScriptLib commented 1 year ago

Hello @Rison-Hub

I want to implement a step-by-step debugging feature similar to the one in Google Chrome's developer tools.

Debuggers communicate with embedded V8 runtimes via a combination of HTTP and WebSocket protocols. Take a look at the Chrome DevTools Protocol site. The home page has some general information, and the V8 Inspector Protocol page lets you explore the protocols that support debugging of JavaScript code running in embedded V8 runtimes.

Alternatively, is it possible to integrate with VS Code to execute C# code in Visual Studio and debug JavaScript code in VS Code?

Yes, you can debug your ClearScript-based .NET application in Visual Studio, while simultaneously debugging its script code in Visual Studio Code, Chrome, Edge, or another V8 Inspector client.

Good luck!

Rison-Hub commented 1 year ago

Hello @Rison-Hub

I want to implement a step-by-step debugging feature similar to the one in Google Chrome's developer tools.

Debuggers communicate with embedded V8 runtimes via a combination of HTTP and WebSocket protocols. Take a look at the Chrome DevTools Protocol site. The home page has some general information, and the V8 Inspector Protocol page lets you explore the protocols that support debugging of JavaScript code running in embedded V8 runtimes.

Alternatively, is it possible to integrate with VS Code to execute C# code in Visual Studio and debug JavaScript code in VS Code?

Yes, you can debug your ClearScript-based .NET application in Visual Studio, while simultaneously debugging its script code in Visual Studio Code, Chrome, Edge, or another V8 Inspector client.

Good luck!

Do you provide any documentation or demo for reference regarding the specific process? Thanks

ClearScriptLib commented 1 year ago

Hi @Rison-Hub,

Do you provide any documentation or demo for reference regarding the specific process?

Debugger implementation is beyond the scope of the ClearScript project. However, there are several open-source debuggers that work with embedded V8 runtimes. Chromium's DevTools is an example, as is Visual Studio Code's vscode-js-debug. Also, Node.js has a simple built-in command-line debugger whose source code might be a useful reference.

As for simultaneous .NET and script debugging, you can find Visual Studio information here and instructions for using Visual Studio Code with ClearScript in Section VII here. The .NET and script debuggers operate independently and don't interfere with each other.

Cheers!

Rison-Hub commented 1 year ago

Hi @Rison-Hub,

Do you provide any documentation or demo for reference regarding the specific process?

Debugger implementation is beyond the scope of the ClearScript project. However, there are several open-source debuggers that work with embedded V8 runtimes. Chromium's DevTools is an example, as is Visual Studio Code's vscode-js-debug. Also, Node.js has a simple built-in command-line debugger whose source code might be a useful reference.

As for simultaneous .NET and script debugging, you can find Visual Studio information here and instructions for using Visual Studio Code with ClearScript in Section VII here. The .NET and script debuggers operate independently and don't interfere with each other.

Cheers!

OK,Thanks