コード例 #1
0
 private void FindWordsInDocument()
 {
     lock (UpdateLock)
     {
         var findData = new FindData(_selectedWord.GetText(), _selectedWord.Snapshot)
         {
             FindOptions = FindOptions.WholeWord
         };
         SnapShotsToColor.AddRange(_textSearchService.FindAll(findData));
         ColorWords();
     }
 }
コード例 #2
0
 private void FindWordsInDocument()
 {
     lock (SelectionHighlight.UpdateLock)
     {
         Task.Factory.StartNew(() =>
         {
             var findData =
                 new FindData(_selectedWord.GetText(), _selectedWord.Snapshot)
             {
                 FindOptions = FindOptions.WholeWord
             };
             _glyphsToPlace.AddRange(_textSearchService.FindAll(findData));
         });
     }
 }
コード例 #3
0
        /// <summary>
        /// Update the specified <paramref name="span"/> to not include any leading or trailing whitespace characters.
        /// </summary>
        /// <param name="span">The span to trim.</param>
        protected static void TrimSpan(ref VirtualSnapshotSpan span)
        {
            string text   = span.GetText();
            int    length = text.Trim().Length;

            int offset = 0;

            while (offset < text.Length && char.IsWhiteSpace(text[offset]))
            {
                offset++;
            }

            if (offset > 0 || length != text.Length)
            {
                VirtualSnapshotPoint start = offset > 0 ? new VirtualSnapshotPoint(span.Start.Position + offset) : span.Start;

                bool removedSpacesFromEnd = length < text.Length - offset;
                VirtualSnapshotPoint end  = removedSpacesFromEnd ? new VirtualSnapshotPoint(start.Position + length) : span.End;

                span = new VirtualSnapshotSpan(start, end);
            }
        }
コード例 #4
0
ファイル: FormatCommenter.cs プロジェクト: modulexcite/vsbase
        /// <summary>
        /// Update the specified <paramref name="span"/> to not include any leading or trailing whitespace characters.
        /// </summary>
        /// <param name="span">The span to trim.</param>
        protected static void TrimSpan(ref VirtualSnapshotSpan span)
        {
            string text = span.GetText();
            int length = text.Trim().Length;

            int offset = 0;
            while (offset < text.Length && char.IsWhiteSpace(text[offset]))
                offset++;

            if (offset > 0 || length != text.Length)
            {
                VirtualSnapshotPoint start = offset > 0 ? new VirtualSnapshotPoint(span.Start.Position + offset) : span.Start;

                bool removedSpacesFromEnd = length < text.Length - offset;
                VirtualSnapshotPoint end = removedSpacesFromEnd ? new VirtualSnapshotPoint(start.Position + length) : span.End;

                span = new VirtualSnapshotSpan(start, end);
            }
        }