ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Swift Format

by aerobounce ST3 MacLinux

Swift Formatter / Syntax Checker for Sublime Text 3

Details

Installs

  • Total 1K
  • Win 0
  • Mac 1K
  • Linux 99
Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 3 2 2 0 0 3 4 8 5 9 4 1 2 3 2 2 2 1 1 0 1 1 6 4 1 1 3 0 2 1 1 4 0 1 1 1 3 1 0 1 3 2 2 4 3
Linux 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0

Readme

Source
raw.​githubusercontent.​com

⚡️ Swift Format

Swift Formatter / Syntax Checker for Sublime Text 3

⚡️Blazingly Fast Formatting
❗️User Friendly Syntax Error Indication

Install

  1. Package Control: Install Package
  2. Type Swift Format and Install

Manual Install

  1. Clone this repository to .../Sublime Text 3/Packages/ (Note that target directory name has to be Swift Format)
  2. Ready (Restart Sublime Text if the package is not recognized)

Requirements

swiftformat

  • Available via Homebrew brew install swiftformat (For more details, visit: nicklockwood/SwiftFormat)
  • macOS users: If your shell have PATH to swiftformat you are ready.
  • If above is not the case, specify the swiftformat_bin_path in the settings:
{
    "swiftformat_bin_path": "PATH to swiftformat"
}

Commands

Command is the name of the command you can use for Key-Bindings.

Caption Command Default Key Bindings
Swift Format: Format swift_format None
Swift Format: Format Selection swift_format_selection None
Swift Format: Settings N/A None

Settings

By default, swiftversion is not specified. It's recommended to specify the version — some rules will be omitted unless it's specified.

{
    /*** Swift Format Settings ***/
    "swiftformat_bin_path": "swiftformat",
    "format_on_save": true,         // Invoke "Swift Format: Format" command on save
    "format_selection_only": false, // Entire file will be used if no selection available
    "scroll_to_error_point": true,  // Scroll to the point syntax error occured
    "use_config_file": true,        // Find config file and use if found
    "config_paths": [               // Paths to find a config file
        "${project_path}/.swiftformat",
        "${file_path}/.swiftformat",
        "${folder}/.swiftformat"
    ],

    /*** SwiftFormat CLI Options ***/
    // • Use "rules" key to use specific rules only
    // • Use "disable" key to disable specific rules
    // • "swiftformat --rules" to see up-to-date rules
    "swiftversion": "", // The version of Swift used in the files being formatted
    "rules": "",        // The list of rules to apply.
    "disable": "",      // A list of format rules to be disabled (comma-delimited)

    /*** Formatting Options ***/
    // • Specify without hyphens
    // • "swiftformat --options" to see up-to-date options
    // • Example:
    //     "options": {
    //         "allman": "false",
    //         "ifdef": "no-indent"
    //     }
    "options": {},

    /*** Raw Options ***/
    "raw_options": []
}

Acknowledgements