Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Impl/EditorPrimitives')
-rw-r--r--src/Text/Impl/EditorPrimitives/DefaultBufferPrimitive.cs16
-rw-r--r--src/Text/Impl/EditorPrimitives/DefaultDisplayTextPointPrimitive.cs4
-rw-r--r--src/Text/Impl/EditorPrimitives/DefaultSelectionPrimitive.cs2
-rw-r--r--src/Text/Impl/EditorPrimitives/DefaultTextPointPrimitive.cs22
-rw-r--r--src/Text/Impl/EditorPrimitives/DefaultTextRangePrimitive.cs4
-rw-r--r--src/Text/Impl/EditorPrimitives/DefaultTextViewPrimitive.cs5
-rw-r--r--src/Text/Impl/EditorPrimitives/DefaultViewPrimitivesFactoryService.cs2
-rw-r--r--src/Text/Impl/EditorPrimitives/ViewPrimitives.cs4
8 files changed, 30 insertions, 29 deletions
diff --git a/src/Text/Impl/EditorPrimitives/DefaultBufferPrimitive.cs b/src/Text/Impl/EditorPrimitives/DefaultBufferPrimitive.cs
index 19923d5..9e383d9 100644
--- a/src/Text/Impl/EditorPrimitives/DefaultBufferPrimitive.cs
+++ b/src/Text/Impl/EditorPrimitives/DefaultBufferPrimitive.cs
@@ -30,7 +30,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if ((position < 0) || (position > _textBuffer.CurrentSnapshot.Length))
{
- throw new ArgumentOutOfRangeException("position");
+ throw new ArgumentOutOfRangeException(nameof(position));
}
return _bufferPrimitivesFactory.CreateTextPoint(this, position);
}
@@ -39,14 +39,14 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if ((line < 0) || (line > _textBuffer.CurrentSnapshot.LineCount))
{
- throw new ArgumentOutOfRangeException("line");
+ throw new ArgumentOutOfRangeException(nameof(line));
}
ITextSnapshotLine snapshotLine = _textBuffer.CurrentSnapshot.GetLineFromLineNumber(line);
if ((column < 0) || (column > snapshotLine.Length))
{
- throw new ArgumentOutOfRangeException("column");
+ throw new ArgumentOutOfRangeException(nameof(column));
}
return _bufferPrimitivesFactory.CreateTextPoint(this, snapshotLine.Start + column);
}
@@ -55,7 +55,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if ((line < 0) || (line > _textBuffer.CurrentSnapshot.LineCount))
{
- throw new ArgumentOutOfRangeException("line");
+ throw new ArgumentOutOfRangeException(nameof(line));
}
ITextSnapshotLine snapshotLine = _textBuffer.CurrentSnapshot.GetLineFromLineNumber(line);
@@ -67,11 +67,11 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if (startPoint == null)
{
- throw new ArgumentNullException("startPoint");
+ throw new ArgumentNullException(nameof(startPoint));
}
if (endPoint == null)
{
- throw new ArgumentNullException("endPoint");
+ throw new ArgumentNullException(nameof(endPoint));
}
if (!object.ReferenceEquals(startPoint.TextBuffer, this))
@@ -91,12 +91,12 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if ((startPosition < 0) || (startPosition > _textBuffer.CurrentSnapshot.Length))
{
- throw new ArgumentOutOfRangeException("startPosition");
+ throw new ArgumentOutOfRangeException(nameof(startPosition));
}
if ((endPosition < 0) || (endPosition > _textBuffer.CurrentSnapshot.Length))
{
- throw new ArgumentOutOfRangeException("endPosition");
+ throw new ArgumentOutOfRangeException(nameof(endPosition));
}
TextPoint startPoint = GetTextPoint(startPosition);
diff --git a/src/Text/Impl/EditorPrimitives/DefaultDisplayTextPointPrimitive.cs b/src/Text/Impl/EditorPrimitives/DefaultDisplayTextPointPrimitive.cs
index 0b64bc4..8ca865a 100644
--- a/src/Text/Impl/EditorPrimitives/DefaultDisplayTextPointPrimitive.cs
+++ b/src/Text/Impl/EditorPrimitives/DefaultDisplayTextPointPrimitive.cs
@@ -82,7 +82,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if (!object.ReferenceEquals(this.TextBuffer, otherPoint.TextBuffer))
{
- throw new ArgumentException("The other point must have the same TextBuffer as this one", "otherPoint");
+ throw new ArgumentException("The other point must have the same TextBuffer as this one", nameof(otherPoint));
}
return TextView.GetTextRange(this, otherPoint);
}
@@ -184,7 +184,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if (text == null)
{
- throw new ArgumentNullException("text");
+ throw new ArgumentNullException(nameof(text));
}
return _bufferPoint.InsertText(text);
diff --git a/src/Text/Impl/EditorPrimitives/DefaultSelectionPrimitive.cs b/src/Text/Impl/EditorPrimitives/DefaultSelectionPrimitive.cs
index 35231be..d9ce555 100644
--- a/src/Text/Impl/EditorPrimitives/DefaultSelectionPrimitive.cs
+++ b/src/Text/Impl/EditorPrimitives/DefaultSelectionPrimitive.cs
@@ -18,7 +18,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods;
- internal sealed class DefaultSelectionPrimitive : Selection
+ internal sealed class DefaultSelectionPrimitive : Text.Editor.LegacySelection
{
private TextView _textView;
private IEditorOptions _editorOptions;
diff --git a/src/Text/Impl/EditorPrimitives/DefaultTextPointPrimitive.cs b/src/Text/Impl/EditorPrimitives/DefaultTextPointPrimitive.cs
index be6d268..69088f7 100644
--- a/src/Text/Impl/EditorPrimitives/DefaultTextPointPrimitive.cs
+++ b/src/Text/Impl/EditorPrimitives/DefaultTextPointPrimitive.cs
@@ -37,7 +37,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
if ((position < 0) ||
(position > textBuffer.AdvancedTextBuffer.CurrentSnapshot.Length))
{
- throw new ArgumentOutOfRangeException("position");
+ throw new ArgumentOutOfRangeException(nameof(position));
}
_textBuffer = textBuffer;
@@ -78,7 +78,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
for (int i = 0; i < lineTextInfo.LengthInTextElements; i++)
{
string textElement = lineTextInfo.SubstringByTextElements(i, 1);
- if (textElement == "\t")
+ if (string.Equals(textElement, "\t", StringComparison.Ordinal))
{
// If there is a tab in the text, then the column automatically jumps
// to the next tab stop.
@@ -291,7 +291,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if (otherPoint == null)
{
- throw new ArgumentNullException("otherPoint");
+ throw new ArgumentNullException(nameof(otherPoint));
}
if (otherPoint.TextBuffer != TextBuffer)
@@ -306,7 +306,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if ((otherPosition < 0) || (otherPosition > TextBuffer.AdvancedTextBuffer.CurrentSnapshot.Length))
{
- throw new ArgumentOutOfRangeException("otherPosition");
+ throw new ArgumentOutOfRangeException(nameof(otherPosition));
}
TextPoint otherPoint = this.Clone();
@@ -354,7 +354,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if (text == null)
{
- throw new ArgumentNullException("text");
+ throw new ArgumentNullException(nameof(text));
}
if (text.Length > 0)
@@ -410,7 +410,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
newPoint.MoveTo(i);
string character = newPoint.GetNextCharacter();
- if (character != " " && character != "\t")
+ if (!string.Equals(character, " ", StringComparison.Ordinal) && !string.Equals(character, "\t", StringComparison.Ordinal))
{
break;
}
@@ -510,7 +510,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if ((lineNumber < 0) || (lineNumber > _textBuffer.AdvancedTextBuffer.CurrentSnapshot.LineCount))
{
- throw new ArgumentOutOfRangeException("lineNumber");
+ throw new ArgumentOutOfRangeException(nameof(lineNumber));
}
ITextSnapshot currentSnapshot = _textBuffer.AdvancedTextBuffer.CurrentSnapshot;
@@ -737,11 +737,11 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if (pattern == null)
{
- throw new ArgumentNullException("pattern");
+ throw new ArgumentNullException(nameof(pattern));
}
if (endPoint == null)
{
- throw new ArgumentNullException("endPoint");
+ throw new ArgumentNullException(nameof(endPoint));
}
if (endPoint.TextBuffer != TextBuffer)
{
@@ -769,7 +769,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
if ((position < 0) ||
(position > snapshot.Length))
{
- throw new ArgumentOutOfRangeException("position");
+ throw new ArgumentOutOfRangeException(nameof(position));
}
// If this is the end of the snapshot, we don't need to check anything.
@@ -872,7 +872,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
if ((lineNumber < 0) ||
(lineNumber > _textBuffer.AdvancedTextBuffer.CurrentSnapshot.LineCount))
{
- throw new ArgumentOutOfRangeException("lineNumber");
+ throw new ArgumentOutOfRangeException(nameof(lineNumber));
}
ITextSnapshotLine line = _textBuffer.AdvancedTextBuffer.CurrentSnapshot.GetLineFromLineNumber(lineNumber);
diff --git a/src/Text/Impl/EditorPrimitives/DefaultTextRangePrimitive.cs b/src/Text/Impl/EditorPrimitives/DefaultTextRangePrimitive.cs
index 961db4f..e0abb1b 100644
--- a/src/Text/Impl/EditorPrimitives/DefaultTextRangePrimitive.cs
+++ b/src/Text/Impl/EditorPrimitives/DefaultTextRangePrimitive.cs
@@ -167,7 +167,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
newChar = char.ToUpper(newChar, CultureInfo.CurrentCulture);
}
- if (!textEdit.Replace(i, 1, newChar.ToString()))
+ if (!textEdit.Replace(i, 1, newChar.ToString(CultureInfo.CurrentCulture)))
{
textEdit.Cancel();
return false; // break out early if any edit fails to reduce the time of the failure case
@@ -296,7 +296,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
if (string.IsNullOrEmpty(newText))
{
- throw new ArgumentNullException("newText");
+ throw new ArgumentNullException(nameof(newText));
}
int startPoint = _startPoint.CurrentPosition;
diff --git a/src/Text/Impl/EditorPrimitives/DefaultTextViewPrimitive.cs b/src/Text/Impl/EditorPrimitives/DefaultTextViewPrimitive.cs
index 80715de..4dca517 100644
--- a/src/Text/Impl/EditorPrimitives/DefaultTextViewPrimitive.cs
+++ b/src/Text/Impl/EditorPrimitives/DefaultTextViewPrimitive.cs
@@ -10,12 +10,13 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Formatting;
+ using LegacySelection = Microsoft.VisualStudio.Text.Editor.LegacySelection;
internal sealed class DefaultTextViewPrimitive : TextView
{
private ITextView _textView;
private Caret _caret;
- private Selection _selection;
+ private LegacySelection _selection;
private TextBuffer _textBuffer;
private IViewPrimitivesFactoryService _viewPrimitivesFactory;
@@ -144,7 +145,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
get { return _caret; }
}
- public override Selection Selection
+ public override LegacySelection Selection
{
get { return _selection; }
}
diff --git a/src/Text/Impl/EditorPrimitives/DefaultViewPrimitivesFactoryService.cs b/src/Text/Impl/EditorPrimitives/DefaultViewPrimitivesFactoryService.cs
index 09e9d25..99400b7 100644
--- a/src/Text/Impl/EditorPrimitives/DefaultViewPrimitivesFactoryService.cs
+++ b/src/Text/Impl/EditorPrimitives/DefaultViewPrimitivesFactoryService.cs
@@ -44,7 +44,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
return new DefaultDisplayTextRangePrimitive(textView, textRange);
}
- public Selection CreateSelection(TextView textView)
+ public LegacySelection CreateSelection(TextView textView)
{
if (textView.Selection == null)
{
diff --git a/src/Text/Impl/EditorPrimitives/ViewPrimitives.cs b/src/Text/Impl/EditorPrimitives/ViewPrimitives.cs
index 9b2b1dc..081fdb4 100644
--- a/src/Text/Impl/EditorPrimitives/ViewPrimitives.cs
+++ b/src/Text/Impl/EditorPrimitives/ViewPrimitives.cs
@@ -12,7 +12,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
internal sealed class ViewPrimitives : IViewPrimitives
{
private TextView _textView;
- private Selection _selection;
+ private LegacySelection _selection;
private Caret _caret;
private TextBuffer _textBuffer;
@@ -32,7 +32,7 @@ namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
get { return _textView; }
}
- public Selection Selection
+ public LegacySelection Selection
{
get { return _selection; }
}