Giter Site home page Giter Site logo

vscode-compoundlaunch's Introduction

vscode-compoundlaunch

An example of how to use compound launch configurations in VS Code.

How do I run this?

Clone the repository.

git clone https://github.com/oliverroer/vscode-compoundlaunch.git

Open the root folder in VS Code.

On the sidebar, click on the debug icon to open the debug tab.

Click the top drop-down.

You will see multiple options, including:

  • .NET Core Launch (Client): This will debug just the client.
  • .NET Core Launch (Server): This will debug just the server.
  • .NET Core Launch (Server/Client): This will debug the server and the client, at the same time!

Choose .NET Core Launch (Server/Client) from the dropdown.

Click the green play-button next to the dropdown, or press F5 to start debugging.

You are now debugging the client and the server at the same time.

Try setting a breakpoint in the for-loop in Client/Program.cs and the Get() method of Server/Controllerse/ValuesController.

Run the debugger again.

You should be able to see how the debugger seamlessly jumps back and forth between the server and client, depending on which breakpoint is hit next.

How did you configure this?

Quite easily, actually. They've added a feature to VS Code called compound launch configurations which allows you to compose multiple launch configurations into a new launch configuration, which will run all declared configurations simultaneously.

This is all configured in the .vscode/launch.json file.

Under configurations, you'll find the definitions for regular launch configurations.

Here's the one for debugging the client:

{
    "name": ".NET Core Launch (Client)",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/Client/bin/Debug/netcoreapp2.1/Client.dll",
    "args": [],
    "cwd": "${workspaceFolder}/Client",
    "console": "externalTerminal",
    "stopAtEntry": false
}

Here's the one of debugging the server:

{
    "name": ".NET Core Launch (Server)",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/Server/bin/Debug/netcoreapp2.1/Server.dll",
    "args": [],
    "cwd": "${workspaceFolder}/Server",
    "console": "externalTerminal",
    "stopAtEntry": false
}

Note the names here; .NET Core Launch (Client) and .NET Core Launch (Server).

Further down, you'll find a compounds property, containing an array of named compounds.

Here's I've declared one compound, named .NET Core Launch (Server/Client) which combines .NET Core Launch (Client) and .NET Core Launch (Server):

{
    "name": ".NET Core Launch (Server/Client)",
    "configurations": [
        ".NET Core Launch (Server)",
        ".NET Core Launch (Client)"
    ]
}

This is what makes .NET Core Launch (Server/Client) appear in the debug dropdown, and triggers a debug session wherein you can debug both the client and the server.

vscode-compoundlaunch's People

Contributors

oliverroer avatar olpr-cloud avatar

Watchers

James Cloos 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.