Browse Source

Make the GotoDialog accept expressions like "Function.cs:line 416" (like in stack traces)

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@410 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
fb9b8314dc
  1. 24
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

24
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

@ -148,21 +148,29 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -148,21 +148,29 @@ namespace ICSharpCode.SharpDevelop.Gui
bestItem = null;
if (text.Length == 0)
return;
int pos = text.IndexOf('.');
int dotPos = text.IndexOf('.');
int commaPos = text.IndexOf(',');
if (commaPos < 0) {
// use "File, ##" or "File: ##" syntax for line numbers
commaPos = text.IndexOf(':');
}
if (char.IsDigit(text, 0)) {
ShowLineNumberItem(text);
} else if (text.IndexOf(',') > 0) {
pos = text.IndexOf(',');
string file = text.Substring(0, pos).Trim();
string line = text.Substring(pos + 1).Trim();
} else if (commaPos > 0) {
string file = text.Substring(0, commaPos).Trim();
string line = text.Substring(commaPos + 1).Trim();
if (line.StartsWith("line")) {
// remove the word "line"
line = line.Substring(4).Trim();
}
int lineNr;
if (!int.TryParse(line, out lineNr))
lineNr = 0;
AddSourceFiles(file, lineNr);
} else if (pos > 0) {
} else if (dotPos > 0) {
AddSourceFiles(text, 0);
string expression = text.Substring(0, pos).Trim();
text = text.Substring(pos + 1).Trim();
string expression = text.Substring(0, dotPos).Trim();
text = text.Substring(dotPos + 1).Trim();
ShowCompletionData(Resolve(expression), text);
foreach (IClass c in SearchClasses(expression)) {
if (c.Name.Equals(expression, StringComparison.InvariantCultureIgnoreCase)) {

Loading…
Cancel
Save