Visual Studio stack trace in notepad++ - visual-studio

This is probably just a setting I'm not seeing, but when I get a stack trace out of Visual Studio's exception helper dialog, it has \r\n after each "line" in the call stack. When I copy this and paste it into Notepad++, it shows up as literally \r\n, visible in the document. Of course I'd like these to be interpreted as CR LF, so everything's on a different line.
Anyone know how to do this?

I know this question is old, but maybe someone will find the solution helpful.
Open find and replace, and
go to the replace tab
In the find box type \\r\\n
In the replace box type \r\n (both without quotes)
Make sure the Extended search mode is selected in the bottom left.
Finally, hit replace all.
.

It took me a while the first time to find the setting. It's View >> Show Symbol >> Show All Characters.

This sounds like a Notepad++ bug. I can paste into regular Notepad and UltraEdit without the side effects you describe.
Like Cerebrus says, you can workaround it on the Notepad++ side by using its search/replace facility.

Related

Visual Studio: EMACS-like white space removal

my coworker and i wonder if there is a way to teach visual studio to do something like emacs is able to: place the cursor anywhere in a series of whitespace in code, press ALT-SPACE shortcut (or the defined one) and boom only one space character left.
does anyone know if a simple solution exists to do this? maybee even without installing extensions or other stuff?
i already tried shortcuts like STRG-DEL but it depends on the cursor position what is deleted and that is not exactly what we are searching for.
thanks in advance, cheers! jens
ps: caps lock is reverse broken, sorry...
You could try this :
Ctrl + H
Find what:
[\u0020]+\r?\n
Replace with:
\r\n
\s instead of [\u0020] delete empty line feeds, probably because it matches line feeds
i just found out... VS HAS a feature to do this... unfortunately, in 2012 it is not working, in 2015 is is... weirdo... default is
STRG + E, ^
you also find it in EDIT >> ADVANCED menu.
best regards,
jens
**Ctrl+E, Ctrl+** is what works on my keyboard, not sure what 'strg' is, maybe a different term for 'control"?? You can also achieve this with **Ctrl+K, Ctrl+** (a keyboard "chord"), as long as you have your cursor within the spaces you want to reduce.
In some cases in Visual Studio 2015, these spaces will be eliminated when you press the chord for file reformatting in general: Ctrl+K, Ctrl+D. However, it seems to depend on factors I'm not certain of... something I'll be posting about in StackOverflow later.

Blank lines after ftp down/up

I'm having a weird trouble for quite some time.
I use Filezilla as FTP agent and Aptana Studio as IDE. In some servers, when I upload/download files, it breaks all formating.
I tried both Binary and ASCII (though i know for .php and text files, ASCII is right), but the files keeps coming back like this:
In some cases, even in notepad it opens really weird; like in one line only. If I delete those blank lines by hand, sometimes the code don't even work, but sometimes it does.
I've made plenty of research here and over the web, but besides putting on ASCII mode in FTP, I got nothing usefull =/
So, I'm still not 100% sure WHY this happens, (apparently some osX setups x Windows configs... old story, same players), but here's how I fixed:
Search and replace with regex:
At Sublime Text, just ctrl+h and click the Regular Expression icon (The first on the left, like the Sum Symbol)
Find What: [\r\n]{2,}
Replace With: \n
Replace All, and you're done.

How to create code box without rich text formatting

My question is related to this topic How to copy and paste code without rich text formatting? except its from the opposite viewpoint: I'm creating a document from PowerPoint in which I have code snippets in text boxes. I want to make the document as simple as possible by making the code snippet text boxes easy to copy and paste the code into a terminal to run without editing anything. However, the way I have it right now is that when I copy and paste it keeps the formatting and I have to go though letter by letter to erase the end of line symbols. How should I format this in PowerPoint?
You can get rid of most formatting by copy/pasting from PPT to Notepad and then copy/pasting from there to your terminal program, or if the latter has a Paste Special command, you should be able to paste as plain text, which'd get rid of formatting.
Line/Paragraph breaks are another matter. If the end of line symbols are the only formatting problem when you've pasted the text into a terminal (emulator program, I assume), it sounds as though the terminal's using CR or LF as a line ending, whereas PPT's using CR/LF pairs. It might only be necessary to reconfigure the terminal software to use CR/LF.
It's worth a look at this page on my site, where I explain what line and paragraph ending characters are used by different versions of PowerPoint in different situations.
Paragraph endings and line breaks
http://www.pptfaq.com/FAQ00992_Paragraph_endings_and_line_breaks.htm
Sorry, my mistake was not realizing that PowerPoint auto formats hyphens and quotation marks to make them stylized, and the terminal was not recognizing the symbols. All I did was type in a quotation mark/hyphen then copying that before I pressed the space bar after it to save the original formatting.

