how to remove shortcut file in visual source safe 2005 - visual-sourcesafe

How to Remove in following shortcut symbol in visual source safe file

Use 'Branch files':
P.S.: I hope you understand, what this shortcut symbol means and how behavior changed after branching. If not, better read something about this topic: e.g.: https://msdn.microsoft.com/en-us/library/y90e01b4(v=vs.80).aspx

Related

Automatic Clean-Up of Code in Visual Studio 2010

I am wondering, if it is possible, to have some kind of automatic code-clean-up in Visual Studio 2010.
Especially interesting would be:
Auto-Indent
Remove tailing empty lines
Remove unused usings
at special cases, e. g. on save of the file.
I haven't found anything in the options, but maybe I was just kinda blinded... ...afaik in eclipse it was at least possible to intend on save. There should be something like that in Visual Studio?
UPDATE: Thanks for the fast replies, the thing is that I am ware of the keyboard-shortcuts (but nevertheless thanks for mentioning), but I am working through tons of foreign code by now and it would be awesom not having to do it manually for every file :)
Auto-indent can be done with Edit/Advanced/Format Document, or equivalent keyboard shortcut (Ctrl-K, Ctrl-D for me, YMMV).
Tailing empty lines I'm not aware of an automatic solution for, though there may be an extension available (or you could write your own).
Removing unused usings is a built in VS refactoring, and also available in tools like Resharper or DevExpress. (Right click code, then Organize Usings/Remove and sort.)
I'm not aware of a standard way to have these happen automatically for every document save, but you could probably write a macro or VS extension that would make this happen.
Some of the above already exist directly in Visual Studio:
Ctrl - K - D will reformat the document (Edit -> Advanced -> Format Document).
There is a refactoring that deals with using statements (right click in the code, there is an option for "Organise Using").
As for empty lines, I don't know of anything built in.
But tools like Resharper do have code cleanup capabilities that deal with all of the above and more (Resharper menu -> Tools -> Cleanup Code).
None of the above will execute on save by default, but you should be able to write a macro that runs on the save event.
You could try CodeMaid. Its an open source solution for what you are describing.
To Auto-indent you can ue ctrl+k+d pretty much like ctrl+shift+f in eclipse. But for unused usings I dont know any.

In Visual Studio 2010, how do I quickly switch from a .h file to the corresponding .cpp file? [duplicate]

