Giter Club home page Giter Club logo

f5anything's Introduction

Lets you put any normal console command or VSCode command into a launch.json configuration so you can run it with F5 (or whatever your normal run/debug keybind is).

Simply install the extension then add a configuration like this to the launch.json file in the .vscode folder of your workspace:

{
    "name": "F5 Anything: My Custom Command",
    "type": "f5anything",
    "request": "launch",
    "command": "echo Put your command here",
}

Replace the echo Put your command here with whatever command you want. It may include variables such as ${file}. When the launch configuration is run, the command will be run in a VSCode integrated terminal.

The full launch.json would look like:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "F5 Anything: My Custom Command",
            "type": "f5anything",
            "request": "launch",
            "command": "echo Put your command here",
        }
    ]
}

VSCode/VSCode Extension Commands

If instead (or additionally) you want to run an internal VSCode command or VSCode extension command (normally accessed from the Ctrl+Shift+P menu), put the command ID as the value of the "vscCommand" JSON key. For example, this configuration will show the Open File dialog when F5 is hit:

{
    "name": "F5 Anything: Open File",
    "type": "f5anything",
    "request": "launch",
    "vscCommand": "workbench.action.files.openFile",
}

To get a command ID:

  1. Find your command in the Ctrl+Shift+P menu
  2. Click the small gear symbol next to it that opens Keyboard Shortcuts
  3. Right click your command and hit Copy Command ID
  4. Paste it into your launch configuration as the "vscCommand" value

If "command" and "vscCommand" both exist in a launch configuration they will both be run. When either is the empty string "" it is ignored and does nothing.

Configuration Details

A quick way to add launch configurations is the "Add Configuration..." button on the bottom right of a launch.json. Hit that and start typing "F5 Anything" for a premade configuration:

adding configurations example screenshot

The basic configuration only has the necessary configuration properties ("name", "type", "request", and "command" or "vscCommand"). The full configuration has three additional optional properties that relate to "command":

  • "terminalName" (string, defaults to "F5 Anything"): The name given to the dedicated integrated terminal F5 Anything creates for itself.

  • "terminalIndex" (integer, defaults to -1): The index of the integrated terminal in the VSCode terminal list to send commands to. When -1 or out of range a dedicated terminal is created and used. Note that terminals are 0-indexed in order of creation, not by visual order.

  • "showTerminal" (boolean, defaults to true): Whether or not the terminal an F5 Anything command is sent to is given focus.

So, for example, this launch configuration will send commands to the terminal at index 0 but not switch focus to it:

{
    "name": "Another Example",
    "type": "f5anything",
    "request": "launch",
    "command": "echo Hi",
    "terminalIndex": 0,
    "showTerminal": false
}

When "command" is missing or the empty string and only "vscCommand" is present, then all of "terminalName", "terminalIndex", and "showTerminal" are ignored as they do not apply.

See the example workspace and especially its launch.json for some more launch configuration examples.

Resources

f5anything's People

Contributors

discretegames 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.