How to keep indentation uniform in xcode and eclipse - xcode

In our project there are two teams and are using different IDE for development (MyEclipse and Xcode). Is there any way to keep indentation similar in both the IDE, because when we are doing diff it's showing lots of changes only because of indentation.

If they are using the same code base, there should be no differences. If you are comparing copies of the same code base, maybe there are XCode settings that modify tabs when saving code. If you are using Windows with MyEclipse and OS X with XCode, maybe line endings get switched on save. There should be preferences for that, too. There are also preferences for formatting code on save, or you may have plug-ins for cleaning up code. Lastly, there is a preference for using spaces or tabs to indent code.
There are preferences for how code is displayed, such as how many spaces to use for tabs, but this doesn't affect the actual files. So, again, if the same code base is used then there should be no differences. Perhaps you could expand on what you are comparing with what, if this answer doesn't help.

Related

How to prevent RubyMine editor from modifying files

I'm working with RubyMine 2017.1.3 on Linux and it appears that RubyMine has modified one of my files to better fit its own idea of formatting. That causes distracting changes in the files since I have to inspect the differences (as detected by Git) and see if they are changes that I meant to make or what.
Is there a way to prevent RubyMine from automatically modifying a file? I searched through the settings but I wasn't able to find anything.
Go into Preferences -> Editor -> Code Style -> Ruby and change the settings to match your existing code (e.g. line spacing, tab width, etc).
Make sure to pick the correct boxes when commiting changes.

Why would Xcode stop drawing tabs when indent level is greater than three?

For some reason Xcode 4.5 and 4.4.1 have both stopped displaying indented text at the proper level if there are more than three Tab characters of leading whitespace on the lines.
Easier to show than describe:
There are five leading tabs on the line the arrow is pointing to, but Xcode is drawing it as if there were only three. Using the left and right arrow keys confirms the Tabs are there.
I have deleted the derived data associated with my projects, deleted the project.xcworkspace file and xcuserdata directories within the project package, mucked around with various combinations of Indentation settings in Xcode's Preferences, all to no avail.
Newly created projects exhibit the same behavior. Changing the Source Editor font preferences have no effect either. This is in OS X 10.8.1.
Help -- my brain can't understand the code when it doesn't "look right"! What else can I try?
So, I filed a Radar, then heard back from a friend of mine who was having the same problem. Are you using the new SourceCode Pro font from Adobe? Your screenshot makes it look like you might be. Try switching back to a different theme and restarting Xcode? That's what I did, and it seems to be fine.
Eventually I removed (after quitting Xcode) the entire UserData folder in ~/Library/Developer/Xcode and that seems to have fixed the problem.
Hopefully it won't take more than another half hour to restore all the key equivalents and syntax coloring that I am accustomed to.
Leaving the question 'alive' in case it happens to someone else.

Show Indent Guide Lines In Xcode

Coming from a background using Visual Studio and Notepad++ I'm used to the indent guides which help to visually enhance sections of code where the curly braces are used,
Xcode (No indent guides)
Visual Studio (Nice tidy indent guides)
As you can see from the images above sometimes there are sections of code where multiple levels of curly braces are open and it gets messy without any indent guides.
Are there any options or plugins that will allow xcode to display the indent guides in between sections of code? Like the VS2010 sample?
In Xcode 10, if you press Command and hover over the structure it will show what is desired. It is not permanent but it helps.
Xcode doesn't have this feature (not that I'm aware of) , but it has a (kinda) similar one. If you look closely in a method with a few loops or if structures, each structure gets a black tint on the left side of the editing area (right next to the line numbers).
You can collapse or expand the functions as needed.
I've been searching the same but the most similar solution on Xcode 11 is shows invisibles

Is it possible to prevent Xcode from listing build errors in a separate window?

