Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Jul 3, 2024
1 parent cf22a8d commit 067bdbb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
30 changes: 18 additions & 12 deletions src/OneWare.Essentials/EditorExtensions/InlayHintGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,28 @@ public void ClearInlineHints()

public override int GetFirstInterestedOffset(int startOffset)
{
var index = _hints.BinarySearch(startOffset, (a, b) => a.CompareTo(b.Anchor.Offset));;
// var index = _hints.BinarySearch(startOffset, (a, b) => a.CompareTo(b.Anchor.Offset));;
//
// if (index < 0)
// index = ~index;
// if (index < _hints.Count)
// {
// return _hints[index].Anchor.Offset;
// }
//
// return -1;

if (index < 0)
index = ~index;
if (index < _hints.Count)
{
return _hints[index].Anchor.Offset;
}

return -1;
var element = _hints.FirstOrDefault(x => !x.Anchor.IsDeleted && x.Anchor.Offset >= startOffset);
return element?.Anchor.Offset ?? -1;
}

public override VisualLineElement? ConstructElement(int offset)
{
var index = _hints.BinarySearch(offset, (a, b) => a.CompareTo(b.Anchor.Offset));

return index < 0 ? null : new InlineObjectElement(0, _hints[index].Control);
// var index = _hints.BinarySearch(offset, (a, b) => a.CompareTo(b.Anchor.Offset));
//
// return index < 0 ? null : new InlineObjectElement(0, _hints[index].Control);

var element = _hints.FirstOrDefault(x => !x.Anchor.IsDeleted && x.Anchor.Offset == offset);
return element != null ? new InlineObjectElement(0, element.Control) : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public override Task ExecuteCommandAsync(Command cmd)
}
catch (Exception e)
{
ContainerLocator.Container.Resolve<ILogger>()?.Error(e.Message, e);
ContainerLocator.Container.Resolve<ILogger>()?.Error(e.Message, e, false);
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace OneWare.Essentials.LanguageService
/// </summary>
public abstract class TypeAssistanceLanguageService : TypeAssistanceBase
{
private readonly IBrush _highlightBackground = SolidColorBrush.Parse("#3300c8ff");

private bool _completionBusy;
private DispatcherTimer? _dispatcherTimer;
private TimeSpan _lastCompletionItemChangedTime = DateTime.Now.TimeOfDay;
Expand Down Expand Up @@ -549,8 +551,7 @@ private async Task GetDocumentHighlightAsync()
if (result is not null)
{
var segments = result.Select(x =>
x.Range.GenerateTextModification(Editor.CurrentDocument, null,
SolidColorBrush.Parse("#3300c8ff")))
x.Range.GenerateTextModification(Editor.CurrentDocument, null, _highlightBackground))
.ToArray();
Editor.Editor.ModificationService.SetModification("caretHighlight", segments);
}
Expand Down

0 comments on commit 067bdbb

Please sign in to comment.