XCode 3.2:更改默认的"Code Sense".缩进和空格 [英] XCode 3.2: Changing the default "Code Sense" indentation and whitespaces
问题描述
我正在使用XCode 3.2(在雪豹"上),该代码(仍然)具有很好的文本宏"自动完成功能(例如,如果键入if
,它将扩展为if (<#condition#>) { <#statements#> }
).这些宏也可以通过编辑->插入文本宏"获得.
I'm working with XCode 3.2 (on "Snow Leopard") which (still) has this nice "Text Macro" auto-completion feature (eg. if you type if
it will expand to if (<#condition#>) { <#statements#> }
). These macros are also available via "Edit->Insert Text Macro".
不幸的是,默认模板与我喜欢的缩进和空格样式不匹配,因此我想对其进行修改.
Unfortunately, the default templates don't match my beloved indentation and whitespace style so I'd like to modify them.
根据此过时的StackOverflow线程,相应的定义应位于/Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro
,但我使用Snow Leopard和XCode 3.2找不到任何东西(不确定是哪一个负责).
According to this slightly outdated StackOverflow thread the corresponding definitions should be located at /Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro
but I can't find anything there using Snow Leopard and XCode 3.2 (not sure which one is responsible).
今天有没有人注意到Apple定义的文本宏的位置?
Has anyone noticed where the Apple defined Text Macros are located nowadays?
推荐答案
我系统上唯一的**.xctxtmacro *文件位于XCode.app捆绑包内.在快速浏览了定义之后,我发现了一种完全不同的方式来调整所有预定义宏的格式:
The only **.xctxtmacro* files on my system were within the XCode.app bundle. After having a quick look a the definitions, I found a completely different way of adapting the formatting of all predefined macros:
您只需设置 XCCodeSenseFormattingOptions 用户默认设置可以修改所有宏中的默认换行符和其他空格!
You can simply set the XCCodeSenseFormattingOptions user defaults to modify the default newlines and other whitespaces within all macros!
例如,宏"if-else"默认情况下如下所示:
For example the macro "if-else" looks like this by default:
if (<#condition#>) {
<#statements#>
} else {
<#statements#>
}
执行命令后
defaults write com.apple.Xcode XCCodeSenseFormattingOptions
-dict PreExpressionsSpacing "" BlockSeparator "\n" PostBlockSeparator "\n"
它看起来像这样(我更喜欢):
it looks like this (which I prefer):
if(<#condition#>)
{
<#statements#>
}
else
{
<#statements#>
}
这篇关于XCode 3.2:更改默认的"Code Sense".缩进和空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!