Multiliner - An Xcode source extension to expand lengthy lines

Overview

Header image

Multiliner

An Xcode source extension to expand lengthy lines.

  • Super lightweight, 1 file.
  • It expands long lines. That's it!
  • Works with:
    • Initializers
    • Function calls
    • Array literals
    • SwiftUI modifiers

Showcase

Multiliner.mp4

Installation

  1. Download the app here
  2. Open the app
  3. Go to System Preferences → Extensions and check MultilinerExtension

System Preferences

Usage

It's simple, just highlight the code that you want to format and press Editor → Multiliner → Format Selected Code. More instructions in the app.

Screenshot of the app

Author

Multiliner is made by aheze.

Contributing

All contributions are welcome. Just fork the repo, then make a pull request.

Need Help?

Open an issue or join the Discord server. You can also ping me on Twitter. Or read the source code, I added a bunch of comments.

License

MIT License

Copyright (c) 2022 A. Zheng

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • Doesn't appear in Menu Editor

    Doesn't appear in Menu Editor

    I have installed the extension, and it doesn't appear in the Xcode menu editor.

    I'm using Xcode 13.1, and I also have installed Xcode 13.3

    I've tried several things such as the ones described here:

    • https://stackoverflow.com/a/67679577/3708095
    • https://github.com/nicklockwood/SwiftFormat/issues/494
    • https://stackoverflow.com/a/58616132/3708095

    But nothing worked, maybe it has something to do with: https://stackoverflow.com/a/39472470/3708095 ??

    bug 
    opened by jdev7 8
  • App won't install

    App won't install

    I had v1.0 installed and working, however since installing v1.1 the Xcode Source Editor section of the System->Extensions has disappeared, as if there are no extensions.

    I've tried reinstalling v1.0 and it's the same 🤷‍♂️

    Is there an additional step needed?

    opened by ddaddy 7
  • Update built-in docs

    Update built-in docs

    I just noticed that the GitHub docs / App Built-In Docs are out of sync.

    • GitHub README shows setting up a Key Binding in Xcode,
    • built-in docs of the MultilinerExtension app shows setting up an App Shortcut in System Preferences

    Cheers, and thanks for your hard work

    opened by orchetect 5
  • Preserve caret position after multi-lining selection

    Preserve caret position after multi-lining selection

    Currently, when using Multiliner to multi-line selection, the caret moves to the end of the file. When undoing, the whole file text is selected.

    It would be great if the caret stays after the closing bracket of the formatted code.

    I love this extension. Thank you for amazing work!

    enhancement 
    opened by alobaili 3
  • Improvement: Apply correct formatting on code with multiple lines

    Improvement: Apply correct formatting on code with multiple lines

    While it works perfectly on a one line function, if you already have code like this:

    func foobar(_ foo: Foo,
                           bar: Bar)
    

    and you apply multiliner, the result will be:

    func foobar(
            _ foo: Foo,
    
                           bar: Bar
        )
    

    which is not great. It would be awesome if it already detected new lines, and didn't apply new indentation. For the latter I don't know if it could re-use Xcode's reindent command for each line maybe, so you don't have to implement it yourself.

    enhancement 
    opened by jdev7 3
  • Multiliner not showing up in Extensions

    Multiliner not showing up in Extensions

    Despite having Multiliner (1.1.0) installed, it simply won't show up in System Settings -> Extensions. I've uninstalled, re-installed, restarted, etc. I'm running macOS 12.5 with Xcode 13.3.1.

    Screen Shot 2022-08-12 at 9 38 55 AM
    opened by tristanbiesecker 2
  • feat(updated): updated perform function's variable

    feat(updated): updated perform function's variable

    fixed bug: lines go up when select multiple lines that contains more than two Braket

    Before

    https://user-images.githubusercontent.com/52348220/178142903-81cfff20-244c-4f02-a100-c5f26cbd7323.mov

    After

    https://user-images.githubusercontent.com/52348220/178142899-ea667906-cd5a-4205-9e24-9aa7db47e398.mov

    opened by tkgka 2
  • How to use with macOS 13 Ventura & Xcode 14

    How to use with macOS 13 Ventura & Xcode 14

    Not an issue as I worked it out, but I thought others might look here to see how to enable this with the new System Settings app in macOS 13 Ventura.

    • Close Xcode & System Settings
    • Open the Multiliner app
    • Open System Settings
    • Go to Privacy & Security
    • Scroll down to the end and click Extensions
    • Click Xcode Source Editor and make sure Multiliner is toggled on

    Now the option appears in the Xcode's Editor menu.

    documentation 
    opened by trozware 2
  • Idea: Automatically determine scope?

    Idea: Automatically determine scope?

    I just saw this:

    https://github.com/aheze/Multiliner/blob/150c4a99e37470c49eb3b2b6e7a6417946ba9f40/Sources/MultilinerExtension/SourceEditorCommand.swift#L21

    It'd be cool, if you could only place the cursor in a scope and then it figures out the smallest matching scope that can apply?

    enhancement 
    opened by calimarkus 2
  • Add support to AppCode

    Add support to AppCode

    I LOVE this tool and I use it literally everyday when I use Xcode, but I use AppCode a lot as well, and I really really miss it. do you think adding support to AppCode is something that can be done?

    opened by NoamEfergan 1
  • Suggest adding key binding in Xcode, not System Preferences

    Suggest adding key binding in Xcode, not System Preferences

    Adding the keyboard shortcut via System Preferences has the downsides of being specific to each Xcode version (it seems to list every Xcode version I have installed, although I've not verified if they're all applied separately) and also requiring the exact name of the menu item.

    Xcode's Preferences => Key Bindings includes the action from the menu and seems to avoid these issues, so it might be easier to direct users to using this option?

    Screenshot 2022-07-11 at 23 26 15
    opened by JosephDuffy 2
  • Suggestion: add option for first parameter to be on same line

    Suggestion: add option for first parameter to be on same line

    While I am actually a fan of Multiliner's current formatting behavior, some people might prefer not having a line-break between the method name and the first parameter.

    Current Behavior

    func sendAppStatus(
        to toNodes: [Node],
        name: String?,
        bundleID: String,
        state: Int32,
        isDockApp: Bool
    ) {
        // ...
    }
    

    Proposed opt-in behavior (as a preference)

    First parameter starts on the same line, and closing parens trails immediately after the last parameter.

    func sendAppStatus(to toNodes: [Node],
                       name: String?,
                       bundleID: String,
                       state: Int32,
                       isDockApp: Bool) {
        // ...
    }
    
    enhancement 
    opened by orchetect 6
  • Closing parens of function returning a closure put onto wrong line

    Closing parens of function returning a closure put onto wrong line

    Played around with Multiliner a bit :)

    Given this input:

    func applyContentActions(action: AppAction, reducers: [TableActionReducer]) -> (_ documentState: DocumentState) -> DocumentState {
        ...
    }
    

    I expected somewhat along these lines::

    func applyContentActions(
        action: AppAction,
        reducers: [TableActionReducer]
    ) -> (_ documentState: DocumentState) -> DocumentState {
        ...
    }
    

    Actual output did try to put the parens and the arrow onto a new line, but not the first occurrence:

    func applyContentActions(
        action: AppAction,
        reducers: [TableActionReducer]) -> (_ documentState: DocumentState
    ) -> DocumentState {
        ...
    }
    
    opened by DivineDominion 1
  • Support for brew

    Support for brew

    It would be nice to have an ability to install app using brew instead of having to do it manually. What do you think?

    p.s. awesome idea for an extension 🎉

    enhancement 
    opened by ztepsa 2
