xcode 3.2 c++: how can i enable a proper code completion? - xcode

I have snow leopard and I'm building a cpp Application with xcode.
I would like to be able to get proper code completion with xcode, and by that i mean the following:
std::string f;
f.
just when I type f. i would like to see all the relevant functions to that string class. is it possible in xcode ?

You just need to press the ESC key to get the code completion menu to show.

It may seem counterintuitive but press the ESC key after the period.

If you want the completion menu to display automatically, you can also set that in your preferences:
Code Sense -> Code Completion -> Automatically Suggest

Related

Xcode 8 auto-generated quick help documentation

Among the new features announced in Xcode 8, we can see
"Auto-generate Quick Help documentation" :
Is this the end of manual code documentation like we can learn on this article from NSHipster ?
Can someone outline the pros and cons of this new feature ? Does it replace tools like Jazzy ?
I couldn't find more information about the new feature.
This refers to Xcode 8 (and later) feature, where you can select a method like this:
func foo(bar: Int) -> String { ... }
... and then press ⌘+option+/ (or choose “Structure” » “Add documentation” from Xcode's “Editor” menu) and it will generate the following comments template for you:
/// <#Description#>
///
/// - parameter bar: <#bar description#>
///
/// - returns: <#return value description#>
It just facilitates the writing of documentation for Quick Help.
Note, while this behavior has changed a bit over time, Xcode can be particular about where the cursor must be when you attempt to do this. For example, the cursor has to be somewhere in the function name, foo in my above example, for this to work. Or just double click on the function name and then press ⌘+option+/
You asked whether this feature replaces tools like Jazzy.
No, it doesn’t replace Jazzy or similar tools. Amongst other things, Jazzy creates stand-alone HTML documentation from this inline documentation. So, it is simply a question of whether you need these stand-alone outputs from Jazzy for any reason. If so, use Jazzy (or similar tool) in conjunction with this integrated documentation. If not (i.e., you are only looking for documentation from within the Xcode IDE), then Jazzy is not needed.
This is most likely related to the fact that ALL hotkeys with a '/' don't work in the current XCode 8 build, if your keyboard requires to press shift to get it.
I.e. on the german keyboard the '/' is shift+7, pressing alt+cmd+shift-7 doesn't do a thing. If you assign i.e. cmd+shift+opt+d, it works just fine.
The shortcut '///', which unfortunately also doesn't work right now, is probably due to the old XCode plugin VVDocumenter, which used exactly this shortcut.
Great feature, lousy QA on the Apple side.

XCode lldb autocomplete

I have searched everywhere but can't seem to get answer. I am using Xcode 6.1.1.
I recall (possibly incorrectly) autocomplete being available in the lldb debug pane of XCode. I am currently typing fully all variables and functions; there must be a better way. Is autocomplete/intellisense available in Xcode?
Many Thanks.
The autocomplete available today in Xcode debugger console is for lldb commands. You can type fr<TAB> v<TAB> instead of frame variable. The autocomplete in lldb often can complete function names, for instance br s -n MyClass::MyMeth<TAB>. Or for a source file, br s -f myfil<TAB> -l 15. But once you're entering an expression (expr, or p, or po), the code completion you're used to seeing in the text editor panes is not available.

Swift code completion isn't working

I installed Xcode 6.0 beta and downloaded the iOS8 library Documentation.
but when i create a Swift project, try to typing code
func aa(){
let format = NSDateFormatter()
var pageData = format.
}
I find Xcode can't dot any property and function. Am I missing any step?
The problem is sloved, typing a whitespace can aid code completion
It's append when you change the hardware type and you choose less than iphone5.
Choose Iphone 6 for example in the list at the right of the stop button and the code completion for 'format' will appear.
I met the same problem and solve it by removing the non-ASCII char in comment (in my problem, it's a chinese char "年" automatically generated in comment by xcode).
btw. "typing a whitespace can aid code completion" doesn't work for me
It’s a bug, your code works on my system (OS X 10.9). Note that when typing code, I sometimes see the code completion crash for two seconds and come back.
When trying a first project named "swift", code completion crashed in a infinite loop… beta bugs… I just had to name it something else to test the language.
You know, I've experienced something similar with Objective C projects in Xcode 6 Beta 1. It seems Apple have changed the default behaviour a bit:
In Xcode 5.x code would always automatically complete as you type, but in this early beta try pressing ESCAPE - that will bring up the list you're looking for. Works for me. Some code auto completes as you type (both in Swift and Objective C), but at times only ESCAPE will bring up what we're looking for.
I'm nor sure if this is expected behaviour or a bug (I'm guessing the latter).
I must admit that your code works fine on my system without this trick. Just make sure you have code completion setup under Xcode - Preferences - Text Editing:

How do you stop the XCode debugger from autocompleting without options?

The debugger is really (de)bugging me. Every time I try to type a po ... command, it autocompletes (without giving me any options) and I end up typing stuff like po [selfelf and so on until I go mad. Is there any way of stopping this, or of always giving me the autocomplete popup like in the standard editor?
This answer applied to the GDB debugger which is no longer the standard debugger used with Xcode
This is achieved by adding the following line to the "readline init file" (which, by default, I think does not exist). I created the file ~/.inputrc and put the following text in it:
set disable-completions 'On'
Hmm, the accepted answer is kind of overkill.
How about the answer provided to this question:
The closest I've come to solving this incredibly annoying problem is
to turn off automatic code completion in general (Preferences > Text
Editing > Suggest Completions While Typing) and then hit esc whenever
I actually do want code completion.

How to show the Logged Messages window in Xcode

I'm a very new Cocoa user and running into all sorts of problems...
I'm trying to get the content of an Array and found this code to do this.
NSLog(#"array : %#",collection);
The problem is, I'm not getting any console or tracer window that shows this 'echo'
Is there another command I should use, i've tried opening all windows but I don't see the message that should show. I know the function that this call is in is executed, so the reference is right.
Thanks and sorry for these beginner questions... Using stackoverflow is way faster than reading through all the documentation apple has regarding the subject.
Update for 2023 : It's Command + Shift + C
Old answer : It's shift + cmd + R. Or go to View -> Debug Area -> Activate Console
From the 'Run' menu, choose 'Console' - keyboard shortcut is Shift-Cmd-R.
When Xcode runs your project, the editor changes to show a little black button with the letters "GDB" in it. Click on that to see the Debugger which has the console in it.
Good luck!
Oh, and I would read Apple's documentation. It's not that bad.
In Xcode 12, go to View > Debug Area > Activate Console
In the Xcode menu hit Run - Console. This is where NSLog / print / printf etc statements output.
The key command is Command + Shift + R.
The cocoa toString() method is called description as well.
NSLog(#"array : %#",collection);
Will execute
NSLog(#"array : %#",[collection description]);
Which will then call description on each of the collections elements.
If you want to see it every time you run your application select the "Debugging" tab from the preferences window and change the box that says "On Start" to "Show Console".
Additionally i like to check the "Auto Clear Debug Console" checkbox which will clear out the text of the output on starting your application.

Resources