Skip to content

About

Raycast Format Code Extension

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

format-code

Formats source code from stdin and writes the formatted code to stdout.

Install

pnpm install
pnpm run build
pnpm add --global "$PWD"

Usage

format-code <language> [--print-width=100] [--sql-dialect=sql] < input

Languages: angular, css, glimmer, graphql, html, javascript, json, json5, less, lwc, markdown, mdx, scss, typescript, vue, yaml, sql, sql-output.

The sql-output language formats a SQL query and its result as two Markdown code blocks.

To format the code on the macOS clipboard, run:

pbpaste | format-code json | pbcopy

macOS shortcuts

To generate a signed shortcut for each language, run:

format-code shortcuts --sql-dialect postgresql

Each shortcut formats the code on the clipboard and copies the result back to the clipboard. The command writes the files to the current directory. To import a shortcut, open its file:

open "Format JSON.shortcut"

To see all the options, run format-code shortcuts --help.

Development

The project uses devenv to install Node.js and pnpm. To enter the dev shell, run:

devenv shell

If you use direnv, run direnv allow one time. Then direnv loads the dev shell when you enter the folder.

About

Raycast Format Code Extension

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages