Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 809
e.James Avatar asked Feb 07 '10 22:02

e.James


2 Answers

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.

like image 76
Kendall Helmstetter Gelner Avatar answered Oct 19 '22 13:10

Kendall Helmstetter Gelner


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

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

like image 20
outis Avatar answered Oct 19 '22 13:10

outis