alternative to Resharper "go to file" and "go to implementation" features

Does anybody know a light plug-in that do (same as Resharper) go to implementation and the quick search for a file where you just insert few characters and it shows the matches? I just want to get rid of Resharper cause it slows me down a lot!!
To answer the original question, as per this post by Andrew Arnott, you can use Ctrl+/ to move the cursor to the Find text box in the toolbar, then type ">of" and start typing file names. The matching files will appear as you type.
Using the ">" prefix causes the find text box to act as the command window would.
(Note that the Ctrl+/ short-cut may be overridden by ReSharper to comment a line of code, so this short-cut only works with ReSharper uninstalled.)
That's interesting. I use ReSharper and it uses about 400mb of RAM. I would consider that pretty low usage.
Maybe you can look into Productivity Power Tools (I don't use it).
http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/

Multiline Find & Replace in Visual Studio

Can it be done? We're using VS2005, VS2008, and VS2010.
I don't mean regular expressions—which have their place—but plain old text find and replace. I know we can do it (at a pinch) with regular expressions using the \n tag, but we prefer not to get tangled up in regex escape characters, plus there's a readability issue.
If it can't be done, what plain and simple (free) alternative are people using? That doesn't involve knocking up our own macro.
I finally found it...
There isn't any need to download and load any external macro.
It’s working in Visual Studio 2008 with in-built macro at least. :)
Steps:
Select text you want to find.
Press Alt + F8 or open "Tools -> Macros -> Macro Explorer"
Double click Sample → Utilities → FindLine. (It will open the Find box with your selection loaded in the "Find" field. Don't worry about truncated text shown in the "Find" field. Trust me, the field has it all... The Microsoft way of showing it may be... :) )
Click on the "Quick Replace" button in the "Find And Replace" dialog box. Enter your replace with text.
And click any of three buttons as per your requirement...and it’s done. :)
Hurray... it’s working. It may not be a straightforward way to do it, but you know with Microsoft. Nothing is straightforward and easy.. :)
This works today in Visual Studio 2012:
fooPatternToStart.*(.*\n)+?.*barPatternToEnd
See how the (.*\n)+? part does the match across multiple lines, non-greedy.
fooPatternToStart is some regex pattern on your start line, while barPatternToEnd is your pattern to find on another line below, possibly many lines below...
Example found here.
Simple and effective :)
Note: before VS2012, the pattern that worked was: fooPatternToStart.(.\n)+#.*barPatternToEnd
You can search for multiline expressions by clicking on the "Use Regular Expressions" checkbox in the "Find and Replace" dialog. Line breaks are then indicated by \n.
I use this:
Visual Studio Gallery Multiline Search and Replace
It’s provided by Microsoft only. Please check Multiline Search and Replace.
It uses regular expression only. But for those who don't know regex, it is better to use it.
You could also open the files with UltraEdit which fully supports MultiLine replace.
You can use the trial version if you only intend to use it once.
Regarding the comment of Andrew Corkery:
If you like to specify a multi-line replacement string as well, edit the macro code and set the replacement text as shown below.
This will allow you to "fine-tune" your replacement with just the small modifications needed.
Sub FindLine()
Dim textSelection As TextSelection
textSelection = DTE.ActiveDocument.Selection
textSelection.CharLeft(True)
DTE.ExecuteCommand("Edit.Find")
DTE.Find.FindWhat = textSelection.Text
' Also preset replacement text with current selection
DTE.Find.ReplaceWith = textSelection.Text
End Sub
The latest version (as of this posting) of Notepad++ does multi-line find/replace. With no macro support in Visual Studio any more, this is relevant now.

Resources