如何在Xcode包含标记中格式化代码 [英] How to format code in Xcode INCLUDING MarkUps

查看:71
本文介绍了如何在Xcode包含标记中格式化代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道使用Xcode可以使用 Editor-> Structure-> Re-Indent 格式化代码,当我想重新缩进所有代码(包括标记)时,我遇到的问题是这个:

I Know that using Xcode is possible to format code using Editor -> Structure -> Re-Indent the issue I'm having is when I want to Re-Indent all my code including markUps like this:

/**
     Append new motive to motives array
     - parameters:
        - name: A brief description of motive.
     - returns: false if is empty otherwise true
*/

注意::如果我选择所有代码并重新标识,则标记代码将如下所示:

Note: if I select all my code and Re-Ident it the MarkUp code will look like this :

/**
     Append new motive to motives array
     - parameters:
     - name: A brief description of motive.
     - returns: false if is empty otherwise true
*/

这会影响显示的快速帮助,我在缩进之前和之后都添加了图片.

This going to affect the Quick Help shown, I've added both pictures before indent and after it.

缩进快速帮助之前:

缩进快速帮助后:

看缩进我的代码后,快速帮助没有显示出来,请仔细查看它消失的 parameters 行,因为它需要从-参数缩进:一个标签.

Look that after Indent my Code the Quick help is not shown as it has to be, look specially the parameters row it disappear because it needs to be indent from - parameters: one tab.

问题是如何缩进我的代码,包括对MarkUps的适当缩进,或者如何选择我的所有代码对它进行缩进,但不影响MarkUps.

The questions is how can I Indent my code including the appropriate indent to MarkUps or how can I select all my code Indent it but not affect the MarkUps.

推荐答案

看起来有些错误尚未修复.我推荐下面的方式来描述参数.

It looks kind of bugs not fixed yet. I recommend the way of below for description of parameters.

/**
 Append new motive to motives array

 - parameters name: A brief description of motive
 - parameters opt: A options

 - returns: false if is empty otherwise true
 */
public func exampleFunc(_ name: String, options opt: Options) {
  ...
}

但是我更喜欢与XCode自动缩进一起使用.

But I prefer to use with auto indentation of XCode.

/**
Append new motive to motives array

- parameters name: A brief description of motive
- parameters opt: A options

- returns: false if is empty otherwise true
*/
public func exampleFunc(_ name: String, options opt: Options) {
  ...
}

即使使用自动缩进,也会使格式始终相同.

It will make format always same even use auto indentation.

这篇关于如何在Xcode包含标记中格式化代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