Xcode 4 : Opening brace on the same line - xcode4

I just installed Xcode 4 and the opening brace of the auto generated functions is on a new line.
For example :
- (void)dealloc
{
[_window release];
[super dealloc];
}
I'd like to have the opening brace on the same line like it was in Xcode 3 :
- (void)dealloc {
[_window release];
[super dealloc];
}
Can someone help me ?
Thanks.

MarkC's answer has the right idea, but <Jedi> these aren't the templates you're looking for </Jedi>.
The templates you need to edit are in either
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates
or
/Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Templates
depending on which platform you're targeting.

Don't edit those templates directly! Apple usually automatically deletes them when you upgrade to next version of Xcode...
Instead, you want to copy/paste them into:
~/Library/Developer/Xcode/
e.g.:
~/Library/Developer/Xcode/File Templates/
~/Library/Developer/Xcode/Project Templates/
...and then edit them there. Xcode knows it should look there for your custom versions, and Apple will leave the contents of your home directory alone.

All the template code that XCode 4 uses to create new class files is in
/Developer/Library/Xcode/Templates/File\ Templates/Cocoa/Objective-C\ class.xctemplate
Just edit those templates to suit your coding style and you are good to go.

You could try using an application called Snippet Edit that allows you to easily edit all of the supplied code snippets. You will need to be using Xcode v4.3 or later though if you wish to use it.
The application can be found at http://cocoaholic.com/snippet_edit/

Related

VSCode not commenting css.liquid lines correctly

