visual source safe is not comparing properly, it is showing some dots - visual-sourcesafe

One of my file is showing dots while comparing and some special character which is unreadable.(visual source safe 6.0 build 9848)
following is the extract
Orignal was
f f
fg
but it is showing
1 Change: ÿþf To: ÿþf
2 Ins:
3 Ins:

I am going to suggest to skip using this visual source safe feature. and just do compare and merge manually using a third party application like winmerge. you will save yourself a lot of headache
http://winmerge.org/?lang=en

Related

Can I rename a class and all its occurences/references in VS code?

I would like to rename a class that is a part of a huge project. I have IntelliSense, IntelliPhense and all related installed.
The project is Laravel, although there's a ton of custom code as well.
Is there a suggested extension or built-in way to do that, because I couldn't find any?
I think you can use the general search and replace on vscode by using ctrl + shift + F and you can skip (close) whichever you think its not part of what you wish to replace.
Here the total occurrence of TransactionController 31 and found in 5 files, you can close any file you don't want to replace the name.

How to count selected (or found) characters and lines in Visual Studio (Not VS Code)

I am developing a combined Embedded + Desktop application. Memory constraints on the embedded platform make it important to know the size and count of items that will be sent and received. When I make size or element count changes on one system I need to coordinate those changes with the other system.
To get this information, I currently select and copy the elements of interest within visual studio and paste them into an external text editor that can give me the character count and the line count.
I would like to find a way to see that same information (count of selected lines and count of selected characters) within Visual Studio (2017).
The only way I've found so far is to perform find and replace within a selection, which does report the count of replacements. If I use regular expressions for the match I can get a count of whatever matched, so with two passes I can get the count of characters and lines replaced -- but then I have to Ctrl-Z to undo the damage, and this just seems like a bad idea. There must be a better way.
Is there any way to get the count of found or selected elements other than using Find & Replace and then un-doing the damage?
Virtually every other editor I've seen permits doing a "find" within a selection and tells you the count of matches, but I've not found any way to make Visual Studio show the count of matches, even though all the found elements are color-marked. I have to do "replace all" to get the count.
I see that there have been periodic feature requests for this same functionality going back quite a few years, but up to now they have been closed for lack of votes. I found macros for VS2010 that can do this, but I don't find any evidence that macros exist in VS2017. I have not found any marketplace extension that gives the count of selected lines and selected characters.
Note that I'm not looking to count lines of code in a file, or a project, or a solution. I'm only seeking to count the characters and lines "on the fly" in a selection within the Visual Studio IDE. I searched, but did not find any questions that appear to be duplicates of this question.
Edit:
Sadly, nearly 4 years later it seems there still is no native way to do this in any version of Visual Studio up to and including VS 2022. VS Code does show the count of selected characters, but that doesn't help since I need the full IDE of Visual Studio. Sigh.
VSCode displays the number of characters currently selected in the status bar, e.g. (143 selected)
You can use the following command (C# language) with my Visual Commander extension to count selected characters and lines:
public class C : VisualCommanderExt.ICommand
{
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
EnvDTE.TextSelection ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection;
System.Windows.MessageBox.Show("Lines=" + (1 + ts.BottomLine - ts.TopLine) + " Characters=" + ts.Text.Length);
}
}
(BTW, Visual Commander can also run a VS 2010 macro.)

How to make Intellisense in Visual Studio 2012 not to substitute text right to the cursor?