I don't like the way Xcode displays compile errors and highlights source code in a separate floating Build Results window. It's easy to end up with 3 text editors on screen, all showing the same source code! I just want it to jump to my error in the main text editor like Visual Studio would. Is there a way around this, or is it any different in Xcode 4?
Yes, select the "All in one" layout in XCode General Preferences.
Yes, Xcode 4 is all one window, and builds constantly so errors appear almost immediately. I think you'll like it much better, especially if you're accustomed to Visual Studio (it's not the same as VS, mind you, but more similar than Xcode 3).
No way mate, I was a .net developer before I switched to mac. It's very hard to get use to Xcode and Objective C, it's not as intuitive as Visual Studio , or C sharp.
However the latest version of Xcode brings some improvements , so it doesn't show you the compiler errors in a separate window. It shows you the errors in the left side and the code in the editor. you should upgrade it's a bit more intuitive.

Why does Visual Studio use different indentation settings for C# and for C++?

For C# Visual Studio uses 4 spaces by default, whereas for C++ it is hard-tabs. Why is it so? Why is it different?
My project consists of both C# and C++ code and the difference really annoys me. I want to set a common standard for all the sources, but I wonder if this would have any drawbacks.
If you're looking for a completely logical, well reasoned justification for this difference I don't think you'll find one. Despite the many flame wars around tabs vs spaces there really isn't a real winner (otherwise the war would be over).
The way to get around this is via a .vssettings file. When I first started with VS 2005, I set the tabs/spaces default in each language. You can do this via Tools -> Options -> Text Editor -> (C#/C++). Then I export the tab settings into a .vsssettings file. Whenever I install VS on a new machine I just import that file and I have my happy space/tab settings.
PS: spaces rule :)
Of course tabs is the only right way. Tab can do everything spaces can do. Spaces cannot do much of what tab can do.
Tabs allow easy change of indentation and easy navigation without having to press arrow keys too many times, and would having to hold control.
The real solution is to have the editor be able to navigate and tab indented file as if it was space indented, if the user prefers so. The file would be saved with tabs. Very simple and accommodating everybody.
The problem in c# 2010 is that I cannot find any option to change it to tabs.
I doubt there are any drawbacks as C++ grammar doesn't distinguish between tabs and spaces.
By the way, I think the best way to set code style standards is to export VS settings and share it with the team.
The reason behind C#'s default 4 spaces is that whoever will open the file the indentation will be the same.
You are free to change it as you like in preferences.
Just go with whatever you prefer, I normally use tabs in C++. Those who view my code all use the default VS settings RE tabs anyway so there is no real pull to replace that with spaces. I'm not sure what its like now but when F# was in its infancy (i.e., pretty early release out of MSR) you needed to use spaces in #light code otherwise the compiler would complain as whitespace was important.
Different people have different preferences, I know some who religiously use spaces, on the other hand I know more that uses tabs.
For C# Visual Studio uses 4 spaces by default, whereas for C++ it is hard-tabs. Why is it so?
Why not?
Just change it if you're not happy.
Spaces make it more difficult to navigate through code with the keyboard.
With spaces, most people will use four spaces, but some will use two or three. With tabs, the people who want their code tabbed out with two spaces can simply set the tab character to display as wide as two spaces, and the coding style remains consistent.
If you're using spaces for tabs in any HTML, CSS, or JavaScript, you're doing it wrong. There's no tabs-vs-spaces debate for html/css/js - it's either tabs, or ignorance. Client-side code is not compiled, and IIS doesn't have compression turned on by default - excess white space = excess fat.
Way back when, VB6 didn't give us the choice to use tabs, but now we can and should - if you don't, your code makes it look like you're still clinging to old-school ways.
So stop coding like it's 1999. Use tabs. Do it for the children.
The tabs vs spaces argument has a simple answer: tabs. Tabs allow you to specify your indentation while not forcing others to live with it. Given that tab sizes are merely a personal preference, one user shouldn't be able to force others to follow his/her display options.
Why the difference between C++ and C#: no clue. However, knowing that tabs are logically a better option, just change the C# (and in fact, all languages) to tabs and voila.

Resources