开发者

Is there a way to disable or modify Xcode's code completion?

I have unchecked both "Show arguments in pop-up list" and "Insert argument placeholders for completions" in Xcode Code Sense preferences, but when I type "else" (for example) in the editor, Xcode still dumps in a pre-formatted "else" block.

Is there a way to disable this feature entirely, or (better yet) to modify the block that Xcode inserts? The default Xcode "else" block doesn't match my coding style, so the placeholder actually hampers my productivity instead of helping.

UPDATE: I just found this question Which describes how to change the default indentation and whitespace used for code completion, so that answers the second half 开发者_运维知识库of my question.

UPDATE #2: Setting "Automatically Suggest" to "never", as suggested by outis effectively disables code completion entirely. I suppose what I'm looking for is a way to disable specific code completions, (like the "else" block) while keeping all of the usual completions for variable and method names.


You can override any of the existing code completions, copy any of the .xtcmacro files from:

/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro

(you'll have to right-click on Xcode.app and say "Show Package Contents" to proceed further down the directory chain unless you are using Terminal)

into a local directory:

~/Library/Application Support/Developer/Shared/Xcode/Specifications

(You'll probably have to make the Specifications directory). Then simply go through all of the definitions in there, to eliminate an annoying completion you can take out the CompletionPrefix for any entry, or edit the code to be inserted to work how you like.

On a side note, you can put any file named .xctxtmacro and put it in that specifications directory and it will be read in, allowing you to define some very useful custom macros.


The "Text Editing" and "Indentation" preference sections might have the settings you seek.

You can set "Automatically suggest" to "never".


You can enable/disable code completion in Xcode using below steps:

  1. Click on Xcode menu on top-left corner
  2. Select Preferences... (Preference Pop-up appears)

Is there a way to disable or modify Xcode's code completion?

  1. Select Text Editing menu
  2. See Code Completion.
  3. Uncheck Suggest completion while typing option.

Is there a way to disable or modify Xcode's code completion?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