简体   繁体   中英

Xcode plugin for improving code completion

Recently I've done a small service (available in Github) to return a switch case structure from a given enum .

The next step is to achieve this behaviour as an Xcode code completion option when I begin typing the enumeration name.

代码完成

What I want is to add a new option in this popup giving the possibility of generating a switch case with those three options.

I'm searching for documentation to make an Xcode plugin but I can't find much. My first question, and the most important is: is it possible to get the definition of a symbol while I'm typing it, to extract the data of the enum and generate the snippet?

You can have a look at KSImageNamed, an XCode plug-in used to add autocompletion on image name.

You can inspire yourself on its code.

KSImageNamed-Xcode

an alternative to what you are suggesting is to save it as a code snippet. it wont be dynamic like you probably want it, but if you are using the same enum over and over, it can work. 在此输入图像描述

I just find a plugin that makes exactly what I wanted, SCXcodeSwitchExpander . It works like a charm :D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM