Skip to content

Commit

Permalink
Add logging for collecting completions to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
gasparnagy committed Jan 22, 2025
1 parent 784447c commit c0b1a8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class DeveroomCompletionSource : DeveroomCompletionSourceBase
private readonly ITagAggregator<DeveroomTag> _tagAggregator;

public DeveroomCompletionSource(ITextBuffer buffer, ITagAggregator<DeveroomTag> tagAggregator, IIdeScope ideScope)
: base("Reqnroll", buffer)
: base("Reqnroll", buffer, ideScope)
{
_tagAggregator = tagAggregator;
_ideScope = ideScope;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#nullable disable

using Reqnroll.VisualStudio.ProjectSystem;

namespace Reqnroll.VisualStudio.Editor.Completions.Infrastructure;

public abstract class DeveroomCompletionSourceBase : ICompletionSource
{
protected readonly ITextBuffer _buffer;
private readonly IIdeScope _ideScope;
private readonly string _name;

protected DeveroomCompletionSourceBase(string name, ITextBuffer buffer)
protected DeveroomCompletionSourceBase(string name, ITextBuffer buffer, IIdeScope ideScope)
{
_name = name;
_buffer = buffer;
_ideScope = ideScope;
}

public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
Expand All @@ -19,6 +23,7 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
if (snapshotTriggerPoint == null)
return;

var sw = Stopwatch.StartNew();
var completionResult = CollectCompletions(snapshotTriggerPoint.Value);
if (completionResult.Value.Count == 0)
return;
Expand All @@ -27,6 +32,8 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
if (applicableTo == null)
return;

_ideScope.Logger.Trace(sw, $"Completions collected in {sw.ElapsedMilliseconds} ms: {completionResult.Value.Count}");

completionSets.Add(new WordContainsFilteredCompletionSet(
_name,
_name,
Expand Down

0 comments on commit c0b1a8a

Please sign in to comment.