Skip to content

Commit

Permalink
update: statement completion: truncate initializing existing statemen…
Browse files Browse the repository at this point in the history
…t completions if it takes more than maxTime
  • Loading branch information
HJLebbink committed Sep 14, 2016
1 parent 7e0665a commit b7353ad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Text.Adornments;

using IntrinsicsDude.Tools;
using static IntrinsicsDude.Tools.IntrinsicTools;
using System.Windows;
using Microsoft.VisualStudio.Text.Editor;
using System.Threading;
using Amib.Threading;

namespace IntrinsicsDude.StatementCompletion
{
Expand Down Expand Up @@ -134,10 +130,13 @@ private void init_Cached_Completions_method1(
ICompletionSession session,
string partialKeyword)
{

DateTime startTime = DateTime.Now;
string partialKeyword2 = (partialKeyword.Length < 2) ? "__" : partialKeyword.Substring(0, 2);
//IntrinsicsDudeToolsStatic.Output("INFO: StatementCompletionSource: init_Cached_Completions_method1: partialKeyword=" + partialKeyword+ "; partialKeyword2="+ partialKeyword2);

int nCompletionsAdded = 0;
int maxTimeMs = 1000;

foreach (Completion completion in existingCompletions.Completions)
{
string insertionText = completion.InsertionText;
Expand All @@ -150,10 +149,17 @@ private void init_Cached_Completions_method1(
{
//IntrinsicsDudeToolsStatic.Output("INFO: StatementCompletionSource: init_Cached_Completions: adding completion "+insertionText);
intrinsicCompletions.Add(this._statement_Completion_Store.get_Cached_Completion(completion));
nCompletionsAdded++;
if ((DateTime.Now.Ticks - startTime.Ticks) > (maxTimeMs * 10000))
{
IntrinsicsDudeToolsStatic.Output("Warning: StatementCompletionSource: Truncated initialization: took more than the maximum "+maxTimeMs+" ms to initialize " + nCompletionsAdded + " existing statement completions (of total "+ existingCompletions.Completions.Count +")");
break;
}
}
}
}
}
// IntrinsicsDudeToolsStatic.Output("INFO: StatementCompletionSource: initialized " + nCompletionsAdded + " existing statement completions of the total " + existingCompletions.Completions.Count);
}

private void init_Cached_Completions_method2(
Expand Down Expand Up @@ -189,7 +195,7 @@ private void init_Cached_Completions_method2(
string message = "Done Initializing Intrinsic Statement Completions. Sorry for that";
TextAdornment textAdornment = new TextAdornment((IWpfTextView)session.TextView, lineNumber, pos, message);
}
//IntrinsicsDudeToolsStatic.printSpeedWarning(startTime, "Init-Cached-Completions");
IntrinsicsDudeToolsStatic.printSpeedWarning(startTime, "Init-Cached-Completions");
}

private void addRegisterCompletions(ref List<Completion> completions, ReturnType returnType)
Expand Down
2 changes: 1 addition & 1 deletion VS/CSHARP/intrinsics-dude-vsix/source.extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ static class Vsix
public const string Name = "IntrinsicsDude";
public const string Description = "Improved Statement Completion, Quickinfo Tooltips and Signature Help for Compiler Intrinsics in Visual Studio 2015";
public const string Language = "en-US";
public const string Version = "1.1.1.1";
public const string Version = "1.1.1.3";
public const string Author = "Henk-Jan Lebbink";
public const string Tags = "Compiler Intrinsics, Statement Completion, Quickinfo Tooltips, Signature Help, AVX512";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="5BC76C2B-A941-40D2-9EB4-F0DB92DD7C06" Version="1.1.1.1" Language="en-US" Publisher="Henk-Jan Lebbink" />
<Identity Id="5BC76C2B-A941-40D2-9EB4-F0DB92DD7C06" Version="1.1.1.3" Language="en-US" Publisher="Henk-Jan Lebbink" />
<DisplayName>Intrinsics Dude</DisplayName>
<Description xml:space="preserve">Improved Statement Completion, Quickinfo Tooltips and Signature Help for Compiler Intrinsics in Visual Studio 2015</Description>
<MoreInfo>https://github.com/HJLebbink/intrinsics-dude</MoreInfo>
Expand Down

0 comments on commit b7353ad

Please sign in to comment.