How to debug Deno in VSCode
Debugging Deno programs in VSCode can be configured and executed through the following steps:1. Install Required PluginsFirst, ensure that the 'Deno' plugin is installed in your VSCode. This plugin is provided by denoland and can be installed by searching for 'Deno' in the VSCode extension marketplace.2. Enable DenoIn your project, ensure that Deno support is enabled. You can enable it in one of the following ways:Workspace Settings: Open the file in the directory and add the following configuration:Through Command Palette: Open the command palette (Ctrl+Shift+P or Cmd+Shift+P), type 'deno: enable', and select it to enable Deno support.3. Configure DebuggerNext, configure the debugging environment for Deno in VSCode. Create or edit the file in the directory and add the following configuration:In this configuration:"type": "pwa-node" specifies the use of the Node.js debugging protocol."runtimeExecutable": "deno" specifies using Deno as the runtime environment."runtimeArgs" includes the necessary arguments for running the Deno program, such as to enable debugging and to grant all permissions (adjust permissions as needed based on your specific requirements).4. Start DebuggingAfter configuration, open the 'Run and Debug' sidebar in VSCode, select the newly created 'Deno' configuration, and click the green start debugging button (or press F5). VSCode will then launch the Deno program and wait for the debugger to connect on the specified port.5. Set BreakpointsSet breakpoints in your code; when execution reaches a breakpoint, VSCode will pause automatically, allowing you to inspect variable values, call stacks, and other information to understand and debug the execution flow.ExampleConsider the following simple Deno program :Set a breakpoint before the function call; when execution triggers the breakpoint, you can inspect the values of the input parameters and .ConclusionBy following these steps, you can conveniently set up, run, and debug Deno programs in VSCode, leveraging the powerful debugging tools of VSCode to improve development efficiency and code quality.