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 716
  • Win 0
  • Mac 649
  • Linux 67
Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11
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 0 2 2 1 3 2 0 0 4 2 2 4 0 4 1 1 2 2 2 2 1 1 2 1 6 2 5 2 1 1 4 1 5 3 3 1 3 1 4 4 5 2 0 2 5
Linux 0 1 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1

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