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


C# IEditorData类代码示例

本文整理汇总了C#中IEditorData的典型用法代码示例。如果您正苦于以下问题:C# IEditorData类的具体用法?C# IEditorData怎么用?C# IEditorData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GenerateCompletionData

		/// <summary>
		/// Generates the completion data.
		/// </summary>
		/// <param name="alreadyCheckedCompletionContext">Set to <c>false</c> if you already ensured that completion can occur in the current editing context.</param>
		public static bool GenerateCompletionData(IEditorData editor, 
			ICompletionDataGenerator completionDataGen, char triggerChar, bool alreadyCheckedCompletionContext = false)
		{
			if(!alreadyCheckedCompletionContext && !IsCompletionAllowed(editor, triggerChar))
				return false;

			IBlockNode _b = null;
			bool inNonCode;

			var sr = FindCurrentCaretContext(editor, ref _b, out inNonCode);

			if (inNonCode)
				return false;

			if (_b == null || editor.CaretLocation > _b.EndLocation) {
				_b = editor.SyntaxTree;
			}

			var complVis = new CompletionProviderVisitor (completionDataGen, editor, triggerChar) { scopedBlock = _b };
			if (sr is INode)
				(sr as INode).Accept (complVis);
			else if (sr is IStatement)
				(sr as IStatement).Accept (complVis);
			else if (sr is IExpression)
				(sr as IExpression).Accept (complVis);

			if (complVis.GeneratedProvider == null)
				return false;

			complVis.GeneratedProvider.BuildCompletionData(editor, triggerChar);

			return true;
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:37,代码来源:CodeCompletion.cs

示例2: IsCompletionAllowed

		static bool IsCompletionAllowed(IEditorData Editor, char enteredChar)
		{/*'debug(', 'version(', 'pragma(' etc. shall trigger, but not 'foo('
			if (enteredChar == '(')
				return false;
			*/
			if (Editor.CaretOffset > 0)
			{
				if (Editor.CaretLocation.Line == 1 && Editor.ModuleCode.Length > 0 && Editor.ModuleCode[0] == '#')
					return false;

				if (enteredChar == '.' || enteredChar == '_')
				{
					// Don't complete on a double/multi-dot
					if (Editor.CaretOffset > 1 && Editor.ModuleCode[Editor.CaretOffset - 2] == enteredChar) 
						// ISSUE: When a dot was typed, off-1 is the dot position, 
						// if a letter was typed, off-1 is the char before the typed letter..
						return false;
				}
				// If typing a begun identifier, return immediately
				else if ((Lexer.IsIdentifierPart(enteredChar) || enteredChar == '\0') &&
					Lexer.IsIdentifierPart(Editor.ModuleCode[Editor.CaretOffset - 1]))
					return false;
			}

			return true;
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:26,代码来源:CodeCompletion.cs

示例3: Populate

        public void Populate(IEditorData data)
        {
            m_data = data;

            if (data == null)
            {
                m_value = null;
                return;
            }

            m_populating = true;
            PopulateList();

            object attr = data.GetAttribute(m_definition.Attribute);
            IEditableObjectReference value = attr as IEditableObjectReference;

            if (value == null)
            {
                lstDropdown.Text = string.Empty;
                lstDropdown.IsEnabled = (attr == null);
            }
            else
            {
                lstDropdown.SelectedItem = value.Reference;
                lstDropdown.IsEnabled = !data.ReadOnly;
            }

            m_value = value;

            m_populating = false;
        }
开发者ID:JatinR,项目名称:quest,代码行数:31,代码来源:DropDownObjectsControl.xaml.cs

示例4: BuildCompletionDataInternal

		protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
		{
			ed = Editor;
			ctxt = ResolutionContext.Create(Editor, false);

			AbstractType t = null;
			CodeCompletion.DoTimeoutableCompletionTask(CompletionDataGenerator,ctxt,() =>
			{
				try
				{
					ctxt.Push(Editor);
					if (AccessExpression is IExpression)
						t = ExpressionTypeEvaluation.EvaluateType(AccessExpression as IExpression, ctxt);
					else if (AccessExpression is ITypeDeclaration)
						t = TypeDeclarationResolver.ResolveSingle(AccessExpression as ITypeDeclaration, ctxt);
				}catch(Exception ex)
				{
					Logger.LogWarn("Error during member completion", ex);
				}
			});

			if (t == null) //TODO: Add after-space list creation when an unbound . (Dot) was entered which means to access the global scope
				return;

			t.Accept(this);
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:26,代码来源:MemberCompletionProvider.cs

示例5: IsCompletionAllowed

		public static bool IsCompletionAllowed(IEditorData Editor, char enteredChar)
		{
			if (Editor.CaretOffset > 0)
			{
				if (Editor.CaretLocation.Line == 1 && Editor.ModuleCode.Length > 0 && Editor.ModuleCode[0] == '#')
					return false;

				if (enteredChar == '.' || enteredChar == '_')
				{
					// Don't complete on a double/multi-dot
					if (Editor.CaretOffset > 1 && Editor.ModuleCode[Editor.CaretOffset - 2] == enteredChar) 
						// ISSUE: When a dot was typed, off-1 is the dot position, 
						// if a letter was typed, off-1 is the char before the typed letter..
						return false;
				}
				// If typing a begun identifier, return immediately
				else if ((DTokens.IsIdentifierChar(enteredChar) || enteredChar == '\0') &&
					DTokens.IsIdentifierChar(Editor.ModuleCode[Editor.CaretOffset - 1]))
					return false;

				return !CaretContextAnalyzer.IsInCommentAreaOrString(Editor.ModuleCode, Editor.CaretOffset);
			}

			return true;
		}
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:25,代码来源:CodeCompletion.cs

示例6: Populate

 public void Populate(IEditorData data)
 {
     if (data == null) return;
     m_helper.StartPopulating();
     textBox.Text = m_helper.Populate(data);
     m_helper.FinishedPopulating();
 }
开发者ID:JatinR,项目名称:quest,代码行数:7,代码来源:GameIdControl.xaml.cs

示例7: BuildCompletionDataInternal

		protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
		{
			if(Editor.ParseCache == null)
				return;

			string pack = null;

			if (imp.ModuleIdentifier != null && imp.ModuleIdentifier.InnerDeclaration != null)
			{
				pack = imp.ModuleIdentifier.InnerDeclaration.ToString();

				// Will occur after an initial dot  
				if (string.IsNullOrEmpty(pack))
					return;
			}

			foreach (var p in Editor.ParseCache.LookupPackage(Editor.SyntaxTree, pack))
			{
				if (p == null)
					continue;

				foreach (var kv_pack in p.Packages)
					CompletionDataGenerator.AddPackage(kv_pack.Value.Name);

				foreach (var kv_mod in p.Modules)
					CompletionDataGenerator.AddModule(kv_mod.Value);
			}
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:28,代码来源:ImportStatementCompletionProvider.cs

示例8: GetSelectedSymbolRoot

        static string GetSelectedSymbolRoot(IEditorData edData)
        {
            var o = DResolver.GetScopedCodeObject(edData,null, DResolver.AstReparseOptions.AlsoParseBeyondCaret);

            if (o is ITypeDeclaration)
            {
                var rootType = ((ITypeDeclaration)o).InnerMost;

                if (rootType is IdentifierDeclaration)
                    return ((IdentifierDeclaration)rootType).Id;
                else if (rootType is TemplateInstanceExpression)
                    return ((TemplateInstanceExpression)rootType).TemplateIdentifier.Id;
            }
            else if (o is IExpression)
            {
                var curEx = (IExpression)o;

                while (curEx is PostfixExpression)
                    curEx = ((PostfixExpression)curEx).PostfixForeExpression;

                if (curEx is IdentifierExpression)
                    return ((IdentifierExpression)curEx).Value as string;
                else if (curEx is TemplateInstanceExpression)
                    return ((TemplateInstanceExpression)curEx).TemplateIdentifier.Id;
            }
            return null;
        }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:27,代码来源:SymbolImportRefactoring.cs

示例9: BuildCompletionDataInternal

 protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
 {
     foreach (var kv in new Dictionary<string, string>{
         {"isArithmetic","If the arguments are all either types that are arithmetic types, or expressions that are typed as arithmetic types, then true is returned. Otherwise, false is returned. If there are no arguments, false is returned."},
         {"isFloating","Works like isArithmetic, except it's for floating point types (including imaginary and complex types)."},
         {"isIntegral","Works like isArithmetic, except it's for integral types (including character types)."},
         {"isScalar","Works like isArithmetic, except it's for scalar types."},
         {"isUnsigned","Works like isArithmetic, except it's for unsigned types."},
         {"isStaticArray","Works like isArithmetic, except it's for static array types."},
         {"isAssociativeArray","Works like isArithmetic, except it's for associative array types."},
         {"isAbstractClass","If the arguments are all either types that are abstract classes, or expressions that are typed as abstract classes, then true is returned. Otherwise, false is returned. If there are no arguments, false is returned."},
         {"isFinalClass","Works like isAbstractClass, except it's for final classes."},
         {"isVirtualFunction","The same as isVirtualMethod, except that final functions that don't override anything return true."},
         {"isVirtualMethod","Takes one argument. If that argument is a virtual function, true is returned, otherwise false. Final functions that don't override anything return false."},
         {"isAbstractFunction","Takes one argument. If that argument is an abstract function, true is returned, otherwise false."},
         {"isFinalFunction","Takes one argument. If that argument is a final function, true is returned, otherwise false."},
         {"isStaticFunction","Takes one argument. If that argument is a static function, meaning it has no context pointer, true is returned, otherwise false."},
         {"isRef","Takes one argument. If that argument is a declaration, true is returned if it is ref, otherwise false."},
         {"isOut","Takes one argument. If that argument is a declaration, true is returned if it is out, otherwise false."},
         {"isLazy","Takes one argument. If that argument is a declaration, true is returned if it is lazy, otherwise false."},
         {"hasMember","The first argument is a type that has members, or is an expression of a type that has members. The second argument is a string. If the string is a valid property of the type, true is returned, otherwise false."},
         {"identifier","Takes one argument, a symbol. Returns the identifier for that symbol as a string literal."},
         {"getMember","Takes two arguments, the second must be a string. The result is an expression formed from the first argument, followed by a ‘.’, followed by the second argument as an identifier."},
         {"getOverloads","The first argument is a class type or an expression of class type. The second argument is a string that matches the name of one of the functions of that class. The result is a tuple of all the overloads of that function."},
         {"getVirtualFunctions","The same as getVirtualMethods, except that final functions that do not override anything are included."},
         {"getVirtualMethods","The first argument is a class type or an expression of class type. The second argument is a string that matches the name of one of the functions of that class. The result is a tuple of the virtual overloads of that function. It does not include final functions that do not override anything."},
         {"parent","Takes a single argument which must evaluate to a symbol. The result is the symbol that is the parent of it."},
         {"classInstanceSize","Takes a single argument, which must evaluate to either a class type or an expression of class type. The result is of type size_t, and the value is the number of bytes in the runtime instance of the class type. It is based on the static type of a class, not the polymorphic type."},
         {"allMembers","Takes a single argument, which must evaluate to either a type or an expression of type. A tuple of string literals is returned, each of which is the name of a member of that type combined with all of the members of the base classes (if the type is a class). No name is repeated. Builtin properties are not included."},
         {"derivedMembers","Takes a single argument, which must evaluate to either a type or an expression of type. A tuple of string literals is returned, each of which is the name of a member of that type. No name is repeated. Base class member names are not included. Builtin properties are not included."},
         {"isSame","Takes two arguments and returns bool true if they are the same symbol, false if not."},
         {"compiles",@"Returns a bool true if all of the arguments compile (are semantically correct). The arguments can be symbols, types, or expressions that are syntactically correct. The arguments cannot be statements or declarations. If there are no arguments, the result is false."},
     })
         CompletionDataGenerator.AddTextItem(kv.Key, kv.Value);
 }
开发者ID:DinrusGroup,项目名称:DRC,代码行数:35,代码来源:AttributeCompletionProvider.cs

示例10: Populate

 public void Populate(IEditorData data)
 {
     if (data == null) return;
     m_helper.StartPopulating();
     if (m_dictionary != null)
     {
         string value = m_helper.Populate(data) ?? string.Empty;
         string dropdownValue;
         if (m_dictionary.TryGetValue(value, out dropdownValue))
         {
             lstDropdown.Text = dropdownValue;
         }
         else
         {
             if (lstDropdown.IsEditable)
             {
                 lstDropdown.Text = value;
             }
             else
             {
                 lstDropdown.Text = string.Empty;
             }
         }
     }
     else
     {
         lstDropdown.Text = m_helper.Populate(data);
     }
     lstDropdown.IsEnabled = m_helper.CanEdit(data) && !data.ReadOnly;
     m_helper.FinishedPopulating();
 }
开发者ID:Pertex,项目名称:Quest,代码行数:31,代码来源:DropDownControl.xaml.cs

示例11: FindCurrentCaretContext

        public static ISyntaxRegion FindCurrentCaretContext(IEditorData editor, 
			ref IBlockNode currentScope, 
			out IStatement currentStatement,
			out bool isInsideNonCodeSegment)
        {
            isInsideNonCodeSegment = false;
            currentStatement = null;

            if(currentScope == null)
                currentScope = DResolver.SearchBlockAt (editor.SyntaxTree, editor.CaretLocation, out currentStatement);

            if (currentScope == null)
                return null;

            BlockStatement blockStmt;
            // Always skip lambdas as they're too quirky for accurate scope calculation // ISSUE: May be other anon symbols too?
            var dm = currentScope as DMethod;
            if (dm != null && (dm.SpecialType & DMethod.MethodType.Lambda) != 0)
                currentScope = dm.Parent as IBlockNode;

            if (currentScope is DMethod &&
                (blockStmt = (currentScope as DMethod).GetSubBlockAt (editor.CaretLocation)) != null) {
                blockStmt.UpdateBlockPartly (editor, out isInsideNonCodeSegment);
                currentScope = DResolver.SearchBlockAt (currentScope, editor.CaretLocation, out currentStatement);
            }else {
                while (currentScope is DMethod)
                    currentScope = currentScope.Parent as IBlockNode;
                if (currentScope == null)
                    return null;

                (currentScope as DBlockNode).UpdateBlockPartly (editor, out isInsideNonCodeSegment);
                currentScope = DResolver.SearchBlockAt (currentScope, editor.CaretLocation, out currentStatement);
            }
            return currentScope;
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:35,代码来源:CodeCompletion.cs

示例12: BuildCompletionDataInternal

		protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
		{
			var visibleMembers = MemberFilter.All;

			if(!GetVisibleMemberFilter(Editor, enteredChar, ref visibleMembers, ref curStmt))
				return;

			MemberCompletionEnumeration.EnumAllAvailableMembers(
					CompletionDataGenerator,
					curBlock,
					curStmt,
					Editor.CaretLocation,
					Editor.ParseCache,
					visibleMembers,
					new ConditionalCompilationFlags(Editor));

			//TODO: Split the keywords into such that are allowed within block statements and non-block statements
			// Insert typable keywords
			if (visibleMembers.HasFlag(MemberFilter.Keywords))
				foreach (var kv in DTokens.Keywords)
					CompletionDataGenerator.Add(kv.Key);

			else if (visibleMembers.HasFlag(MemberFilter.StructsAndUnions))
				foreach (var kv in DTokens.BasicTypes_Array)
					CompletionDataGenerator.Add(kv);
		}
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:26,代码来源:CtrlSpaceCompletionProvider.cs

示例13: BuildCompletionDataInternal

        protected override void BuildCompletionDataInternal(IEditorData Editor, char enteredChar)
        {
            var dc = begunNode.Parent as DClassLike;

            if (dc == null || dc.ClassType != DTokens.Class)
                return;

            var classType = DResolver.ResolveClassOrInterface(dc, ResolutionContext.Create(Editor), null) as TemplateIntermediateType;

            if (classType == null)
                return;

            var typesToScan = new List<TemplateIntermediateType>();
            IterateThroughBaseClassesInterfaces(typesToScan, classType);

            foreach (var t in typesToScan)
            {
                foreach (var n in t.Definition)
                {
                    var dm = n as DMethod;
                    if (dm == null ||
                        dm.ContainsAttribute(DTokens.Final, DTokens.Private, DTokens.Static))
                        continue; //TODO: Other attributes?

                    CompletionDataGenerator.AddCodeGeneratingNodeItem(dm, GenerateOverridingMethodStub(dm, begunNode, !(t is InterfaceType)));
                }
            }
        }
开发者ID:Extrawurst,项目名称:D_Parser,代码行数:28,代码来源:MethodOverrideCompletionProvider.cs

示例14: CompletionProviderVisitor

		public CompletionProviderVisitor(ICompletionDataGenerator cdg, IEditorData ed, char enteredChar = '\0')
		{
			this.ed = ed;
			this.cdgen = cdg;
			this.triggerChar = enteredChar;
			this.shownKeywords.Push(BlockMemberFilter);
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:7,代码来源:CompletionProviderVisitor.cs

示例15: Populate

        public void Populate(IEditorData data)
        {
            m_readOnly = data != null && data.ReadOnly;
            cmdAdd.Enabled = !m_readOnly;
            cmdAddType.Enabled = !m_readOnly;

            lstAttributes.Items.Clear();
            lstTypes.Items.Clear();
            m_inheritedTypeData.Clear();
            ClearListenedToAttributes();
            cmdDelete.Enabled = false;
            cmdOnChange.Enabled = false;
            cmdDeleteType.Enabled = false;
            ctlMultiControl.Visible = false;
            m_data = (IEditorDataExtendedAttributeInfo)data;

            if (data != null)
            {
                foreach (var type in m_data.GetInheritedTypes())
                {
                    m_inheritedTypeData.Add(type.AttributeName, type);
                    AddListItem(lstTypes, type, GetTypeDisplayString);
                }

                foreach (var attr in m_data.GetAttributeData())
                {
                    if (CanDisplayAttribute(attr.AttributeName, m_data.GetAttribute(attr.AttributeName), attr.Source != m_data.Name))
                    {
                        AddListItem(lstAttributes, attr, GetAttributeDisplayString);
                        ListenToAttribute(attr);
                    }
                }
            }
        }
开发者ID:JatinR,项目名称:quest,代码行数:34,代码来源:WFAttributesControl.cs


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