Skip to content

Commit 95227c6

Browse files
authored
Merge pull request #125 from Rekkonnect/dev/final-touches-1.2.2
Minor improvements
2 parents 79311d3 + d6573e1 commit 95227c6

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

Syndiesis/Controls/AnalysisVisualization/AnalysisTreeListNode.axaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ internal void EvaluateHoveringRecursivelyBinary(PointerEventArgs e)
331331
if (index < 0)
332332
return;
333333

334-
var children = LazyChildren;
335334
var child = LazyChildren[index];
336335
child.EvaluateHoveringRecursivelyBinary(e);
337336
}
@@ -346,7 +345,7 @@ private int BinarySearchControlByTop(double height)
346345
while (low <= high)
347346
{
348347
int mid = (low + high) / 2;
349-
var child = LazyChildren[mid];
348+
var child = children[mid];
350349
var childBounds = child.Bounds;
351350
if (childBounds.Top <= height && height <= childBounds.Bottom)
352351
return mid;

Syndiesis/Controls/CommonAvaloniaExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ public static void AddIfNotContained(this ControlList controls, Control control)
230230
controls.Add(control);
231231
}
232232
}
233+
234+
public static bool ContainsPointer(this Control control, PointerEventArgs pointer)
235+
{
236+
var position = pointer.GetPosition(control);
237+
return control.Bounds.Contains(position);
238+
}
233239
}
234240

235241
// Dispatcher

Syndiesis/Controls/Editor/CodeEditor.axaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public bool DiagnosticsUnavailable
119119
}
120120
}
121121

122+
public BackgroundLineNumberPanel LineNumberPanel { get; private set; }
123+
122124
public event EventHandler? TextChanged
123125
{
124126
add => textEditor.Document.TextChanged += value;
@@ -146,6 +148,7 @@ public CodeEditor()
146148

147149
[MemberNotNull(nameof(_nodeSpanHoverLayer))]
148150
[MemberNotNull(nameof(_diagnosticsLayer))]
151+
[MemberNotNull(nameof(LineNumberPanel))]
149152
private void InitializeTextEditor()
150153
{
151154
var textArea = textEditor.TextArea;
@@ -179,7 +182,8 @@ private void InitializeTextEditor()
179182
KnownLayer.Text,
180183
LayerInsertionPosition.Above);
181184

182-
textArea.LeftMargins[0] = new BackgroundLineNumberPanel(textArea.TextView);
185+
LineNumberPanel = new BackgroundLineNumberPanel(textArea.TextView);
186+
textArea.LeftMargins[0] = LineNumberPanel;
183187
}
184188

185189
private void InitializeEvents()

Syndiesis/Core/DisplayAnalysis/BaseAnalysisNodeCreator.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,8 @@ protected static DisplayValueSource MethodSource(string name)
856856
return new(DisplayValueSource.SymbolKind.Method, name);
857857
}
858858

859-
protected static GroupedRunInline? CountDisplayRunGroup(object value)
859+
protected static GroupedRunInline? CountDisplayRunGroup<T>(T value)
860+
where T : notnull
860861
{
861862
switch (value)
862863
{
@@ -871,7 +872,8 @@ protected static DisplayValueSource MethodSource(string name)
871872
?? CountDisplayRunGroup(value, nameof(Array.Length));
872873
}
873874

874-
protected static GroupedRunInline? CountDisplayRunGroup(object value, string propertyName)
875+
protected static GroupedRunInline? CountDisplayRunGroup<T>(T value, string propertyName)
876+
where T : notnull
875877
{
876878
var type = value.GetType();
877879
var property = type.GetProperty(propertyName);

Syndiesis/Core/DisplayAnalysis/CSharpSyntaxAnalysisNodeCreator.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,10 @@ public sealed class SyntaxTriviaListRootViewNodeCreator(CSharpSyntaxAnalysisNode
10511051
public override AnalysisTreeListNodeLine CreateNodeLine(
10521052
SyntaxTriviaList list, GroupedRunInlineCollection inlines)
10531053
{
1054-
Creator.AppendSyntaxDetails(list, inlines);
1054+
Creator.AppendSyntaxTypeDetails(typeof(SyntaxTriviaList), inlines);
1055+
inlines.Add(CreateLargeSplitterRun());
1056+
var countDisplayRun = CountDisplayRunGroup(list)!;
1057+
inlines.Add(countDisplayRun);
10551058

10561059
return AnalysisTreeListNodeLine(
10571060
inlines,

Syndiesis/Views/MainView.axaml.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ private void PrepareQuickInfoShowing(QuickInfoHandler.PrepareShowingEventArgs e)
8585

8686
var editor = codeEditor.textEditor;
8787
var area = editor.TextArea;
88-
var areaPosition = pointerArgs.GetPosition(area);
89-
if (!area.Bounds.Contains(areaPosition))
88+
if (!area.ContainsPointer(pointerArgs))
89+
return;
90+
91+
if (codeEditor.LineNumberPanel.ContainsPointer(pointerArgs))
9092
return;
9193

9294
var editorPosition = pointerArgs.GetPosition(editor);

0 commit comments

Comments
 (0)