I want to copy code position with namespace, function name, class name, line number etc. I will paste this values to team project for task/bug entry.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With