Is there any extension for VS copying code position?
Solution 1:
You can use Visual Studio code model and Visual Commander to copy exactly what you need. For example, the following command copies file, line and namespace.class.function:
EnvDTE.TextSelection ts = DTE.ActiveWindow.Selection as EnvDTE.TextSelection;
if (ts == null)
return;
EnvDTE.CodeFunction func = ts.ActivePoint.CodeElement[vsCMElement.vsCMElementFunction]
as EnvDTE.CodeFunction;
if (func == null)
return;
string result = DTE.ActiveWindow.Document.FullName + System.Environment.NewLine +
"Line " + ts.CurrentLine + System.Environment.NewLine +
func.FullName;
System.Windows.Clipboard.SetText(result);
Result:
C:\Users\sv\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication3\Program.cs
Line 12
ConsoleApplication3.Program.Main