本文整理汇总了C#中MonoDevelop.Ide.Gui.TextEditor.GetTextAt方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditor.GetTextAt方法的具体用法?C# TextEditor.GetTextAt怎么用?C# TextEditor.GetTextAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Ide.Gui.TextEditor
的用法示例。
在下文中一共展示了TextEditor.GetTextAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsMatchAt
static bool IsMatchAt (TextEditor editor, int offset, string abbrevWord)
{
if (offset + abbrevWord.Length >= editor.Length)
return false;
if (offset > 0 && IsIdentifierPart (editor.GetCharAt (offset - 1)))
return false;
if (offset + abbrevWord.Length < editor.Length && !IsIdentifierPart (editor.GetCharAt (offset + abbrevWord.Length)))
return false;
return editor.GetTextAt (offset, abbrevWord.Length) == abbrevWord;
}
示例2: GetSymbolInfoAsync
public static Task<RefactoringSymbolInfo> GetSymbolInfoAsync (DocumentContext document, TextEditor editor, CancellationToken cancellationToken = default (CancellationToken))
{
if (editor.IsSomethingSelected) {
var selectionRange = editor.SelectionRange;
if (editor.GetTextAt (selectionRange).Any (ch => !char.IsLetterOrDigit (ch) && ch !='_')) {
return Task.FromResult (RefactoringSymbolInfo.Empty);
}
return GetSymbolInfoAsync (document, selectionRange.Offset, cancellationToken);
}
return GetSymbolInfoAsync (document, editor.CaretOffset, cancellationToken);
}
示例3: GetItem
public override async Task<TooltipItem> GetItem (TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default(CancellationToken))
{
if (offset >= editor.Length)
return null;
if (!DebuggingService.IsDebugging || DebuggingService.IsRunning)
return null;
StackFrame frame = DebuggingService.CurrentFrame;
if (frame == null)
return null;
var ed = CompileErrorTooltipProvider.GetExtensibleTextEditor (editor);
if (ed == null)
return null;
string expression = null;
int startOffset;
if (ed.IsSomethingSelected && offset >= ed.SelectionRange.Offset && offset <= ed.SelectionRange.EndOffset) {
startOffset = ed.SelectionRange.Offset;
expression = ed.SelectedText;
} else {
var doc = ctx;
if (doc == null || doc.ParsedDocument == null)
return null;
var resolver = doc.GetContent<IDebuggerExpressionResolver> ();
var data = doc.GetContent<SourceEditorView> ();
if (resolver != null) {
var result = await resolver.ResolveExpressionAsync (editor, doc, offset, token);
expression = result.Text;
startOffset = result.Span.Start;
} else {
int endOffset = data.GetTextEditorData ().FindCurrentWordEnd (offset);
startOffset = data.GetTextEditorData ().FindCurrentWordStart (offset);
expression = editor.GetTextAt (startOffset, endOffset - startOffset);
}
}
if (string.IsNullOrEmpty (expression))
return null;
var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
options.AllowMethodEvaluation = true;
options.AllowTargetInvoke = true;
var val = frame.GetExpressionValue (expression, options);
if (val == null || val.IsUnknown || val.IsNotSupported)
return null;
val.Name = expression;
return new TooltipItem (val, startOffset, expression.Length);
}
示例4: ChangeForeColor
public void ChangeForeColor(TextEditor editor, Chunk chunk, ref Cairo.Color color)
{
if (chunk.Length < 1)
return;
switch (chunk.Style)
{
case "Plain Text":
case "Plain Texta":
if (!hasEvaluatedBackgroundBrightness)
{
hasEvaluatedBackgroundBrightness = true;
IsDarkBackground = HslColor.Brightness(editor.ColorStyle.PlainText.Background) < 0.5;
}
color = DiffbasedHighlighting.GetColor(editor.GetTextAt(chunk).Trim());
if (IsDarkBackground)
color = new Cairo.Color(1.0 - color.R, 1.0 - color.G, 1.0 - color.B, color.A);
break;
case "String":
color = new Cairo.Color(0.8, 0, 0);
break;
default:
if (chunk.Style.StartsWith("Keyword"))
chunk.Style = "Plain Text";
break;
}
}