XCode 3.2:更改默认的“Code Sense”缩进和空格

发布于 2024-08-06 05:55:38 字数 520 浏览 3 评论 0原文

我正在使用 XCode 3.2(在“Snow Leopard”上),它(仍然)具有这个不错的“文本宏”自动完成功能(例如,如果您输入 if ,它将扩展为 if (<#condition#>) { <#statements#> })。这些宏也可以通过“编辑->插入文本宏”获得。

不幸的是,默认模板与我喜爱的缩进和空白样式不匹配,因此我想修改它们。

根据 这个稍微过时的 StackOverflow 线程,相应的定义应位于 / Developer/Library/Xcode/Specifications/{C,HTML}.xctxtmacro 但我找不到使用 Snow Leopard 和 XCode 3.2 的任何内容(不确定是哪一个负责)。

有谁注意到苹果定义的文本宏现在位于哪里?

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.

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).

Has anyone noticed where the Apple defined Text Macros are located nowadays?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柒七 2024-08-13 05:55:38

我的系统上唯一的 **.xctxtmacro* 文件位于 XCode.app 包中。快速查看定义后,我发现了一种完全不同的方法来调整所有预定义宏的格式:

您可以简单地设置 XCCodeSenseFormattingOptions 用户默认修改所有宏中的默认换行符和其他空格!

例如,宏“if-else”默认看起来像这样:

if (<#condition#>) {
    <#statements#>
} else {
    <#statements#>
}

执行命令后,

defaults write com.apple.Xcode XCCodeSenseFormattingOptions
-dict PreExpressionsSpacing "" BlockSeparator "\n" PostBlockSeparator "\n"

它看起来像这样(我更喜欢):

if(<#condition#>)
{
    <#statements#>
}
else
{
    <#statements#>
}

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:

You can simply set the XCCodeSenseFormattingOptions user defaults to modify the default newlines and other whitespaces within all macros!

For example the macro "if-else" looks like this by default:

if (<#condition#>) {
    <#statements#>
} else {
    <#statements#>
}

After executing the command

defaults write com.apple.Xcode XCCodeSenseFormattingOptions
-dict PreExpressionsSpacing "" BlockSeparator "\n" PostBlockSeparator "\n"

it looks like this (which I prefer):

if(<#condition#>)
{
    <#statements#>
}
else
{
    <#statements#>
}
水波映月 2024-08-13 05:55:38

我相信“defaults write com.apple.Xcode”不适用于最新版本的 Xcode。

解决方法是编辑默认的代码片段。

但是,Xcode 不允许修改默认的代码片段。

为了修改它们,您可以从此处下载“Snippet Edit”程序

I believe that "defaults write com.apple.Xcode" doesn't work on the latest versions of Xcode.

The workaround is to edit the default Code Snippets.

However, Xcode doesn't allow to modify the default Code Snippets.

In order to modify them, you can download a "Snippet Edit" program from here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文