Releases(1.1.0)
  • 1.1.0(Jul 6, 2022)

    Wow, didn't expect this extension to get this many installs! This update includes some bug fixes and improvements.

    • [x] Improvement: Apply correct formatting on code with multiple lines #6
    • [x] Preserve caret position after multi-lining selection #9
    • [x] Slow on large files #10
    • [x] Does not support tabs indentation #11

    Thanks for your suggestions and feedback! You can get the updated app here: https://github.com/aheze/Multiliner/raw/main/Multiliner.zip

    https://user-images.githubusercontent.com/49819455/177470984-270f367e-d90b-4841-a6fb-59043e902f8c.mp4

    Source code(tar.gz)
    Source code(zip)
Owner
Andrew Zheng
I like coding with Swift and watching anime. WWDC21 Scholar.
Andrew Zheng
CleanClosureXcode - An Xcode Source Editor extension to clean the closure syntax.

Clean Closure - Xcode Source Editor Extension Clean Closure is a simple Xcode Source Editor Extension for Xcode 8. It parses each line of a file to si

Patrick Balestra 188 Jun 18, 2022
SwiftInitializerGenerator - Xcode Source Code Extension to Generate Swift Initializers

Swift Initializer Generator This Xcode Source Code Extension will generate a Swift initializer based on the lines you've selected. Handy if you made a

Bouke Haarsma 718 Aug 21, 2022
XcodeEquatableGenerator - Xcode 8 Source Code Extension will generate conformance to Swift Equatable protocol based on type and fields selection.

