Skip to content

Commit

Permalink
- Fixed sort order of multi-location items
Browse files Browse the repository at this point in the history
- Removed broken "Find All References" command from context menu of symbol list
  • Loading branch information
wmjordan committed Jun 4, 2019
1 parent 3abad5d commit d4f9531
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Codist/Controls/CSharpSymbolContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public void AddAnalysisCommands() {
}
//Items.Add(CreateCommandMenu("Find references...", KnownImageIds.ReferencedDimension, _Symbol, "No reference found", FindReferences));
Items.Add(CreateItem(KnownImageIds.FindSymbol, "Find Symbol with Name " + _Symbol.Name + "...", () => FindSymbolWithName(_Symbol, _SemanticContext)));
}

public void AddFindAllReferencesCommand() {
Items.Add(CreateItem(KnownImageIds.ReferencedDimension, "Find All References", FindAllReferences));
}

Expand Down Expand Up @@ -301,16 +304,18 @@ static void FindSymbolWithName(ISymbol symbol, SemanticContext context) {

internal static void ShowLocations(ISymbol symbol, SemanticContext context) {
var m = new SymbolMenu(context, SymbolListType.Locations);
var locs = symbol.GetSourceLocations().Sort((x, y) => String.CompareOrdinal(x.SourceTree.FilePath, y.SourceTree.FilePath));
var locs = new SortedList<(string, string), Location>();
foreach (var item in symbol.GetSourceLocations()) {
locs.Add((System.IO.Path.GetDirectoryName(item.SourceTree.FilePath), System.IO.Path.GetFileName(item.SourceTree.FilePath)), item);
}
m.Title.SetGlyph(ThemeHelper.GetImage(symbol.GetImageId()))
.Append(symbol.ToDisplayString(WpfHelper.MemberNameFormat), true)
.Append(" source locations: ")
.Append(locs.Length);
.Append(locs.Count);
foreach (var loc in locs) {
m.Menu.Add(loc);
m.Menu.Add(loc.Value);
}
locs = symbol.Locations.RemoveAll(l => l.IsInMetadata == false).Sort((x, y) => String.CompareOrdinal(x.MetadataModule.Name, y.MetadataModule.Name));
foreach (var loc in locs) {
foreach (var loc in symbol.Locations.RemoveAll(l => l.IsInMetadata == false).Sort((x, y) => String.CompareOrdinal(x.MetadataModule.Name, y.MetadataModule.Name))) {
m.Menu.Add(loc);
}
m.Show();
Expand Down
1 change: 1 addition & 0 deletions Codist/SmartBars/CSharpSmartBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void AddContextualCommands(CancellationToken cancellationToken) {
};
m.ItemClicked += (s, args) => HideToolBar();
m.AddAnalysisCommands();
m.AddFindAllReferencesCommand();
m.AddGoToAnyCommands();
ctx.Sender.ContextMenu = m;
m.IsOpen = true;
Expand Down

0 comments on commit d4f9531

Please sign in to comment.