DEV Community

loading...

Discussion on: How To Improve Your Daily Routine with VSCode Tasks

Collapse
pzelnip profile image
Adam Parkin

Tasks are the most underrated and under-utilized feature of VS Code, thanks for writing this to help share with others how useful they are. I'm not in Javascript land myself, so didn't realize that the npm integration was so slick. That's pretty cool!

For me, I use tasks all the time, most of my work in in Python and I have tasks for:

  • Running a Django server
  • opening up a Django shell
  • Running all my unit tests
  • Generating a test coverage report & opening said report in a web browser
  • Installing a Python package into the current Python virtual environment
  • updating all my 3rd party dependencies via pip
  • Opening up a Postgresql shell (psql)
  • opening up the current checked out branch in my CI server in a browser

These things all save me so much time day-in, day-out. Another pro-tip around tasks is you can assign hotkeys to them. For example my task for running a local dev server is named "Run Server", and in my keyboard preferences I have:

    {
        "key": "cmd+shift+r",
        "command": "workbench.action.tasks.runTask",
        "args": "Run Server"
    },

Now just by pressing cmd+shift+r my local dev server starts. Many of my other tasks have similar keybindings. Huge time saver. You can also have composite tasks (ie a task which is made up of multiple tasks), which combined with a hotkey can be super useful. I wrote a blog post on this: codependentcodr.com/visual-studio-...

Recently they added user-level tasks as well so you can define tasks at the user level and they'll show up in your list of tasks across all projects (instead of just project-specific ones).

There's so many useful neat things you can do with them, everybody should check out the docs on them: code.visualstudio.com/docs/editor/...

Anyways great post!

Collapse
borys_kupar profile image
Borys Kupar Author

Indeed, many people seem to have never tried them before. Your setup looks awesome! Hotkeys for tasks are mind-blowing! I didn't know it about it. Thanks for sharing!