Depricated! There is not need for it at the moment as Swift compiler can do that for us ?? Swift Equatable Generator Xcode 8 Source Code Extension wil

null 191 Dec 10, 2022
DocumenterXcode - Attempt to give a new life for VVDocumenter-Xcode as source editor extension.

DocumenterXcode Xcode source editor extension which helps you write documentation comment easier, for both Objective-C and Swift. This project is an a

Serhii Londar 34 Dec 17, 2022
Import - Xcode extension for adding imports from anywhere in the code ☝️

Import ☝️ Xcode extension for adding imports from anywhere in the code. Now available on App Store Why? Because sometimes you are on 300th line of cod

Marko Hlebar 839 Nov 10, 2022
Mark - Xcode extension for generating MARK comments.

Mark Xcode extension for automatic generation of MARK comments. Why? If you would like to organize your code with MARK comments, this will save you so

Velislava Yanchina 160 Dec 17, 2022
XShared - Xcode extension that allows you copying the code with special formatting quotes for social (Slack, Telegram)

This extension is for those who like to show code to the public ?? Xcode extension which allows you copying the code with special formatting quotes fo

Nikita Ermolenko 75 Jun 18, 2022
Xgist - Xcode extension to send code to GitHub's Gist

Xgist Xgist is a Xcode extension to send code to GitHub's Gist. The extension will send your code selection to Gist and automatically copy the Gist UR

Fernando Bunn 76 Jul 2, 2022
Comment-Spell-Checker - Xcode extension for spell checking and auto-correcting code comments.

Comment Spell Checker An Xcode Source Editor extension that runs spell check and auto correct on your code comments. Features Supports mutliple commen

Velislava Yanchina 157 Aug 28, 2022
Nef-plugin - 🔌 an Xcode extension to use nef features easily

This project provides an extension for Xcode to integrate some nef features directly in the IDE. Using the core of nef, you can export snippets from y

Bow 188 Dec 23, 2022
This Xcode plugin shows Xcode app version in the Dock and App Switcher icon

Xcode Icon Version Tired of this Xcode icon always showing multiple times in your App Switch with no help watshoever as to which version you are curre

Stanislas Chevallier 94 Sep 11, 2022
Snowonder - 🔮 Magical import declarations formatter for Xcode

Snowonder is Xcode Extension that adds some convenient formatting operations for Import Declarations. This extension is created with latest stable Swi

Alexey Karetski 104 Jan 4, 2023
XVim2 - Vim key-bindings for Xcode 9

XVim2 XVim2 is a Vim plugin for Xcode intending to offer a compelling Vim experience without the need to give up any Xcode features. Xcode 9 or above,

null 2.3k Jan 1, 2023
Xcode plugin to let you jump to GitHub History, Blame, PRs, Issues, Notifications of any GitHub repo with one shortcut.

Reveal-In-GitHub Xcode plugin to let you jump to GitHub History, Blame, PRs, Issues, Notifications of current repo in one second. My company work on G

lzwjava 257 May 17, 2022
Plugin for Xcode to integrate the Reveal App to your project automatic.

Reveal-Plugin-for-Xcode Plugin for Xcode to integrate the Reveal App to your project automatic(Without any modifications to your project). Please note

Eric 229 Jun 29, 2022
Xcode plugin which help you write code faster.

MLAutoReplace Xcode plugin, Re-Intent, make you write code more quickly. Use a portion code of VVDocumenter-Xcode. ##Overview You can use shortcut key

molon 233 Sep 9, 2022
XTextHandler - Xcode Source Editor Extension Tools (Xcode 8 Plugins)

Download Let's Swift! xTextHandler has been rewritten in Swift. The Objective-C version can be found in: https://github.com/cyanzhong/xTextHandler-obj

Ying Zhong (Inactive) 1.5k Sep 7, 2022
💬 A tiny extension for UIAlertController that makes working with it very simple. Only 150 lines of code.

AlertController ?? A tiny extension for UIAlertController that makes working with it very simple. Only 150 lines of code. Alert let alert = UIAlertCon

Mezhevikin Alexey 9 Nov 2, 2022
INTUZ is presenting an interesting a Multilevel Expand/Collapse UITableView App Control to integrate inside your native iOS-based application

INTUZ is presenting an interesting a Multilevel Expand/Collapse UITableView App Control to integrate inside your native iOS-based application. MultilevelTableView is a simple component, which lets you use the tableview with multilevel tree view in your project.

INTUZ 3 Oct 3, 2022
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

SwiftUI Drawer A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize. Contents Add the Package Basic Usage Examples Credits

Michael Verges 695 Jan 3, 2023