Plugin to Enhance Swift Support

I have begun writing a plugin to add to the Swift support in appCode. I picked a few features just for the sake of proving out that the plugin was possible, and I will show them. But I would like the community to make requests for things to implement. There are so many things that can be done, so I'd like to get a read on what people would find useful.

As it stands right now. I have only a few features.

  1. Additional syntax highlighting for optionals and optional operators
  2. Variable Read/Write highlighting
  3. Remove unneeded parenthesis from if statement intention
  4. Convert closure parameter to trailing closure syntax intention.
  5. Unneeded return in closure inspection (with QuickFix)

 Anyone wishing to contribute can do so on my GitHub repo: https://github.com/sylvanaar/appCode-Swift-Extensions

Heres a screenshot of the convert to trailing syntax intention.

 

Here is an example of optional highlighting: (Bold + Italic = Implicitly Unwrapped Optional, Underlined = Optional)

You can see right now there is a bug in how appCode resolves as! casts.

Here's the unneeded return inspection:

0
3 comments

What do you think. Should the intentions be inspections instead?

0
Avatar
Permanently deleted user

Hi Jon,

This looks very nice.  I definitely like the optional/optional operator highlighting, as well as the trailing closure intention.  I think I'd change the if-statement parenthesis removal to an inspection, but that's a very minor point.

What other features are you thinking about?

-Scott

0

One feature I would really like to tackle is to perform the following refactoring

Given:

class Foo: Bar, Protocol1 {

}

I would like to allow you to take Protocol1 and make it a class extension:

class Foo : Bar {

}

extension Foo:Protocol1 {

}

That seems like a pretty challenging one, so I have been sticking with just getting some small features in first. Low hanging fruit so to speak.

I am just starting simple to get my feet wet, and understand better how to use the Swift Psi model.

I agree, the if-statement parenthesis should probably be an inspection, I'll probably change it.

 

 

 

0

Please sign in to leave a comment.