Skip to content

Commit 2541170

Browse files
committed
Fix #419: Log editor IntelliSense duration
1 parent 40b9638 commit 2541170

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/PowerShellEditorServices/Language/AstOperations.cs

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace Microsoft.PowerShell.EditorServices
1515
{
16+
using System.Diagnostics;
1617
using System.Management.Automation;
1718
using System.Management.Automation.Language;
1819
using System.Management.Automation.Runspaces;
@@ -101,13 +102,20 @@ static public async Task<CommandCompletion> GetCompletions(
101102
{
102103
powerShell.Runspace = runspaceHandle.Runspace;
103104

105+
Stopwatch stopwatch = new Stopwatch();
106+
stopwatch.Start();
107+
104108
commandCompletion =
105109
CommandCompletion.CompleteInput(
106110
scriptAst,
107111
currentTokens,
108112
cursorPosition,
109113
null,
110114
powerShell);
115+
116+
stopwatch.Stop();
117+
118+
Logger.Write(LogLevel.Verbose, $"IntelliSense completed in {stopwatch.ElapsedMilliseconds}ms.");
111119
}
112120
}
113121

0 commit comments

Comments
 (0)