Browse Source

Fix bug in C# find references.

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
56d93e11d8
  1. 7
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs

7
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs

@ -108,16 +108,17 @@ namespace CSharpBinding
highlighter = SD.EditorControlService.CreateHighlighter(document); highlighter = SD.EditorControlService.CreateHighlighter(document);
} }
Identifier identifier = node.GetChildByRole(Roles.Identifier); Identifier identifier = node.GetChildByRole(Roles.Identifier);
if (identifier != null) if (!identifier.IsNull)
node = identifier; node = identifier;
var region = new DomRegion(fileName, node.StartLocation, node.EndLocation); var region = new DomRegion(fileName, node.StartLocation, node.EndLocation);
int offset = document.GetOffset(node.StartLocation); int offset = document.GetOffset(node.StartLocation);
int length = document.GetOffset(node.EndLocation) - offset; int length = document.GetOffset(node.EndLocation) - offset;
var builder = SearchResultsPad.CreateInlineBuilder(node.StartLocation, node.EndLocation, document, highlighter); var builder = SearchResultsPad.CreateInlineBuilder(node.StartLocation, node.EndLocation, document, highlighter);
var defaultTextColor = highlighter != null ? highlighter.DefaultTextColor : null; var defaultTextColor = highlighter != null ? highlighter.DefaultTextColor : null;
results.Add(new Reference(region, result, offset, length, builder, defaultTextColor)); results.Add(new Reference(region, result, offset, length, builder, defaultTextColor));
}, cancellationToken); }, cancellationToken);
callback(new SearchedFile(fileName, results)); if (results.Count > 0)
callback(new SearchedFile(fileName, results));
} }
} }
} }

Loading…
Cancel
Save