This is a feature I have grown accustomed to in Eclipse (Ctrl+Tab). Is there an equivalent in Visual C++?
In Visual Studio 2013 and later there is a default keyboard shortcut for this: Ctrl+K, Ctrl+O
(You will need to hold down Ctrl and type ko and then release Ctrl)
In earlier versions, see:
Visual Studio Macro to switch between CPP and H files
or
Open Corresponding File in Visual Assist
In Visual Studio 2013 a default keyboard shortcut for this is Ctrl+K, Ctrl+O
You could add this macro to your VS config (via Tools -> Macros -> Macro Explorer) then assign a hotkey to it (via Tools -> Options -> Environment -> Keyboard).
I only just wrote it (been meaning to try this for ages!) but it seems to work so far, in both VS2008 and VS2010.
Since it's a macro you can edit it to include whatever rules you want (e.g. looking in other folders, or special naming rules if you have a single header shared by multiple cpp files or similar).
Here's the macro (I'm sure it could be better written; I'm unfamiliar with the VS objects and only realised macros were using .Net about half-way through writing the thing :)):
Sub FileSwitch()
Try
Dim CurrentPath As String = DTE.ActiveDocument.FullName
Dim OtherPath As String
If (IO.Path.HasExtension(CurrentPath)) Then
Dim CurrentExtension As String = IO.Path.GetExtension(CurrentPath)
Select Case CurrentExtension
Case ".h", ".hpp", ".hxx"
OtherPath = IO.Path.ChangeExtension(CurrentPath, ".cpp")
If (Not IO.File.Exists(OtherPath)) Then
OtherPath = IO.Path.ChangeExtension(CurrentPath, ".c")
If (Not IO.File.Exists(OtherPath)) Then
OtherPath = IO.Path.ChangeExtension(CurrentPath, ".cxx")
End If
End If
Case ".cpp", ".c", ".cxx"
OtherPath = IO.Path.ChangeExtension(CurrentPath, ".h")
If (Not IO.File.Exists(OtherPath)) Then
OtherPath = IO.Path.ChangeExtension(CurrentPath, ".hpp")
If (Not IO.File.Exists(OtherPath)) Then
OtherPath = IO.Path.ChangeExtension(CurrentPath, ".hxx")
End If
End If
Case Else
End Select
If (OtherPath <> Nothing) Then
DTE.ItemOperations.OpenFile(OtherPath)
End If
End If
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
Here's a (very wide :)) screenshot showing what the macro editor and hotkey/options dialogs should look like, to help those not familiar with them:
Try PhatStudio. It's free and comes with an easy installer.
ALT + S = Switch between header/source file
ALT + O = Open a file (supports instant search via typing, like the start menu in Windows Vista/7).
Try Visual Assist, which sports this very feature (amongst others):
http://www.wholetomato.com/
The code browsing functionality -- of which the header/cpp swap is one part -- are really good.
(I also really rated its intellisense and refactoring features, but not everybody I've spoken to has agreed with me.)
EDIT: just remembered, the Nifty Solution Plugin also does this -- plus another handly Visual Assist-like thing, though nothing else -- and they're free:
http://code.google.com/p/niftyplugins/
(The guy's perforce plugin is great, too. Much better than the default VSSCC rubbish.)
For Visual Studio 2013, as mentioned by others it's the command named:
EditorContextMenus.CodeWindow.ToggleHeaderCodeFile
and it has as default combination of keys: Ctrl+K,Ctrl+O, but it can be changed if you introduce the new combination of keys that you like in the
Press shortcut keys:
under
Tools -> Options -> Environment -> Keyboard.
So you can choose a custom keys combination as my favorite for .h to .cpp switch is Ctrl+Tab.
In Visual Studio 2008 and 2010, you can right click in your .cpp file and choose Go To Header File ... that will take you in one direction. For the other direction, if you right click something you're declaring in the header, and choose Go To Definition, that will take you in the other direction. You might have to go through an ambiguity resolution dialog if you choose the constructor, because the function name matches the class name, but if you choose anything else, you'll go straight where you want. I know this is a two-click approach, rather than one keystroke, but it does do what you want.
If you position your mouse over a function declaration in the header and press F12, the cpp file will be opened at the definition of the cpp file... I use this feature extensively!
I don't see this answer here, but at least in Visual Studio 2012 (Express included!), you can just assign your own keyboard command to go to the header file (NOTE: Only goes one way -- you can't go back to the source file unfortunately...)
Go to Tools/Options/Environment/Keyboard.
Find the following command: EditorContextMenus.CodeWindow.GoToHeaderFile
Assign whatever key combination you want (Alt-S works)
Profit
Not sure which versions of VS this works in, but it doesn't require any add-ins and seems to do the trick in at least one direction.
Try using Switch - it's an addin that lets you flick between source and header, code and designer, XAML and codebehind etc etc:
http://www.dwmkerr.com/switch/ or directly from Products and Extensions for Visual Studio
I'm a fan of Visual Assist for doing this. Its not cheap but it provides a lot more functionality than switching between header and source. I also use its open file in project and class browsing features a lot. Of course the macro is free...
There's also a macro listed on the Whole Tomato support forum which has a few more file mappings.
Visual assist also does not support Visual studio express editions. So you are stuck with the macro if you are using that IDE>
In Visual Studio 2008 it's Alt + O.
In their (in)finite wisdom, MS decided to remove macros in MSVS 2012, so the macro above won't work.
For MSVS 2012, I found this:
http://www.dwmkerr.com/switch/
It's highly configurable + if you want to help improving it, you can do so on GitHub.
In Visual Studio 2013 it's ALT + O

ViM-like search highlight in Visual Studio possible?

ViM has this option hlsearch where a searched string is displayed in highlight mode at all places in the file it is found. Is there a way to do the same in Visual Studio?
That is, if I search for "foobar", then all the foobar in the file are shown highlighted and this display remains until my next search. I find this very useful to see the places in a function where a certain variable is used (without having to manually search for the next appearance of that string).
I am aware of the Visual Studio Task List which can be used to look up strings like TODO. I hope the reader realizes that this is not a good fit for my problem which is more general text search and highlight.
If you like vim and are using Visual Studio you may want to check out Viemu.
The hlsearch Feature is of course included.
Example Picture:
Viemu hlsearch http://dklein.taunus.de/viemuhlsearch.png
With best regards.
Visual Assist X does this, along with something akin to light-symbol-mode. Among other things, of course.
Visual Studio 2010 now supports Reference Highlighting. Click on or move the cursor to any symbol such as names of variables, classes, methods, properties, etc. and it will highlight all other references in the file. It also allows you to navigate between the references using:
ctrl+shift+down arrow or ctrl+shift+up arrow
I use the RockScroll add-in. It has multiple features, one of them is that if you double click on a word it will be highlighted everywhere in the file. This is very similar to what you describe. It is free (as in beer).
If you happen to really like Vim, you might want to look into ViEmu for Visual Studio . I'm just a really happy user of it :)

Visual Studio 2008 macro to switch between header and source files?

Does anyone know how to make a macro or something to switch between foo.hpp and foo.cpp? I would really appreciate having a macro like this. I guess it would help if it actually opened the corresponding file, but kept the old one in a tab.
Thanks
Perhaps one (or a combination) of the following will help you:
Switch between a Header and a CPP File in .NET (a macro at codeproject)
Switch between header and impl files in VS.NET (describes how to create the macro and bind it to a key)
Switch between Source and Header C++ Files (A recent macro from codeguru)
Macro to Switch Between Header and CPP File (An old macro from codeguru)
Several other solutions found on Google...
Why not use right click > Go to declaration | Go to definition?
In Visual Studio 2013 it was added as Ctrl + K, Ctrl + O
Some of the options ran slow for me in large projects. This one doesn't look in other folders but works faster and should cover most needs:
switch between .cpp & .h files
You could try using 'Switch' - this is an addin that switches between source and header files, but also lets you switch between other types of related files - XAML and codebehind, designer and code etc etc.
Switch

Visual Studio 2005 quick file search

In Eclispe you can do Ctrl+Shift+R and a Window popup where you can write the name of the file (or just the beginning of it) and to press enter to go directly to the file.
What is the equivalence in Visual Studio 2005? (Ctrl+Shift+F is not what I would like).
From Top 11 VS 2005 IDE tips and tricks:
This is the Find dropdown that is on the Standard Toolbar, not the Find dialog. Use the shortcut CTRL+D to activate the Find dropdown in normal mode. Use CTRL+/ to activate the Find dropdown in command mode
To quickly go to a file, type CTRL+D, >open <start of file name>. Intellisense works here just like in the Command Window. "of" (short for "open file") can be used instead of open.
I am not sure if there is a built-in command but there are some addons like VS File Finder
Hit Ctrl+D (Find Combo - the one in the toolbar), write ">of " and the name of the file.
I am using ReSharper, so I am not sure if the shortcut is exactly this one in your case.
I don't know if there is an equivalence, but you can probably do it with the macro editor. It's pretty powerful and you can do pretty much what you want with it.
In plain VS.NET 2005, Go to the command window (Ctrl-D), type "openfile" (or just "of") and the file name.
If you have Resharper (and you should have it), you can type Ctrl-N and type in the class name, or Ctrl-Shift-N and type in the filename.
Gulzar proposed VS File Finder that was the greatest solution here.
But I installed SonicFilFinder because the GUI was better. It works like a charm and you can use the HotKey you want. Really fast and no need of of the mouse. It's free.
In VS 2010, you can use Edit > Navigate To... (Ctrl+comma).
Pro:
Also searches objects/methods
Con:
Doesn't support * wildcards
Window isn't dockable
See: MSDN Blog

Resources