当前位置: 首页>>代码示例>>C#>>正文


C# TextEditor.GetTextAt方法代码示例

本文整理汇总了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;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:10,代码来源:DynamicAbbrevHandler.cs

示例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);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:11,代码来源:RefactoringSymbolInfo.cs

示例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);
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:57,代码来源:DebugValueTooltipProvider.cs

示例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;
                }
            }
开发者ID:foerdi,项目名称:Mono-D,代码行数:28,代码来源:DSyntaxMode.cs


注:本文中的MonoDevelop.Ide.Gui.TextEditor.GetTextAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。