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 497
  • Win 0
  • Mac 447
  • Linux 50
Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7
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
Mac 2 1 2 0 1 1 2 6 3 4 1 1 3 1 4 2 2 4 1 3 1 2 1 0 1 1 4 1 4 1 2 1 3 4 3 3 3 0 1 0 1 1 2 2 1
Linux 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 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