Scott, Sean, Philip et al,
Thanks very much for the responses. Though others may not like it, most of my team is very happy now that we've switched to the All-in-One layout, so thanks very much for explaining how to do that.
The key bindings thing is driving me nuts. My brain has been wired since the late '80s to type Ctrl-xs when I need to save code. I could do this with the old PB on OpenStep/NeXTstep, so I was hoping there would be a way in the new XCode. Oh well.
As for setting the Organization Name for file templates, I don't see that in my preferences. Maybe that's part of the next release of XCode.
There's one thing I forgot to ask. The old PB had a little find panel that would appear as an add on at the bottom of the window. It was a very nice way to quickly search on the current file only without having to bring up a separate find panel. Does XCode have anything like this? I had this bound to a Ctrl-s in PB, but I can't seem to find anything in the key bindings preferences panel that looks like it's the equivalent.
Regards, Paul
On Jul 6, 2009, at 11:07 PM, Scott Thompson wrote: On Jul 6, 2009, at 7:42 PM, Paul Summermatter wrote: 1) Key Bindings: I see that there is now a Preferences GUI for key bindings, but I cannot figure out how to bind multiple keys to the menu items. For example, I'm an emacs hacker, and I would like to bind Ctrl-XS to save and Ctrl-XU to undo. I see in the text key bindings that there are multi-key bindings like this (Ctrl-XX is one example), but I cannot figure out how to enter these values through the GUI. I looked at the .pbxkeys file that XCode created in ~/Library/Application Support/XCode/Key Bindings, and I tried to edit it by hand to have the following in the "menu" dict:
<key>^x</key> <dict> <key>u</key> <string>undo:</string> </dict>
but this did not work. When I launched XCode and opened the Key Bindings preference, the Undo menu command had no key bindings associated with it (Not even the Command-Z which I left alone). Should this work? Might I have just made a typo somewhere?
Menu key bindings on the Macintosh are typically single-key entities... there is no way, that I'm aware of, to create a two-phase key binding for a menu item. In contrast, XCode's text key bindings are not managed through the operating system's menu key binding mechanism so they are able to "break the rules" so to speak.
In the long run, for the fundamental key bindings you mentioned, you would be much better served by "going native" and just using the default key bindings as the same key bindings are used in every other application on the system. 2) File Templates: I've read on the web about how to do this, but I have to assume that there is a better way than jumping through the flaming hoops people have described. Every other modern IDE that I've used has very well integrated template creation, but I don't see anything in the Preferences panel, so maybe I really do have to dig around in the /Developer directory for the XCode file templates and edit them by hand and/or muck with system defaults from the command line to get things like my company name set properly. If someone could point me to the official Apple documentation on this topic, I would appreciate it.
To change your company name, in your project, select the project item (usually the top item in the project file listing... it has a blue XCode looking icon). Do "Get info" (Cmd-I) and look at the "general" tab for a text field labelled "Organization name".
To edit the file templates you will have to look in the /Developer directory, but you shouldn't change the templates there... Instead you should copy the templates of interest to the directory:
~/Library/Application Support/Developer/Shared/Xcode/File Templates Library/Application Support/Developer/Shared/Xcode/File Templates
see "Customizing XCode installation" at http://developer.apple.com/documentation/Xcode/Conceptual/XcodeCoexistence/Contents/Resources/en.lproj/Details/Details.html
Apple probably hasn't bothered to create a fancy IDE mechanism for editing these files relying on the fact that Xcode is a tool for developers who are usually quite adept at navigating the file system and editing code-level text files. File templates are something you generally set up once and rarely mess with again... I suspect that kind of specialized functionality is simply not worth the time and expense of an GUI (as opposed, for example, to spending that time and effort on enhancements to code optimization in the compiler stack) 3) Windows: It seems like too many components of this application are split out into separate windows: Main Project window, Compiler window, Debugger stack frames and vars window, Debugger console window, Doc window, etc. Within a few minutes of using the app, I have a panoply of windows scattered all over the place, and I get lost very quickly. Again, I would hark back to other IDEs (like IDEA and Eclipse), where windows can be broken out but are, by default, nicely organized in a single view with efficient use of tabs/collapsable regions that appear/disappear as needed. Is any of this possible with XCode?
To some extent yes, but mostly, no. The Macintosh never has followed the Windows and Java paradigm in which an application dedicates a huge window to the entire screen. In my experience, managing multiple windows is one of the features of the interface that people coming from those environments have trouble adjusting to.
At the same time, however, Xcode has evolved quite a bit in the past few years to integrate controls for things like debugging directly into the editor window. If you take the time to learn the way Xcode works you will likely find that you don't need to leave the current editor's window for most tasks.
As a long time Mac user, I have the opposite problem. I find the MDI frame nature of tools like Eclipse to be incredibly confining. All the sliding panels are disconcerting and they seem to be forever getting in the way of what I'm interested in focusing on. I usually work in the default layout and I really hate the "grouped" window option (in fact, I wish there was a way to ask XCode to NEVER bring up the embedded editor in the project window.
Still, coming from your background you may be more comfortable with the all-in-one layout: Close all project windows, Look in the XCode preferences in the "General" tab and choose "All-in-one" under the layout. This will give you an MDI-like view with a single editor window that is probably closest to the Project Builder experience you may have had.
4) Code Analysis: XCode, like PB, does not seem to do any real time code analysis at all. My experience developing in IDEA for the last 7 years has made me appreciate the extremely beneficial aspects of live code analysis. Highlighting syntax errors is just the start of this, but I would be happy to have just that. Is it possible to turn on Code Analysis in XCode or are there custom add ons that will do this?
What sort of code analysis would you like to do? I would google "Clang Static Analyzer XCode" for publicly available information on some static analysis with XCode. Improvements along those lines were announced at WWDC, but they may not be discussed here (at least not by me) as the content of WWDC sessions is under NDA. 5) Unit Test stats: When I run unit tests, all I seem to be able to get for output is text in the build window. Is there nothing like the JUnit integration in IDEA and Eclipse where you see, in graphical form, the tests that were run along with which were successful and which failed? I would be happy just to have a count of the total number of tests run/passed, but I cannot seem to even find that. Have any custom bundles been written to parse the output from the build (which seems to include everything that's needed) and display the information graphically?
The default workflow tools do not have a graphical display, my solution has been to bypass the built in mechanism for running unit tests at build time and instead I simply use the unit test framework and integrate the unit tests into my application where I've created a panel that collects the results and offers a much nicer display.
XCode's unit testing is a relatively new feature and support is evolving rapidly... but again, I suspect that it's evolution is prioritized somewhat behind features like first class support for iPhone development and improvements to the compilers.
6) Code Coverage: Are there any options for doing code coverage? I manage a reasonably large team of developers (and consultant developers), and it's a crucial part of our code reviews to first look at the code coverage output to ensure that all critical sections of code are properly covered by unit tests. I see that there is this very cool looking app called Instruments, but I haven't found how/if I can gather code coverage information from the app like I can with a tool such as Emma. Basically, if I have code with, for example, an if/else, and I write unit tests, I want to make sure the tests cover all scenarios of both branches of the if/else.
The code coverage tool best supported by xcode is gcov for instructions on creating a coverage build see (for example):
I cannot seem to figure out how to tab through parameters when a method is the target of a completion
The default key binding assigned to this in XCode 3.1 is the rather ungainly Ctrl-/. Relief for this is coming in a future release of XCode.
|