I have some old source code which uses tabs as white space (\t), and some newer code after we changed our source code convention which uses 4 spaces instead. Those two look the same on Windows just fine, but on Linux in Vim a tab is 8 spaces, so new code with 4 spaces and old code with 8 spaces looks all funky.
I tried to untabify the source files, and check them in, but the TFS update just completely ignores those, and I get nothing changed when checking in. How can I check in the change from Tab to 4 spaces?
This may due to your Visual Studio side setting and thus the changes could not be display.
For the mixed tabs and spaces , try to change your visual studio text editor setting. You can decide if you want visual studio to insert spaces or tabs here:
Tools/Options/ -> Text Editor/All Languages/Tabs, select the "Keep Tabs" option.
After setting this, the tab will changed as → instead of -like space.
Related
This is an IDE tools question.
I want to adhere to a specific style guide which wants me to have my code lines wrap to the next line if they exceed 80 characters on one line. When I select the word wrap option in Visual Studio 2013 text editor, it wraps the current window width of my project. How can I explicitly change my code editor window to be 80 characters in width without having to eyeball it?
Try this VS extension to add a visual guideline at the desired number of chars, then you can break your lines as needed when you approach the line. I'm reinstalling my laptop at the second so can't check, but I assume that the Visual Studio line-wrap option is only visually wrapping the text on your screen rather than actually breaking the line onto a subsequent line when it's over 80 (or width of screen in your case), which isn't really what the style guide you're following will be trying to get you to do.
If you had ReSharper installed, there is an option in that which allows the breaking of lines automatically at a given width.
My Visual Studio extension, is arranging Tab Sizes using ITextParagraphPropertiesFactoryService interface. That class is doing a great job, and helps me to set tab widths for all existing lines, but I have a problem to set tab sizes for new virtual line.
In other words, Visual Studio is setting caret position in VirtualSnapshotPoint, and converting it to real tabs only when user enters some symbols.
Now, Is it possible to force Visual Studio to create real tabs instead of virtual spaces? I try to create edit on view, and insert real '\t' symbols, but VS still converts it back to virtual... This happen for both, block and smart indent tab settings
So the behavior of blank lines being virtual space only is by design, and as best I know not changeable. If there's a specific problem with it, please update the question and we can go from there.
In Aptana 2 there was this tidy thing or something like that that you could setup to remove empty whitespace from the ends of lines after saving. You could set it to preserve empty lines and so on. Can this be done in Aptana 3 because I'm not seeing that ability and if it is there I can't find it.
Check out AnyEdit for Eclipse at http://andrei.gmxhome.de/anyedit/
It does what you are looking for and adds some nice conversion tools for characters and spaces.
I use it for web stuff (with Aptana), Android and App Engine. Works great with all of them.
When installing from the URL on that site, just select your Eclipse version and pick AnyEditTools.
There is a JIRA ticket currently filed against it: http://jira.appcelerator.org/browse/APSTUD-814. You could watch the ticket for progress or add your voice there.
Turns out this was implemented in Aptana Studio 3 in 2012, go to Preferences -> Aptana Studio -> Editors
and in there enable Remove trailing whitespace characters. Then when you save a file you should see the whitespace disappear.
As I am copying something from within a method, and pasting it into a word document, the code I am copying is already indented. When I paste it I therefore end up with a load of white space next to each line.
I need to copy without this. In C# I can just unindent my code, hit copy, and then indent it back again using the buttons in the IDE. But Visual Basic automatically forces indentation so any attempts to change it don't work.
Visual Studio supports block selection. Press the alt key and drag the cursor to start block selection.
Visual Studio Select Block Text
This is a very useful feature, specially when pasting code here on SO. Visual Studio 2010 will even support multi-line editing using the box selection.
Unfortunately, it seems VB doesn't support the Edit.Advanced.Tabify/Untabify or Increase / Decrease Indent commands.
Here is what you can do:
Go to Tools -> Options -> Text Editor and uncheck "pretty listing (reformatting) of code"
Select the text block you wish to copy without indentation
Go to Edit -> Advanced and click "Delete Horizontal White Space" (or: Ctrl K, Ctrl )
Copy and paste your code in Word.
Turn the "pretty listing" option back on.
the "Delete Horizontal White Space" command will unindent the entire selected text so that there is no tab/whitespace to the left of any line (unlike Block Selection, as prorposed by João Angelo, which will unindent the selected block but keep any indentation within the block).
You may use the Visual Studio extension Copy for review. Besides some formatting, it removes unnecessary whitespace. It works for Visual Basic, among other languages.
Disclosure: I am the author of that extension. Please notify me, if I can improve it to your needs.
In Visual Studio 2008, it seems that when I tab on a line it inserts either 4 spaces or a tab, however - when I backspace it removes a tab as if it were 4 spaces, one space at a time..
I checked the text-editor settings in Tools.. tried both use spaces and use tabs, neither seem to work.
Any ideas?
Thanks in advance.
Pete
Maybe I'm just crazy, but why don't you just press Shift + Tab instead of backspace if you want to get rid of the tabs?
Aha!! Hi Robert, that's what I did try.. However, I needed to change this setting in the 'All Languages' section so it applied to every type of page.
"Keep tabs"
Thanks
Pete
Well it's probably not writing tabs its converting tabs to spaces when you press tab. There is a setting in the options that tells VS how many spaces to insert when pressing tab, Maybe you can set it to actually insert a tab instead and backspace would then remove the tab. I've heard it's quite common to use spaces not tabs that's why its built into VS i guess.