public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
        {
            if ( !settings.TextCompletionEnabled ) {
            return;
              }
              if ( session.TextView.TextBuffer != this.theBuffer ) {
            return;
              }
              if ( !PlainTextCompletionContext.IsSet(session) ) {
            return;
              }
              var snapshot = theBuffer.CurrentSnapshot;
              var triggerPoint = session.GetTriggerPoint(snapshot);
              if ( !triggerPoint.HasValue ) {
            return;
              }

              var applicableToSpan = GetApplicableToSpan(triggerPoint.Value);

              var then = this.bufferStatsOnCompletion;
              var now = new BufferStats(snapshot);
              if ( currentCompletions == null || now.SignificantThan(then) ) {
            this.currentCompletions = BuildCompletionsList();
            this.bufferStatsOnCompletion = now;
              }
              var set = new CompletionSet(
            moniker: "plainText",
            displayName: "Text",
            applicableTo: applicableToSpan,
            completions: currentCompletions,
            completionBuilders: null
            );
              completionSets.Add(set);
        }
 public bool SignificantThan(BufferStats then)
 {
     // if a change has added lines, rebuild it
     if (this.LineCount > then.LineCount)
     {
         return(true);
     }
     // has there been more than a 100 version changes?
     if ((this.Version - then.Version) > 100)
     {
         return(true);
     }
     return(false);
 }
        public void AugmentCompletionSession(ICompletionSession session, IList <CompletionSet> completionSets)
        {
            if (!settings.TextCompletionEnabled)
            {
                return;
            }
            if (session.TextView.TextBuffer != this.theBuffer)
            {
                return;
            }
            if (!PlainTextCompletionContext.IsSet(session))
            {
                return;
            }
            var snapshot     = theBuffer.CurrentSnapshot;
            var triggerPoint = session.GetTriggerPoint(snapshot);

            if (!triggerPoint.HasValue)
            {
                return;
            }

            var applicableToSpan = GetApplicableToSpan(triggerPoint.Value);

            var then = this.bufferStatsOnCompletion;
            var now  = new BufferStats(snapshot);

            if (currentCompletions == null || now.SignificantThan(then))
            {
                this.currentCompletions      = BuildCompletionsList();
                this.bufferStatsOnCompletion = now;
            }
            var set = new CompletionSet(
                moniker: "plainText",
                displayName: "Text",
                applicableTo: applicableToSpan,
                completions: currentCompletions,
                completionBuilders: null
                );

            completionSets.Add(set);
        }
 public bool SignificantThan(BufferStats then)
 {
     // if a change has added lines, rebuild it
     if ( this.LineCount > then.LineCount ) {
       return true;
     }
     // has there been more than a 100 version changes?
     if ( (this.Version - then.Version) > 100 ) {
       return true;
     }
     return false;
 }