NitGuard

Configurable code formatting for Xcode.

Features

Contextual configuration

Currently, source editor extensions need to be sandboxed. This means that they cannot read the filesystem or have any environmental context. Most formatting tools work with a configuration file. The work around to sandboxing is requiring the user to load a configuration using the extension's container app UI. If the user switches between projects, they might need to load a different configuration each time.

NitGuard escapes sandboxing limitations and reads configuration relative to your current workspace.

Consistent keybinding

Using Xcode, you might write code in a handful of different languages. Each language might have a different formatting extension, and then you might have each command bound to a different shortcut.

NitGuard has one editor command backed by your arbitrary contextual configuration, so you never need to execute a different formatting shortcut.

Flexibility

Most formatting extensions are single purpose. They invoke a given formatter.

NitGuard's arbitrary configuration allows ultimate control on how to delegate formatting commands and build any custom code processing pipeline.

How

Put a .nitguard file next to your workspace or project file. It can look something like this:

{
    "command": "tools/swiftformat",
    "args": [ "--config", ".swiftformat" ]
}

Or this:

{
    "command": "tools/clang-format",
    "args": [ "--assume-filename, "${CTX:documentName}" ]
}

See the full documentation for more options.

Who

NitGuard is developed by me