Browse Source

Fix bug in find references that caused us to miss many results.

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
d25d7da199
  1. 11
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs
  2. 5
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsBulbPopup.cs
  3. 4
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsPopup.cs
  4. 2
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/GoToEntityAction.cs
  5. 2
      src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs

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

@ -100,8 +100,17 @@ namespace CSharpBinding
ReadOnlyDocument document = null; ReadOnlyDocument document = null;
IHighlighter highlighter = null; IHighlighter highlighter = null;
List<Reference> results = new List<Reference>(); List<Reference> results = new List<Reference>();
// Grab the unresolved file matching the compilation version
// (this may differ from the version created by re-parsing the project)
CSharpUnresolvedFile unresolvedFile = null;
IProjectContent pc = compilation.MainAssembly.UnresolvedAssembly as IProjectContent;
if (pc != null) {
unresolvedFile = pc.GetFile(fileName) as CSharpUnresolvedFile;
}
fr.FindReferencesInFile( fr.FindReferencesInFile(
searchScope, parseInfo.UnresolvedFile, parseInfo.SyntaxTree, compilation, searchScope, unresolvedFile, parseInfo.SyntaxTree, compilation,
delegate (AstNode node, ResolveResult result) { delegate (AstNode node, ResolveResult result) {
if (document == null) { if (document == null) {
document = new ReadOnlyDocument(textSource, fileName); document = new ReadOnlyDocument(textSource, fileName);

5
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsBulbPopup.cs

@ -4,6 +4,8 @@
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Widgets; using ICSharpCode.SharpDevelop.Widgets;
@ -16,6 +18,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
{ {
public ContextActionsBulbPopup(UIElement parent) : base(parent) public ContextActionsBulbPopup(UIElement parent) : base(parent)
{ {
this.UseLayoutRounding = true;
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
this.StaysOpen = true; this.StaysOpen = true;
this.AllowsTransparency = true; this.AllowsTransparency = true;
this.ChildControl = new ContextActionsBulbControl(); this.ChildControl = new ContextActionsBulbControl();

4
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionsPopup.cs

@ -4,6 +4,7 @@
using System; using System;
using System.Windows.Controls.Primitives; using System.Windows.Controls.Primitives;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
@ -19,6 +20,9 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
{ {
public ContextActionsPopup() public ContextActionsPopup()
{ {
this.UseLayoutRounding = true;
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
// Close on lost focus // Close on lost focus
this.StaysOpen = false; this.StaysOpen = false;
this.AllowsTransparency = true; this.AllowsTransparency = true;

2
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/GoToEntityAction.cs

@ -17,7 +17,7 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
public static ContextActionViewModel MakeViewModel(IEntity entity, ObservableCollection<ContextActionViewModel> childActions) public static ContextActionViewModel MakeViewModel(IEntity entity, ObservableCollection<ContextActionViewModel> childActions)
{ {
var ambience = AmbienceService.GetCurrentAmbience(); var ambience = AmbienceService.GetCurrentAmbience();
ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList; ambience.ConversionFlags = ConversionFlags.ShowDeclaringType | ConversionFlags.ShowTypeParameterList;
return new ContextActionViewModel { return new ContextActionViewModel {
Action = new GoToEntityAction(entity, ambience.ConvertEntity(entity)), Action = new GoToEntityAction(entity, ambience.ConvertEntity(entity)),
Image = CompletionImage.GetImage(entity), Image = CompletionImage.GetImage(entity),

2
src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Resolver/FindReferences.cs

@ -381,8 +381,6 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver
{ {
if (searchScopes == null) if (searchScopes == null)
throw new ArgumentNullException("searchScopes"); throw new ArgumentNullException("searchScopes");
if (unresolvedFile == null)
throw new ArgumentNullException("unresolvedFile");
if (syntaxTree == null) if (syntaxTree == null)
throw new ArgumentNullException("syntaxTree"); throw new ArgumentNullException("syntaxTree");
if (compilation == null) if (compilation == null)

Loading…
Cancel
Save