예제 #1
0
        void UpdateWordAdornments()
        {
            var currentRequest = RequestedPoint;
            var wordSpans      = new List <SnapshotSpan>();
            var word           = GetExtentOfWord(currentRequest);

            // Find all words in the buffer like the one the caret is on
            bool foundWord = true;

            // If we've selected something not worth highlighting, we might have missed a "word" by a little bit
            if (!WordExtentIsValid(currentRequest, word))
            {
                // Before we retry, make sure it is worthwhile
                if (word.Span.Start != currentRequest ||
                    currentRequest == currentRequest.GetContainingLine().Start ||
                    char.IsWhiteSpace((currentRequest - 1).GetChar()))
                {
                    foundWord = false;
                }
                else
                {
                    // Try again, one character previous.
                    // If the caret is at the end of a word, pick up the word.
                    word = GetExtentOfWord(currentRequest - 1);

                    // If the word still isn't valid, we're done
                    if (!WordExtentIsValid(currentRequest, word))
                    {
                        foundWord = false;
                    }
                }
            }

            SynchronousUpdate(currentRequest, new NormalizedSnapshotSpanCollection(), null);
            if (!foundWord)
            {
                return;
            }

            SnapshotSpan currentWord = word.Span;

            // If this is the current word, and the caret moved within a word, we're done.
            if (CurrentWord.HasValue && currentWord == CurrentWord)
            {
                return;
            }

            // If the word is not an identifier, then don't search for matches.
            if (!JScriptEditorUtil.IsClassifiedAs(Classifier, currentWord.Start, JScriptClassifications.Identifier))
            {
                return;
            }

            var request = new FindMatchesRequest {
                WordSpan = currentWord, RequestPoint = currentRequest
            };

            FindAllMatches(request);
        }
예제 #2
0
        void FindAllMatches(FindMatchesRequest request)
        {
            if (Timer != null)
            {
                Timer.Stop();
            }

            // Delay finding matches for 1 second
            Timer = new DispatcherTimer(DispatcherPriority.Background, ViewDispatcher)
            {
                Interval = TimeSpan.FromMilliseconds(1000)
            };
            Timer.Tick += (sender, args) =>
            {
                Timer.Stop();
                ThreadPool.QueueUserWorkItem(FindAllMatches_Background, request);
            };

            Timer.Start();
        }
예제 #3
0
        public async Task <IActionResult> PotentialMatches(FindMatchesRequest request)
        {
            var result = await _matchesService.FindPotentialMatches(request);

            return(Json(result));
        }
예제 #4
0
 public override void FindMatches(IRpcController controller, FindMatchesRequest request, Action<FindMatchesResponse> done)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public override void FindMatches(IRpcController controller, FindMatchesRequest request, Action <FindMatchesResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
예제 #6
0
 public override void FindMatches(IRpcController controller, FindMatchesRequest request, Action<FindMatchesResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
예제 #7
0
 public override void FindMatches(IRpcController controller, FindMatchesRequest request, Action <FindMatchesResponse> done)
 {
     throw new NotImplementedException();
 }