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:Userssvdocumentsvisual studio 2015ProjectsConsoleApplication1ConsoleApplication3Program.cs
Line 12
ConsoleApplication3.Program.Main
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…