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
Related
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.
I'm learning both Java and C# right now. I started with Java first, back in august. The class I'm using uses BlueJ as a compiler. BlueJ has this cool color coding, where it's not just key words or such, the background changes based on what exactly you're typing in.
(Because I'm terrible at explaining things, it looks like this: http://imgur.com/HvhJUgY)
It's made it so easy on my eyes. Now that I've started coding in C#, my eyes can't seem to adjust back to not having the colors. I find myself getting lost in where an if statement begins and ends, and end up having to put ridiculous amounts of space and comments between code to help me follow it better. Does Visual studio have any options to do this, or do I just have to suck it up and learn to adjust?
The colour coding is in the Fonts and Colors options. To get there select Tools/Options. In the dialog, select Environment/Fonts and Colors. For the code, you can set the options in the text editor but you can do it for all the other windows in visual studio too.
Solution:
You can download an extension. In Visual studio code, click on the button that has four squares on the right hand side of the VS code's window. Then, in the search bar, search for "Bracket Pair Colorizer 2." This extension should aid your vision when looking at code. Here's an example
picture. Also, this extension is customizable, letting you add any color you'd like to resemble different types of lines of code.
Settings
To customize your extension, under the extension name you will find a settings dial, similar in shape to the windows settings logo. Click on that, and then click on "Extension settings". From there, you have access to many useful settings.
If this solution has solved or helped you, please mark it as an answer and upvote it. Thanks!
As seen on the screenshot below, marked by red arrows:
If I use Vertical Tab Split subwindow, I lose the ability to split insert another tab and split it horizontally. Is there any addon or setting I can change to be able to put my code tabs in sort of rectangle-grid?
Just to clarify - I don't want to see the same file contents twice. I want every tab to show a different file. I can't find the reason why such an oversimplification to ide was introduced.
I know it can be solved by opening many standalone windows, but that's hardly an answer for me.
Here's the example of how it looks like in Sublime 2
As you have discovered it's not a feature of the VS shell. For reference, it wasn't possible in VS2010 either.
You can vote for this feature on the Visual Studio Developer Community site - there's a specific request for it here
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.
I coded a Mancala game in Java for a college class this past spring, and I used the Eclipse IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatically highlight all other references to that token on your screen. Notepad++, my preferred Notepad replacement, also does this.
Another neat and similar feature in Eclipse was the vertical "error bar" to the right of your code (not sure what to call it). It display little red boxes for all of the syntax errors in your document, yellow boxes for warnings like "variable declared but not used", and if you select a word, boxes appear in the bar for each occurrence of the word in the document.
A screenshot of these features in action:
After a half hour of searching, I've determined that Visual Studio cannot do this on its own, so my question is: does anyone know of any add-ins for 2005 or 2008 that can provide either one of the aforementioned features?
Being able to highlight the current line your cursor is on would be nice too. I believe the add-in ReSharper can do this, but I'd prefer to use a free add-in rather than purchase one.
There is a RockScroll alternative called MetalScroll which is essentially the same thing with a few tweaks and improvements.
Also there is a small and simple WordLight plug-in that only highlights the identical tokens.
Both are open source and support code folding which is nice.
Imho, the bar next to the scroll bar in Eclipse is a lot more elegant solution than the scroll bar replacement of RockScroll/MetalScroll. Unfortunately I couldn't find any VS plug-ins that do it the Eclipse way, so I just stick with WordLight.
Check following addins
Productivity Power Tools- Displays error in scrollbar and
Highlight selected word
In a different question on SO (link), someone mentioned the VS 2005 / VS 2008 add-in "RockScroll". It seems to provide the "error bar" feature I was inquiring about in my question above.
RockScroll
EDIT: RockScroll also does the identical token highlighting that I was looking for! Great!
Old question but... Visual Studio 2010 has this feature built-in, at last.
The highlight functionality is conveniently implemented in VisualAssist.
In my opinion, they are both must-have.
1) Highlight identifier under editing caret:
Options -> Advanced -> Refactoring -> Automatically highlight references to symbol under cursor
2) Highlight search result - in all windows. Works for RegExps!
Options -> Advanced -> Display -> Highlight find results
About RockScroll: It doesn't highlight the identifiers. It only highlights the same string in the source code! If there are similar identifier declared : ex. _test and test, and test is highlighted it will highlight the string "test" in variable _test too! And it will also highlight the same string in a method called "sometesting()". So it isn't exactly like eclipse and doesn't work for me.
The automatic highlight is implemented in Visual Assist as the refactoring command "Find References". It highlights all occurences of a given variable or method, but that's not automatic (binded to a keyboard shortcut on my computer).
Here is an exmaple:
DevExpress CodeRush does this when you press TAB when the cursor is in an identifier, you can then tab through all the highlighted instances. There's also a DXCore plugin (the foundation upon which CodeRush/Refactor Pro are built) that does current-line highlighting.
In VS 2017, this can be solved by installing the Match Margin plugin.
It appears to be part of the Productivity Power Tools (which might be worth looking at for other features), but surprisingly, installing PPT didn't solve the problem for me, I had to install Match Margin separately.
The "error bar" functionality is provided in JetBrains ReSharper. I'm not sure if it does highlighting of references to the currently selected identifier.
For selected word(s) highlight function only, there is also StickyHighlight.
StickyHighlight supports Visual Studio 2010 & 2012.