Swift code folding

Originator:massil.yataghene
Number:rdar://22537041 Date Originated:02/09/2015
Status:Open Resolved:
Product:XCode Product Version:7.0 beta 6 (7A192o)
Classification:UI/Usability Reproducible:Always
 
Summary:
Xcode currently allows only functions and classes to be collapsed.
Extensions, computed variables, comment blocks, etc. are exempt from this for some unknown reason.
The ability to collapse large blocks of code/comments would be a huge help in improving readability.

Steps to Reproduce:
1. Create a new class
2. Add a computed var with a get and set block.
3. Add a comment block (e.g. documentation for the class)
4. Try to fold the get block, the set block, the computed property
5. Try to fold the comment block.

Expected Results:
/* ... */

/// ...
class Test {
    /// Is the code folded ?
    var isfolded: Bool { ... }

    /** ... */
    class func fold(toFold: Any, fold: Bool = true) -> Bool { ... }
}

/** ... */
extension Test { ... }



Actual Results:
/*######################
## At least let us collapse ##
##### selected code ######
######################*/

/// Freaking wall of text
/// because good software is documented software. 
class Test {
    /// Is the code folded ?
    var isFolded: Bool! {
        return false
    }

    /**
         Folds `toFold` if `fold` is true.

         :param: toFold  The thing to fold.
         :param: fold       Proceed with the folding?

         :return: `true` on success. `false` otherwise. 
    */
    class func fold(toFold: Any, fold: Bool = true) -> Bool {
          guard fold else {
               return false;
          }
          return doSomethingWith(toFold);
    }
}

/** 
     Adds some random capabilities to Test
 */
extension Test {
    /// Determines the behaviour of fold()
    var foldedBool: Bool! {
        get {
              return value
        }
        set(newValue) {
              save(newValue)
        }
    }

    /**
         ....
    */
    func foldMyself() -> Bool {
         return Test.fold(self, fold: foldedBool);
    } 
}



Version:
XCode: 7.0 beta 6 (7A192o)
OS X:   10.10.5 (14F27)


Notes:
At least add the possibility to collapse selected code.

Configuration:
This happens every time.

Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!