开发者

Is there a way to have Xcode 5 autocomplete like Visual Studio?

Xcode 5 now displaced Xcode 4, and one common complaint that I had against both IDEs is that they don't autocomplete very aggressively. In Visual Studio, autocompletion is committed as soon as you hit a non-identifier key (like a paren开发者_StackOverflow社区thesis, a comma, a dot, a space, etc). On Xcode 5, you have to hit tab or enter.

Is there a known way to get a behavior closer to Visual Studio's for autocompletion?


You can select following two options from XCode->Preferences->Text Editing:

  1. Suggest completions while typing.
  2. Enable Type-over completion

Is there a way to have Xcode 5 autocomplete like Visual Studio?


You're not listing the other problem, XCode autocompletes by alphabetical values, not compatible ones. Visual Studio actually gives you things that work, but in XCode you can shove an Int to a class or visa-versa thanks to autocomplete.

The options that come closest are in XCode menu->Preferences->Text Editing. However, it doesn't have what you are after. I do notice autocompleting the brackets isn't very intelligent and I may turn mine off soon.

Anyway, the XCode alternative IDE actually has contextual autocomplete, which greatly improves your ability to code without looking at the docs. Unsure what its preferences are but it may be worth looking at. I'm not trying to advertise it so I'll let you google the XCode alternative if you want to.

In practice, the . and , "stopping" autocomplete actually saves me many times. For example, write for(int x = 0; x < 5; x++) {} then try to change the x to a y. Autocomplete will step in and completely throw you off, unless you hit space or . or ,. If you had aggressive autocomplete, it would shove in its nonworking alphabetical value at the top of the list.

Long story short, XCode 4 isn't separate from the rest of the mac, a nightmare when you try to go and use it. For one clear example, take a large text file in TextEdit, and scroll halfway down. Wait a second, now try to highlight half of the document. (Your scroll bar will disappear before you can do anything, for example).

The answer you're looking for may or may not exist, but I hoped to provide you with some alternatives that may satisfy your craving. The example at the end just shows the true nature of the tools and their UI principle.

There's always Monodevelop, (not objective C, but should be more customizable), or perhaps an ide that has Objective C, if you don't mind coding in alternatives.

Good luck, I wish XCode had more customizing too.


In xCode the only way to autocomplete is pressing tab key or "ctrl space" to have a list of all methods and variable starting with that char sequence. If you want, you can customize the key shortcut pressing "cmd ," and, in the section "Key Bindings", you can customize it.


You can use a key shortcut to show a completion list.

You can press "ctrl + ," and it will show the "visual studio like and feel" list for autocomplete.


The following key binding options are available for code completion. I do not believe there is any way to change the underlying engine to make finding appropriate completions easier, however one could write as many code snippets as desired to quickly reuse code.

Is there a way to have Xcode 5 autocomplete like Visual Studio?

Alternative

I prefix my code snippets with my own initials followed by my own logically phrased structures. This presents a pretty useful [faux] index that let's me short-circuit the auto completion routines.

e.g. Structure of a typical user snippet

[tnc][AddMethod][Somename]

When necessary I then start tnc... to gain access to my [faux] index of commonly used snippets.

Snippets are not autocompletion per se but they do provide an alternative index to autocomplete coding and could address the concern of finding relevant information quickly.


Now if you start typing auto-complete will pop up. There is nothing you need to do.
EDIT
Sorry about that. Misunderstood the question. The only way to select autocomplete is by typing a tab, enter, or right arrow key. There is no way to do this in normal XCode.


control+space is probably the only feature I've known. I agree xcode does not have any auto completion that I'm aware off.

But otherwise since visual studio keeps on getting updated most of the time. The auto completion on it works fine. At some point Xcode might add a feature like that on their future updates.


I don't know if this works with xCode 4 though, but its worth a try http://code.google.com/p/xcode-auto-assistant/


If you want to complete the same things every time you could use third party software like text expander for this or use Snow Leopards integrated textreplacement feature.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