Skip to content

Commit c0b1a8a

Browse files
committed
Add logging for collecting completions to be used
1 parent 784447c commit c0b1a8a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Reqnroll.VisualStudio/Editor/Completions/DeveroomCompletionSource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class DeveroomCompletionSource : DeveroomCompletionSourceBase
88
private readonly ITagAggregator<DeveroomTag> _tagAggregator;
99

1010
public DeveroomCompletionSource(ITextBuffer buffer, ITagAggregator<DeveroomTag> tagAggregator, IIdeScope ideScope)
11-
: base("Reqnroll", buffer)
11+
: base("Reqnroll", buffer, ideScope)
1212
{
1313
_tagAggregator = tagAggregator;
1414
_ideScope = ideScope;

Reqnroll.VisualStudio/Editor/Completions/Infrastructure/DeveroomCompletionSourceBase.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
#nullable disable
22

3+
using Reqnroll.VisualStudio.ProjectSystem;
4+
35
namespace Reqnroll.VisualStudio.Editor.Completions.Infrastructure;
46

57
public abstract class DeveroomCompletionSourceBase : ICompletionSource
68
{
79
protected readonly ITextBuffer _buffer;
10+
private readonly IIdeScope _ideScope;
811
private readonly string _name;
912

10-
protected DeveroomCompletionSourceBase(string name, ITextBuffer buffer)
13+
protected DeveroomCompletionSourceBase(string name, ITextBuffer buffer, IIdeScope ideScope)
1114
{
1215
_name = name;
1316
_buffer = buffer;
17+
_ideScope = ideScope;
1418
}
1519

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

26+
var sw = Stopwatch.StartNew();
2227
var completionResult = CollectCompletions(snapshotTriggerPoint.Value);
2328
if (completionResult.Value.Count == 0)
2429
return;
@@ -27,6 +32,8 @@ public void AugmentCompletionSession(ICompletionSession session, IList<Completio
2732
if (applicableTo == null)
2833
return;
2934

35+
_ideScope.Logger.Trace(sw, $"Completions collected in {sw.ElapsedMilliseconds} ms: {completionResult.Value.Count}");
36+
3037
completionSets.Add(new WordContainsFilteredCompletionSet(
3138
_name,
3239
_name,

0 commit comments

Comments
 (0)