I've been having a problem when trying to comment out a line in a css.liquid file with the VScode shortcut (CTRL+/).
Whenever I do this it puts {%\s*# in front of the line and doesn't comment out the code. I tried disabling all extensions but it's not helping. I haven't touched any settings. When I switch to CSS or Liquid it will comment out fine, but Liquid CSS doesn't work.
Does anybody recognize this issue?
===== This ended up being a problem with the extension itself, it has since been fixed!
I see this issue has been reported lately: Incorrect comment blocks in Liquid files with this extension enabled.
I see this in the liquid css language configuration file:
"comments": {
"lineComment": "{%\\s*#",
"blockComment": [ "/*", "*/" ]
I don't know what the lineComment value is supposed to be but I have never seen a regex value there in other language configuration files - so it may be a mistake.
I built an extension which may be able to help until the language configuration file is fixed: Custom Language Properties.
Install it.
Run the command Custom Language Properies: Check for new language extensions.
Make this setting in your settings.json:
"custom-language-properties": {
"liquid-css.comments.lineComment": "",
}
If this doesn't work immediately, try a reload of vscode.
This basically sets the lineComment's to null and so the blockComment will be used instead. I am not familiar with Liquid comment styles so let me know if that is not how line comments are supposed to work. Demo:

Could not navigate to "view"

I am using vaadin 10. I would see this error on my login view class if I used #Route("") but when I write it as #Route(value="") it worked. But doing that to another view I get this error. Most questions asked are way too advanced. I just have a simple project with vaadin and springboot.
With the source code you provided as link in the question's comments, I cannot reproduce your issue. However, there were 2 problems with your code before I was able to run the application:
the #Theme annotation needs to be placed on a view or router layout; I moved it to your LoginView
the Valo theme is not available in Vaadin 10, so the reference on ValoTheme class was a compile error; I removed it
After fixing these problems everything ran fine, #Route(value="") and #Route("") were both working. Which Java version are you using? Java 8 is required minium for Vaadin 10. Also please try to remove lombok for testing, maybe it is causing a problem.
Try annotating your EmployeeDisplay class with #Route(value = "employeeDisplay") instead of #Route(value = "/employeeDisplay"). In other words, remove the /.

IntelliJ CSS autocomplete / Emmet?

I'm having some issues with IntelliJ 13 and autocompletion when editing CSS. Normally to set margin: I used to type: mar Tab.
Now, with the new version, I get max-resolution instead:
I had originally assumed it was due to the new Emmet functionality, but I've already switched it off and the issue still occurs:
Anybody experiencing anything similar?
There was a preselection bug which has been fixed in IDEA 13.1, please try its RC from http://confluence.jetbrains.com/display/IDEADEV/IDEA+13.1+EAP. There, the live template must be preselected if its exact key is entered in the editor.
If you don't want to see these live templates at all, you can go to Settings | Live Templates and disable the whole Zen CSS group.
Type: m Tab instead, you may find the results to your liking.
In my case helps me something opposite.
I checked the Live Templates > Zen CSS and after this, I can use snippets like bdrs(border-radius) etc from Emmet.

How to create commands shortcut on Aptana 3?

Well, Hi everyone, I'm new here. And I have this doubt about how to create a command shortcut in Aptana like works in textmate. I work with CodeIgniter framework and I saw a video on youtube about the CI, the programmer was using textmate and he create some shortcuts like this: when he wants to create this line of code "$this->load->view('[cursor]'); he just wrote "ciloadview" then the line appears. Is it possible to create shortcuts like that on Aptana 3??
In Studio 3, you can add custom snippet through rubles. You would first need to create your own ruble, and add your custom snippet accordingly. Instructions to create a ruble can be found here: http://wiki.appcelerator.org/display/tis/Creating+a+new+Ruble
And creating a new snippet can be found here: http://wiki.appcelerator.org/display/tis/Creating+a+new+snippet
In your scenario, I would use "ciloadview" as the trigger and "$this->load->view('[cursor]');" would be the expansion.

How to bookmark code in XCode 4?

I couldn't find a way to put a bookmark inside the code in XCode 4. I know about the #pragma mark thing but it's not what I'm looking for. What I need is something that I can put and remove with a mouse click and navigate amongst with next and previous, like in VS.
Is there anything that I'm missing?
Bookmarks seem to have gone the way of the dinosaur in Xcode 4. This wouldn't have been so bad had the jump-to-bookmark popup above the editor in previous versions not also disappeared. The best replacement currently seems to be to use breakpoints (disabled individually, of course) and navigate with the Breakpoint Navigator.
Shortcut to breakpoints is Cmd + 8. Once there use arrow keys
File a bug report at http://bugreporter.apple.com if you feel something like this should be brought back.
Write below comment in your source file that you want bookmarked.
//<##>
And you can navigate to next / previous with: '^/' or '^?'
<##> means "placeholder of code snippet"
^/ means "jump to next placeholder"
^? means "jump to previous placeholder"
thanks
Another option, if anyone is still interested. The following directives will both produce a compiler warning that you can use as a bookmark:
#pragma message "<# message #>"
or
#warning <# message #>
If you want to place bookmarks using your mouse: create a code snippet with one of the 2 directives above. Drag & drop it to the line in your source file that you want bookmarked.
Navigate to next/previous with: Cmd-' and Cmd-Shift-'
In Xcode 4.4, if you leave a comment with this format:
// TODO: Your text here
it will be added as a listing in the jump bar alongside the list of methods in your current file, and then you can jump straight to that comment from that menu.
The simplest technique is to use a comment prepended by // TODO and then search, which allows you to jump through the issues from the navigator. Pretty hard to beat that technique.
I personally don't like using break points for bookmarks because it is not easy to enter notes. I use breakpoints as breakpoints, and prefer not to mix them up with bookmarks.
Anyhow, if you want to get a bit fancier you could get xcode to generate warnings // TODO: some message or // FIXME: some message that can be navigated in the issue navigator. I took the instructions below from this site:
Instructions
Head over to your project's item in the Project Navigator (usually at the very top)
Find your target in the list of targets on the left, select it
Head over to the "Build Phases" tab.
Click the "Add Build Phase" in the bottom right of this screen.
In the editor that appears insert the bash script shown below.
Now just build and you'll see all your //TODO: and //FIXME: comments have become warnings. I love this technique, it might not be right for everyone, but hope it helps someone.
Bash Script For "Run Script" Build Phase
KEYWORDS="TODO:|FIXME:|\?\?\?:|!!!:"
find "${SRCROOT}" ( -name ".h" -or -name ".m" ) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
You'll also be able to click on each of the warnings in the issue navigator to go right to the file and point in your code where you left the original //TODO: or //FIXME:
Extra pro tip: Make sure you're using phrases to describe your //TODO: comments like //TODO: Handle this error gracefully, and things like that. The phrases will show up in the issues list beside each warning.
Credit for the little tidbit should go to "Tim" on the Cocos2D forums, (found after Googling for a bit), I believe his solution originally was intended for Xcode 3 and didn't work if you had spaces in your path name, my script here doesn't have those restrictions, still he should get full credit here's his original post.
Like npellow's answer to this question of mine, appCode by JetBrains has also made this possible. So, this may be another reason to use appCode instead of Xcode4, except that it won't be free later in time.
My method:
type in grammar error code in the previous line.....
After changing something in other place, I can go back to the previous place because the grammer error line will show a red line in the right side scroll bar. It indicate the place.
It is not elegant but unless there is a bookmark feature, this is the way i am using at the moment
You can install an Xcode plugin called "XBookmark".
This plugin provide features below :
Toggle Bookmark
Show Bookmarks
Next Bookmark
Previous Bookmark
How to install XBookmark:
Install Alcatraz.
Search XBookmark from Window->Package Manager and click Install.
Restart Xcode.
Now, you can see menus about bookmarks in the Edit Menu.
PS : This plugin is open source.

Resources