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


C# ScintillaNet.GetText方法代码示例

本文整理汇总了C#中ScintillaNet.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# ScintillaNet.GetText方法的具体用法?C# ScintillaNet.GetText怎么用?C# ScintillaNet.GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScintillaNet的用法示例。


在下文中一共展示了ScintillaNet.GetText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleDotCompletion

		/// <summary>
		/// Complete object member
		/// </summary>
		/// <param name="Sci">Scintilla control</param>
		/// <param name="autoHide">Don't keep the list open if the word does not match</param>
		/// <returns>Auto-completion has been handled</returns>
		static private bool HandleDotCompletion(ScintillaNet.ScintillaControl Sci, bool autoHide)
		{
			// get expression at cursor position
			int position = Sci.CurrentPos;
			ASExpr expr = GetExpression(Sci, position);
			if (expr.Value == null)
				return true;
			int dotIndex = expr.Value.LastIndexOf('.');
			if (dotIndex == 0) return true;
			string tail = (dotIndex >= 0) ? expr.Value.Substring(dotIndex+1) : expr.Value;
			
			DebugConsole.Trace("? "+dotIndex+" '"+expr.separator+"' "+expr.Keyword+" ."+tail);
			// complete keyword
			if (dotIndex < 0)
			{
				if (expr.Keyword == "new") return HandleNewCompletion(Sci, expr.Value, autoHide);
				else if (expr.separator == ':') {
					if (HandleColonCompletion(Sci, expr.Value, autoHide)) return true;
				}
				else if (expr.Keyword == "import")
					return HandleImportCompletion(Sci, expr.Value, autoHide);
				else if ((expr.Keyword == "extends") || (expr.Keyword == "implements"))
					return HandleNewCompletion(Sci, expr.Value, autoHide);
			}
			else if ((expr.ContextBody == null) && (expr.separator != ':') && (expr.separator != '=')
			         && (expr.Keyword != "import") && (expr.Keyword != "extends") && (expr.Keyword != "implements") )
				return true;
			
			// complete declaration
			if ((expr.ContextBody == null) && 
			    ((expr.separator == ';') || (expr.separator == ' ') || (expr.separator == '}') || (expr.separator == '{')))
			{
				if (expr.Value.IndexOf('#') >= 0) return true;
				else 
				{
					string text = " "+ASClassParser.CleanClassSource(Sci.GetText(Sci.CurrentPos), null)+" ";
					if (Regex.IsMatch(text, "[\\s](class|interface)[\\s]"))
					{
						DebugConsole.Trace("Match class");
						Match m = Regex.Match(text, "[\\s](class|interface)[\\s]+"+ASContext.CurrentClass.ClassName+"[\\s{]");
						if (m.Success)
						{
							if (text.Substring(m.Index).IndexOf('{') > 0)
								return HandleDeclarationCompletion(Sci, "function private public static var", tail, autoHide);
							else if ((expr.Keyword != "extends") && (expr.Keyword != "implements"))
								return HandleDeclarationCompletion(Sci, "extends implements", tail, autoHide);
						}
						else return true;
					}
					else if (expr.Keyword == "class") return true;
					else if (dotIndex < 0) return HandleDeclarationCompletion(Sci, "import", tail, autoHide);
				}
			}
			
			DebugConsole.Trace("** Complete expression '"+expr.separator+"' "+expr.Value.Length);
			DebugConsole.Trace(expr.Value);
			
			// Context
			expr.LocalVars = ParseLocalVars(expr);
			ASClass cClass = ASContext.CurrentClass; 
			ASResult result;
			ASClass tmpClass;
			if (dotIndex > 0)
			{
				// Expression before cursor
				result = EvalExpression(expr.Value, expr, cClass, false);
				if (result.IsNull())
					return true;
				tmpClass = result.Class;
			}
			else 
			{
				result = new ASResult();
				tmpClass = cClass;
			}
			ASMemberList mix = new ASMemberList();
			// local vars are the first thing to try
			if ((result.IsNull() || (dotIndex < 0)) && (expr.ContextFunction != null)) 
				mix.Merge(expr.LocalVars);
			
			// packages
			if (tmpClass.Package != null)
				mix.Merge(tmpClass.Package);
			
			// get all members
			FlagType mask = 0;
			if ((expr.ContextFunction != null) || (expr.separator != ':'))
			{
				// user setting may ask to hide some members
				bool limitMembers = ASContext.HideIntrinsicMembers || (autoHide && !ASContext.AlwaysShowIntrinsicMembers);
				// static or dynamic members?
				if (!result.IsNull()) 
					mask = (result.IsStatic) ? FlagType.Static : FlagType.Dynamic;
				// show private member of current class only only 
//.........这里部分代码省略.........
开发者ID:heon21st,项目名称:flashdevelop,代码行数:101,代码来源:ASComplete.cs


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