While programming I often realize that I need to add something before already typed code. For example I type the name of the variable:
input[0]
and then I realize that my array is of type string and I need to convert it. So, I move to the beginning of the word (with Ctrl-Left Arrow) and start typing
Convert.To|input[0]
with pipe used to show the position of my cursor. I get some suggestions from Intellisense, including the ToInt32() method I am looking for. But as long as I confirm this suggestion with Tab or Space, I get the following:
Convert.ToInt32(|)[0]
So, the text from the cursor position to the end of the word is substituted with suggestion, and this is definitely not what I want.
This problem is not specific for VS 2012 and might be due to some extensions I have installed, but my attempt to pursue its origin did not yield anything. I have following extensions installed: ReSharper, PowerCommands, Productivity Power Tools.
If you are entering an unrelated expression before an identifier, add a space before you start typing the new expression. This will prevent the completion from replacing the existing identifier.
For example, if | marks the caret, the following scenario would avoid the problem you are facing.
Convert.To| input
This code completion feature is designed to prevent the insertion of incorrect identifiers. If Visual Studio behaved like some other IDEs I know of, using the code completion feature in your original example would result in the insertion of ToInt32input, which would never be valid.
If you are interested in additional thoughts regarding this feature in general, I have described this as the Extend (default for Visual Studio) and No-extend (default for NetBeans, Eclipse, and others) modes in my blog article Code Completion filtering, selection, and replacement algorithms.
A two years later answer. But it might still be useful for some.
What helped for me in VS2015 (which might also work in VS2012) is to add the a space character to the list of 'Member List Commit Characters' in the Intellisense settings.
After this the characters after the cursor are not removed by an auto-completion.

Visual Studio 2012: How to handle code replacement over multiple lines

I often have to replace multiple lines in multiple documents. In Visual Studio 2012 there seems to be the possibility to put muliple line code in a simple one-line-input-box only.
In the "embedded" search box there is also only a single-line input field:
After inserting the often very long search terms and trying to put a regular expressions for line breaks into it, i have to move horizontally inside a one-line-input-field which isn't comfortable at all.
Is there another way to use the find/replace functionality for replacing muliple lines in Visual Studio 2012?
In order to replace multiple lines first you have to check regular expression option on search window. In following example it's search the
first
second
third
and replace it with
fourth
fifth
sixth
search text : first([\s\n])second([\s\n])third
replace text : fourth$1fifth$2sixth
This worked exceptionally well for me:
http://vlasovstudio.com/sync-block-edit/

Eliminating code duplication in a single file

Sadly, a project that I have been working on lately has a large amount of copy-and-paste code, even within single files. Are there any tools or techniques that can detect duplication or near-duplication within a single file? I have Beyond Compare 3 and it works well for comparing separate files, but I am at a loss for comparing single files.
Thanks in advance.
Edit:
Thanks for all the great tools! I'll definitely check them out.
This project is an ASP.NET/C# project, but I work with a variety of languages including Java; I'm interested in what tools are best (for any language) to remove duplication.
Check out Atomiq. It finds code that is duplicate that is prime for extracting to one location.
http://www.getatomiq.com/
If you're using Eclipse, you can use the copy paste detector (CPD) https://olex.openlogic.com/packages/cpd.
You don't say what language you are using, which is going to affect what tools you can use.
For Python there is CloneDigger. It also supports Java but I have not tried that. It can find code duplication both with a single file and between files, and gives you the result as a diff-like report in HTML.
See SD CloneDR, a tool for detecting copy-paste-edit code within and across multiple files. It detects exact copyies, copies that have been reformatted, and near-miss copies with different identifiers, literals, and even different seqeunces of statements.
The CloneDR handles many languages, including Java (1.4,1.5,1.6) and C# especially up to C#4.0. You can see sample clone detection reports at the website, also including one for C#.
Resharper does this automagically - it suggests when it thinks code should be extracted into a method, and will do the extraction for you
Check out PMD , once you have configured it (which is tad simple) you can run its copy paste detector to find duplicate code.
One with some Office skills can do following sequence in 1 minute:
use ordinary formatter to unify the code style, preferably without line wrapping
feed the code text into Microsoft Excel as a single column
search and replace all dual spaces with single one and do other replacements
sort column
At this point the keywords for duplicates will be already well detected. But to go further
add comparator formula to 2nd column and counter to 3rd
copy and paste values again, sort and see the most repetitive lines
There is an analysis tool, called Simian, which I haven't yet tried. Supposedly it can be run on any kind of text and point out duplicated items. It can be used via a command line interface.
Another option similar to those above, but with a different tool chain: https://www.npmjs.com/package/jscpd

Resources