本文整理汇总了C#中TextContentChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TextContentChangedEventArgs类的具体用法?C# TextContentChangedEventArgs怎么用?C# TextContentChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextContentChangedEventArgs类属于命名空间,在下文中一共展示了TextContentChangedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetTextBufferChange
private GherkinTextBufferChange GetTextBufferChange(TextContentChangedEventArgs textContentChangedEventArgs)
{
Tracing.VisualStudioTracer.Assert(textContentChangedEventArgs.Changes.Count > 0, "There are no text changes");
var startLine = int.MaxValue;
var endLine = 0;
var startPosition = int.MaxValue;
var endPosition = 0;
var lineCountDelta = 0;
var positionDelta = 0;
var beforeTextSnapshot = textContentChangedEventArgs.Before;
var afterTextSnapshot = textContentChangedEventArgs.After;
foreach (var change in textContentChangedEventArgs.Changes)
{
startLine = Math.Min(startLine, beforeTextSnapshot.GetLineNumberFromPosition(change.OldPosition));
endLine = Math.Max(endLine, afterTextSnapshot.GetLineNumberFromPosition(change.NewEnd));
startPosition = Math.Min(startPosition, change.OldPosition);
endPosition = Math.Max(endPosition, change.NewEnd);
lineCountDelta += change.LineCountDelta;
positionDelta += change.Delta;
}
return new GherkinTextBufferChange(
startLine == endLine ? GherkinTextBufferChangeType.SingleLine : GherkinTextBufferChangeType.MultiLine,
startLine, endLine,
startPosition, endPosition,
lineCountDelta, positionDelta,
afterTextSnapshot);
}
开发者ID:ChrisEdwards,项目名称:SpecFlow,代码行数:31,代码来源:GherkinLanguageServiceFactory.cs
示例2: OnBeforeTextBufferChanged
void OnBeforeTextBufferChanged(object sender, TextContentChangedEventArgs e)
{
foreach (var change in e.Changes)
{
var offset = change.NewLength - change.OldLength;
if (change.OldEnd < _span.Start)
{
_span = new Span(_span.Start + offset, _span.Length);
}
else if (change.OldPosition > _span.End)
{
}
else if (change.OldPosition == _span.End && _span.Length == 0)
{
_span = new Span(_span.Start, _span.Length + offset);
}
else if (_span.Contains(change.OldPosition) &&
(_span.Contains(change.OldEnd) || _span.End == change.OldEnd) &&
(_span.Contains(change.NewEnd) || _span.End == change.NewEnd))
{
_span = new Span(_span.Start, _span.Length + offset);
}
}
}
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:25,代码来源:TrackingSpanMock.cs
示例3: BufferChanged
static void BufferChanged(object sender, TextContentChangedEventArgs e)
{
if (!Settings.Default.DisableAllParsing)
{
BufferChanged(sender);
}
}
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:7,代码来源:BufferIdleEventUtil.cs
示例4: CombineChanges
/// <summary>
/// Combines multiple changes into one larger change.
/// </summary>
/// <param name="e">Text buffer change event argument</param>
/// <param name="start">Combined span start</param>
/// <param name="oldLength">Length of the change in the original buffer state</param>
/// <param name="newLength">Length of the change in the new buffer state</param>
internal static void CombineChanges(TextContentChangedEventArgs e, out int start, out int oldLength, out int newLength) {
start = 0;
oldLength = 0;
newLength = 0;
if (e.Changes.Count > 0) {
// Combine multiple changes into one larger change. The problem is that
// multiple changes map to one current snapshot and there are no
// separate snapshots for each change which causes problems
// in incremental parse analysis code.
Debug.Assert(e.Changes[0].OldPosition == e.Changes[0].NewPosition);
start = e.Changes[0].OldPosition;
int oldEnd = e.Changes[0].OldEnd;
int newEnd = e.Changes[0].NewEnd;
for (int i = 1; i < e.Changes.Count; i++) {
start = Math.Min(start, e.Changes[i].OldPosition);
oldEnd = Math.Max(oldEnd, e.Changes[i].OldEnd);
newEnd = Math.Max(newEnd, e.Changes[i].NewEnd);
}
oldLength = oldEnd - start;
newLength = newEnd - start;
}
}
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:34,代码来源:TextUtility.cs
示例5: TextBufferOnChanged
private void TextBufferOnChanged(object sender, TextContentChangedEventArgs ea)
{
Func<int, DateTime, IEnumerable<DateTime>> fill = (count, time) => Enumerable.Range(0, count).Select(t => time);
foreach (var textChange in ea.Changes)
{
var lineNumber = ea.Before.GetLineFromPosition(textChange.OldPosition).LineNumber;
if (textChange.LineCountDelta > 0)
{
var count =_lineTimeStamps.Count;
_lineTimeStamps.InsertRange(
Math.Min(lineNumber, count),
fill(textChange.LineCountDelta + lineNumber - count, DateTime.Now));
}
else if (textChange.LineCountDelta < 0)
{
try
{
_lineTimeStamps.RemoveRange(lineNumber, -textChange.LineCountDelta);
}
catch (ArgumentException)
{
_lineTimeStamps.Clear();
}
}
}
}
开发者ID:kazu46,项目名称:VSColorOutput,代码行数:28,代码来源:TimeStampMargin.cs
示例6: NewBufferChanged
private void NewBufferChanged(object sender, TextContentChangedEventArgs e)
{
bool isCommand = IsCommand(e.After.GetExtent());
ITextBuffer buffer = e.After.TextBuffer;
IContentType contentType = buffer.ContentType;
IContentType newContentType = null;
if (contentType == languageContentType)
{
if (isCommand)
{
newContentType = commandContentType;
}
}
else
{
if (!isCommand)
{
newContentType = languageContentType;
}
}
if (newContentType != null)
{
buffer.ChangeContentType(newContentType, editTag: null);
}
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:28,代码来源:InteractiveWindowCommands.cs
示例7: OnBufferChanged
private void OnBufferChanged(object sender, TextContentChangedEventArgs e)
{
foreach(ITextChange change in e.Changes)
{
_bufferChanges.Append(change.OldText);
}
}
开发者ID:ActualAdam,项目名称:EmacsKeys,代码行数:7,代码来源:BufferMonitor.cs
示例8: OnTextBufferChanged
private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
{
lock (_lockObject)
{
_currentParseCancellationTokenSource?.Cancel();
_hasWork.Set();
}
}
开发者ID:pminiszewski,项目名称:HlslTools,代码行数:8,代码来源:BackgroundParser.cs
示例9: BufferChanged
static void BufferChanged(object sender, TextContentChangedEventArgs e)
{
ITextBuffer buffer = sender as ITextBuffer;
if (buffer == null)
return;
RestartTimerForBuffer(buffer);
}
开发者ID:dbremner,项目名称:dafny,代码行数:8,代码来源:BufferIdleEventUtil.cs
示例10: RaiseChanged
protected virtual void RaiseChanged(TextContentChangedEventArgs textChangedEventArgs = null)
{
var changed = this.Changed;
if (changed != null)
{
changed(this, new TaggerEventArgs(EventKind, _delay, textChangedEventArgs));
}
}
开发者ID:GloryChou,项目名称:roslyn,代码行数:8,代码来源:AbstractTaggerEventSource.cs
示例11: TextBuffer_Changed
void TextBuffer_Changed(object sender, TextContentChangedEventArgs e)
{
if (e.After.LineCount != _ovlc.Count)
{
IsRedraw = true;
this.ReGenOv(e.After);
}
}
开发者ID:mintberry,项目名称:stackrecaller,代码行数:8,代码来源:OvCollection.cs
示例12: Buffer_Changed
private void Buffer_Changed(object sender, TextContentChangedEventArgs e)
{
AssertIsForeground();
if (!_buffer.GetOption(InternalFeatureOnOffOptions.RenameTracking))
{
// When disabled, ignore all text buffer changes and do not trigger retagging
return;
}
using (Logger.LogBlock(FunctionId.Rename_Tracking_BufferChanged, CancellationToken.None))
{
// When the buffer changes, several things might be happening:
// 1. If a non-identifer character has been added or deleted, we stop tracking
// completely.
// 2. Otherwise, if the changes are completely contained an existing session, then
// continue that session.
// 3. Otherwise, we're starting a new tracking session. Find and track the span of
// the relevant word in the foreground, and use a task to figure out whether the
// original word was a renamable identifier or not.
if (e.Changes.Count != 1 || ShouldClearTrackingSession(e.Changes.Single()))
{
ClearTrackingSession();
return;
}
// The change is trackable. Figure out whether we should continue an existing
// session
var change = e.Changes.Single();
if (this.TrackingSession == null)
{
StartTrackingSession(e);
return;
}
// There's an existing session. Continue that session if the current change is
// contained inside the tracking span.
SnapshotSpan trackingSpanInNewSnapshot = this.TrackingSession.TrackingSpan.GetSpan(e.After);
if (trackingSpanInNewSnapshot.Contains(change.NewSpan))
{
// Continuing an existing tracking session. If there may have been a tag
// showing, then update the tags.
if (this.TrackingSession.IsDefinitelyRenamableIdentifier())
{
this.TrackingSession.CheckNewIdentifier(this, _buffer.CurrentSnapshot);
TrackingSessionUpdated();
}
}
else
{
StartTrackingSession(e);
}
}
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:58,代码来源:RenameTrackingTaggerProvider.StateMachine.cs
示例13: TextBuffer_Changed
void TextBuffer_Changed(object sender, TextContentChangedEventArgs e)
{
if (_processing)
return;
_typedChar = '\0';
if (e.Changes.Count != 1 || e.AfterVersion.ReiteratedVersionNumber <= _bufferVersionWaterline)
return;
var change = e.Changes[0];
_bufferVersionWaterline = e.AfterVersion.ReiteratedVersionNumber;
// Change length may be > 1 in autoformatting languages.
// However, there will be only one non-ws character in the change.
// Be careful when </script> is inserted: the change won't
// actually be in this buffer.
var snapshot = _textBuffer.CurrentSnapshot;
if (change.NewSpan.End > snapshot.Length)
return;
var text = _textBuffer.CurrentSnapshot.GetText(change.NewSpan);
text = text.Trim();
if (text.Length != 1)
return;
// Allow completion of different characters inside spans, but not when
// character and its completion pair is the same. For example, we do
// want to complete () in foo(bar|) when user types ( after bar. However,
// we do not want to complete " when user is typing in a string which
// was already completed and instead " should be a terminating type-through.
var typedChar = text[0];
var completionChar = GetCompletionCharacter(typedChar);
var caretPosition = GetCaretPositionInBuffer();
if (!caretPosition.HasValue)
return;
bool compatible = true;
var innerText = GetInnerProvisionalText();
if (innerText != null)
compatible = IsCompatibleCharacter(innerText.ProvisionalChar, typedChar);
if (IsPositionInProvisionalText(caretPosition.Value) && typedChar == completionChar && !compatible)
return;
_typedChar = typedChar;
_caretPosition = caretPosition.Value;
}
开发者ID:ChrisTorng,项目名称:WebEssentials2013,代码行数:58,代码来源:TypeThroughController.cs
示例14: TaggerEventArgs
internal TaggerEventArgs(
string kind,
TaggerDelay delay,
TextContentChangedEventArgs textChangeEventArgs = null)
{
this.Kind = kind;
this.Delay = delay;
this.TextChangeEventArgs = textChangeEventArgs;
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:9,代码来源:TaggerEventArgs.cs
示例15: OnTextBufferChanged
private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
{
if (e.Changes.Count == 0)
{
return;
}
this.RaiseChanged();
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:9,代码来源:TaggerEventSources.TextChangedEventSource.cs
示例16: SubjectBufferChangedLowPriority
void SubjectBufferChangedLowPriority(object sender, TextContentChangedEventArgs e) {
var session = _curSession;
if (session == null || session.IsDismissed) {
return;
}
session.Dismiss();
Interlocked.CompareExchange(ref _curSession, null, session);
}
开发者ID:wenh123,项目名称:PTVS,代码行数:9,代码来源:SmartTagController.cs
示例17: TextBufferChanged
private void TextBufferChanged(object sender, TextContentChangedEventArgs changed) {
RemoveExistingHighlights();
if (changed.Changes.Count == 1) {
var newText = changed.Changes[0].NewText;
if (newText == ")" || newText == "}" || newText == "]") {
UpdateBraceMatching(changed.Changes[0].NewPosition + 1);
}
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:10,代码来源:BraceMatcher.cs
示例18: SourceTextChanged
private void SourceTextChanged(object sender, TextContentChangedEventArgs e)
{
if (this.enabled && e.Changes.Count > 0)
{
ITextChange firstChange = e.Changes[0];
ITextChange lastChange = e.Changes[e.Changes.Count - 1];
SnapshotSpan changedSpan = new SnapshotSpan(e.After, Span.FromBounds(firstChange.NewSpan.Start, lastChange.NewSpan.End));
UpdateAfterChange(changedSpan);
}
}
开发者ID:Kav2018,项目名称:JavaForVS,代码行数:10,代码来源:LanguageElementManager.cs
示例19: OnTextBufferChanged
void OnTextBufferChanged(object sender, TextContentChangedEventArgs e)
{
var handler = this.ClassificationChanged;
if (handler != null)
{
// For now raise the event for the entire changed buffer.
var span = new SnapshotSpan(_buffer.CurrentSnapshot, 0, _buffer.CurrentSnapshot.Length);
handler(this, new ClassificationChangedEventArgs(span));
}
}
开发者ID:modulexcite,项目名称:VsRstEditor,代码行数:11,代码来源:RstClassifier.cs
示例20: OnTextBufferChanged
protected virtual void OnTextBufferChanged(object sender, TextContentChangedEventArgs e) {
// In order to provide nicer experience when user presser and holds
// ENTER or DELETE or just types really fast, we are going to track
// regions optimistically and report changes without going through
// async or idle processing. Idle/async is still going to hit later.
if (e.Changes.Count > 0) {
int start, oldLength, newLength;
TextUtility.CombineChanges(e, out start, out oldLength, out newLength);
int changeStart = Int32.MaxValue;
int changeEnd = 0;
lock (_regionsLock) {
// Remove affected regions and shift the remaining ones. Outlining
// regions are not sorted and can overlap. Hence linear search.
for (int i = 0; i < CurrentRegions.Count; i++) {
var region = CurrentRegions[i];
if (region.End <= start) {
continue;
}
if (region.Contains(start) && region.Contains(start + oldLength)) {
region.Expand(0, newLength - oldLength);
} else if (region.Start >= start + oldLength) {
region.Shift(newLength - oldLength);
} else {
changeStart = Math.Min(changeStart, region.Start);
changeEnd = Math.Max(changeEnd, region.End);
CurrentRegions.RemoveAt(i);
i--;
if (e.Changes.Count > 0) {
// If we merged changes, this might be an overaggressive delete. Ensure
// that we'll do a full recalculation later.
BackgroundTask.DoTaskOnIdle();
}
}
}
}
// If there were previously any regions, make sure we notify our listeners of the changes
if ((CurrentRegions.Count > 0) || (changeStart < Int32.MaxValue)) {
CurrentRegions.TextBufferVersion = TextBuffer.CurrentSnapshot.Version.VersionNumber;
if (RegionsChanged != null) {
changeEnd = (changeStart == Int32.MaxValue ? changeStart : changeEnd);
RegionsChanged(this, new OutlineRegionsChangedEventArgs(CurrentRegions, TextRange.FromBounds(changeStart, changeEnd)));
}
}
}
}
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:54,代码来源:OutlineRegionBuilder.cs
注:本文中的TextContentChangedEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论