/vscode-procfile

A Visual Studio Code extension with support for Procfiles

Primary LanguageTypeScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Procfile extension for Visual Studio Code

A Visual Studio Code extension with support for Procfiles.

syntax hilighting

The Procfile is mostly known for its use by Heroku and Foreman. However, it is supported by a number of other services and utilities, and is extremely handy for development.

Features

This extension is packed with features, especially for one that you will hardly ever have to use! However, I believe both you and the humble Procfile deserve only the best. :)

Syntax Highlighting

As seen above, within Procfiles the names of valid process definitions are highlighted. The process values are also highlighted as shell commands.

Service-Specific Information

Some services, such as Heroku, give special meaning to certain process names. Hovering over those will now give a description and a link to documentation.

Formatting

Having whitespace between the process name and the command is optional. This extension exposes an insertSpace (default: true) setting to its formatters. All three types of formatting are provided: on-type, selection, and complete document.

Diagnostics

A Procfile must have unique process names. The extension provides feedback when a name has been duplicated.

Symbol Navigation

You have probably never seen a long Procfile, but just in case you do, this extension has you covered! You can navigate through the processes via breadcrumbs or the command palette.

Release Notes

See the changelog.

Todo

There are still a few things I plan to do.

Cleanup

  • Write tests:
    • core
    • diagnostics
    • formatters
    • hovers
    • symbols
  • Clean up core modules (reconsider the Line/Text setup)
  • Consider releasing core module as own procfile package

Features

  • Add automatic tasks (t1, t2) for running Procfiles.

Procfile example

As an example of how handy a Procfile can be, with this .env file:

DJANGO_SETTINGS_MODULE=my_site.settings.local
WEB_HOST=0.0.0.0:8000
BROWSERSYNC_PORT=9000

… and this Procfile:

# Run the Django Web app.
django: django-admin runserver "$WEB_HOST"

# Monitor and rebuild all static/front-end assets.
assets: npm run watch

# Run Browser Sync proxied to the Django Web app.
djsync: browser-sync start --proxy="$WEB_HOST" --port="$BROWSERSYNC_PORT"

… you can run honcho start and have it all up and running!

Procfile runners: Foreman & Clones

The most used and robust are:

Others include:

  • node-foreman (Node) — n.b. How on earth is this not named “Noreman”? I insist on referring to it as such!
  • Shoreman (Shell)
  • forego (Go)

There is no published standard for Procfile syntax, but Foreman can be used as the reference implementation. Though the various runners recognize different things as comments, process, or errors, Foreman’s syntax is recognized by this extension.

Procfile Foreman Honcho Goreman Noreman Shoreman forego
n0:·…
n1:…
n-4:·…
# n3:·… # # # # #
#n4:·… # # # # #
n5·:… # #
·n6:·… # #
n·7:·… # # ✓ / ✗
n8·:·… # #
n9·… # # #
legend
valid process
ignored / comment #
error / hang

Development

You can get an environment running however works for you, but scripts are available to do most of the work. Before running them you must have:

  1. a working Homebrew installation
  2. a working Node.js installation
  3. a working Python installation

At that point you can run the bootstrap script. (It can be safely run multiple times, but it need only be run once.)

./bootstrap

From that point on the Justfile should do what you need. For example:

just ls
just setup
just build
just clean