Coder Social home page Coder Social logo

ghostface781 / vscode-debug-launcher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fabiospampinato/vscode-debug-launcher

0.0 0.0 0.0 4.27 MB

Start debugging, without having to define any tasks or launch configurations, even from the terminal.

License: MIT License

TypeScript 95.10% JavaScript 4.90%

vscode-debug-launcher's Introduction

Debug Launcher

Logo

Start debugging, without having to define any tasks or launch configurations, even from the terminal.

This extension will generate a launch configuration for you, unless you explicitly provide one, via one of its included launch configurations providers.

There's currently built-in support for Node.js projects/files, Python files and VSCode extensions. Support for other types of projects/files can be added easily, PRs are welcome.

Install

Follow the instructions in the Marketplace, or run the following in the command palette:

ext install fabiospampinato.vscode-debug-launcher

Usage

Auto

Run the Debug Launcher: Auto command to automatically start debugging. The launch configuration will be generated this way:

  • If you defined any launch configurations => ask which one to use, unless there's only one
  • If your project is a VSCode extension => generate a launch configuration for it
  • If your project is a Node.js project and the bin/main field in package.json is set => generate a launch configuration for it
  • If your current file is a Node.js file => generate a launch configuration for it
  • If your current file is a Python file => generate a launch configuration for it

File

Run the Debug Launcher: File command to automatically start debugging the current file.

Terminal

You can also launch VSCode's debugger from the terminal, this extension defines a custom URI handler that looks like this:

vscode://fabiospampinato.vscode-debug-launcher/<command>?args=<arg1>,<arg2>,<argN>

You can substitute <command> with the name of any command defined by this extension, like auto, file or launch.

You can substitute <argN> with an argument to pass to the command. Any JSON-parsable value or string is allowed.

Some examples:

# The "open" command is macOS-specifc, under Linux you may use "xdg-open" and under Windows "start".
open 'vscode://fabiospampinato.vscode-debug-launcher/auto?args=/path/to/project' # Trigger `Debug Launcher: Auto` on the provided path
open 'vscode://fabiospampinato.vscode-debug-launcher/file?args=/path/to/foo.js' # Trigger `Debug Launcher: File` on the provided path
open 'vscode://fabiospampinato.vscode-debug-launcher/launch?args={"type":"node","name":"Foo","request":"launch","program":"/path/to/foo.js"}' # Launch the debugger using a custom launch configuration

Here there are some helper functions/plugins for launching the debugger from the terminal.

Settings

Each launch configuration provider has a name, you can overwrite its configuration and commands via the settings:

{
  "debugLauncher": {
    "[project.node]": { // Name of the provider wrapped in brackets
      "configuration": { // Configuration settings to override
        "stopOnEntry": true
      },
      "commands": [ // Commands to execute before launching the debugger
        "npm run bundle",
        "./prepare"
      ]
    }
  }
}

Debugging will fail if any of the provided commands to execute fails, check out what commands the providers define and remove the ones you don't need.

Demo

Auto

Auto

File

File

Terminal

Terminal

Hints

  • Restart: in case the generated launch configuration requires the execution of some scripts in the terminal you'll have to trigger the Debug Launcher: Auto command again if you want to restart it properly, otherwise those scripts are not re-executed.
  • StatusBar Debugger: this other extension has built-in support for Debug Launcher and allows you to debug with a click. Also it gives you a debugger in the statusbar.

Contributing

If you found a problem, or have a feature request, please open an issue about it.

If you want to make a pull request you can debug the extension using Debug Launcher.

License

MIT © Fabio Spampinato

vscode-debug-launcher's People

Contributors

fabiospampinato avatar kgfly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.