I wanted to add some auto-indenting to Notepad++ to my Javascript code. That semi-worked: it now indents the previous line's amount, but doesn't indent any extra for new scopes. Now though, my indent guides are all wrong: every extra character creates an indent guide on the lines below it, instead of indent guides only for extra scope. It's like this in all file types, not just Javascript. Help!
Note: I was on 5.9.x, now on 6.5.2. Doesn't do anything. System Restore didn't do anything either.
Here is a screenshot that shows the problem:
Please try checking this answer.
This is not addressing indentation, but structural highlighting, what is superset of indentation in many cases.
I'm sorry this is for visual studio, but most answers I could find lead there. Basic version of VisualStudio should be for free download. Optionally you can search Google for "javascript indent guides" to find some other editor.
Related
In all the text editors I use, if you make your comments have a background color, there'll be no gaps between the coloring of each line. So a 3 line comment is one big block of that background color and is simple and clean. But in VS, they put a blank line or two between each commented line and thus it looks horrendous and clutters the screen. Any ideas how to fix this? Thanks so much!
what visualStudio does vs other coding apps:
I don't believe this is currently possible.
It's a reasonable feature request however. I would suggest filing it via the "Suggest a Feature" action directly in Visual Studio. Be sure to include your screenshot.
Using Visual Studio 2019, I found a really useful refactoring option in 'Quick actions and refactoring':
(might come from PowerTools, whatever)
I just wondered how:
I can make this wrapping settings a default formatting settings
Or apply this formatting on my whole solution at once (without resharper)
For the later, a solution with Visual Studio Code would be perfect as well !
Thanks for your help
You can try using Rewrap extension which formats code, comments, and other text to a given line length (80 by default).
The main Rewrap command is: Rewrap Code / Comment, by default bound to
Alt+Q. Put the text cursor inside a comment line, block or plain text
paragraph and invoke the command to wrap. You can also select just a few lines, or multiple comments in one selection.
There is currently an Open request for this in the VS Code Issue tracker on GitHub
Using Textmate, I have somehow managed to turn off syntax highlighting for php files. After much trial and error, I have worked out that this happened when I accidentally hit SHIFT-CTRL-OPTION-D (I'm on a Mac, btw). I've looked everywhere and tried many key combinations, but I cannot figure out how to re-enable the nice syntax highlighting. Please help me, Textmate gurus, you're my only hope!
The key sequence SHIFT-CTRL-OPTION-D corresponds to an option in the language menu down at the bottom left of the Textmate window. The language menu tells Textmate what language to consider the file so it can determine the proper syntax highlighting. The key sequence I hit caused Textmate to highlight my text as though it were a diff window. Switched it back to PHP and it works great now.
I don't have enough rep to add a comment, so I'll expand on the accepted answer here.
SHIFT+CONTROL+OPTION+<LETTER> will display a menu showing all grammars beginning with <LETTER>. So if you want PHP back, just hit SHIFT+CONTRL+OPTION+P, and then a list of languages beginning with 'P' will pop up. You can choose one from the list by pressing the corresponding number (on my computer, it's 2).
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
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.