Skip to content

Commit

Permalink
Fix missing context menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitz committed Jul 6, 2021
1 parent a124a0c commit b1fdac1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
11 changes: 6 additions & 5 deletions Serialization/ExpressionNodeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ private ExpressionNodeData(
) {
var (aggregatePath, pathFromParent) = path;
PathFromParent = pathFromParent;
if (aggregatePath.IsNullOrWhitespace() || pathFromParent.IsNullOrWhitespace()) {
FullPath = aggregatePath + pathFromParent;
} else {
FullPath = $"{aggregatePath}.{pathFromParent}";
}

var separator =
aggregatePath is null or "" || pathFromParent is null or "" ?
"" :
".";
FullPath = aggregatePath + separator + pathFromParent;

switch (o) {
case Expression expr:
Expand Down
2 changes: 1 addition & 1 deletion UI/ViewModels/VisualizerDataViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public VisualizerDataViewModel(VisualizerData model, ICommand? openInNewWindow=n
)
)
.SelectMany(x => x.Item2.Select(y => (x.endNodeType, y)))
.ToLookup(x => x.endNodeType, x => x.Item2);
.ToLookup(x => x.endNodeType, x => x.y);

Constants = grouped[Constant].ToList();
Parameters = grouped[Parameter].ToList();
Expand Down
12 changes: 6 additions & 6 deletions UI/VisualizerDataControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private void HelpContextMenu_Loaded(object sender, RoutedEventArgs e) {
var (@namespace, typename, propertyname) = node.Model.ParentProperty.Value;
listData.Add(
$"Property: {typename}.{propertyname}",
$"{BaseUrl}{new[] { @namespace, typename, propertyname }.Joined(".")}"
$"{baseUrl}{new[] { @namespace, typename, propertyname }.Joined(".")}"
);
}

Expand All @@ -52,7 +52,7 @@ private void HelpContextMenu_Loaded(object sender, RoutedEventArgs e) {
foreach (var (@namespace, typename, membername) in node.Model.NodeTypesParts) {
listData.Add(
$"Node type: {typename}.{membername}",
$"{BaseUrl}{new[] { @namespace, typename }.Joined(".")}#{new[] { @namespace.Replace(".", "_"), typename, membername }.Joined("_")}"
$"{baseUrl}{new[] { @namespace, typename }.Joined(".")}#{new[] { @namespace.Replace(".", "_"), typename, membername }.Joined("_")}"
);
}
}
Expand All @@ -62,7 +62,7 @@ private void HelpContextMenu_Loaded(object sender, RoutedEventArgs e) {
if (node.Model.BaseTypes is { }) {
node.Model.BaseTypes.SelectT((@namespace, typename) => (
$"Base type: {typename}",
$"{BaseUrl}{@namespace}.{typename.Replace("~", "-")}"
$"{baseUrl}{@namespace}.{typename.Replace("~", "-")}"
)).AddRangeTo(listData);
}

Expand All @@ -71,7 +71,7 @@ private void HelpContextMenu_Loaded(object sender, RoutedEventArgs e) {
if (node.Model.FactoryMethodNames is { }) {
node.Model.FactoryMethodNames.Select(methodName => (
$"Factory method: {methodName}",
$"{BaseUrl}system.linq.expressions.expression.{methodName}"
$"{baseUrl}system.linq.expressions.expression.{methodName}"
)).AddRangeTo(listData);
}

Expand All @@ -82,7 +82,7 @@ private void HelpContextMenu_Loaded(object sender, RoutedEventArgs e) {
foreach (var (header, url) in listData) {
if (header == "---") {
menu.Items.Add(new Separator());
return;
continue;
}

var mi = new MenuItem() {
Expand All @@ -98,6 +98,6 @@ void addSeparator() {
}
}

private const string BaseUrl = "https://docs.microsoft.com/dotnet/api/";
private const string baseUrl = "https://docs.microsoft.com/dotnet/api/";
}
}

0 comments on commit b1fdac1

Please sign in to comment.