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


C# ICompletionData.InsertAction方法代码示例

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


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

示例1: InsertAction

        public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
        {
            textArea.Caret.Position = textArea.Document.OffsetToPosition(
                Math.Min(insertionOffset, textArea.Document.TextLength));

            return data.InsertAction(textArea, key);
        }
开发者ID:tormaroe,项目名称:Ping-Ring,代码行数:7,代码来源:CodeCompletionProvider.cs

示例2: InsertAction

        public virtual bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
        {
            if (InsertSpace)
            {
                textArea.Document.Insert(insertionOffset++, " ");
            }
            textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);

            return data.InsertAction(textArea, key);
        }
开发者ID:FelicePollano,项目名称:Fatica.Labs.XmlEditor,代码行数:10,代码来源:AbstractCompletionDataProvider.cs

示例3: InsertAction

		/// <summary>
		/// Called when entry should be inserted. Forward to the insertion action of the completion data.
		/// </summary>
		public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key) {
			int endOffset = insertionOffset;
			LineSegment line = textArea.Document.GetLineSegment(textArea.Caret.Line);
			// Try to find the last word and replace it
			if (insertionOffset != 0) {
				// insertionOffset represent the current Caret, so this isnt needed
				// But just in case..
				if (textArea.Caret.Column > 0) {
					TextWord word = line.GetWord(textArea.Caret.Column - 1);
					if (word != null) {
						// Nothing todo?
						if (word.Word == data.Text) {
							data.Text = "";
						} else {
							// cap insert data
							data.Text = data.Text.Substring(word.Length);
						}
					}
				}
			}

			return data.InsertAction(textArea, key);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:26,代码来源:ScriptCompletionProvider.cs

示例4: InsertAction

        /// <summary>
        /// Inserts the selected completion value.
        /// </summary>
        /// <remarks>
        /// If we are closing a tag, we request a reformatting of the line.
        /// </remarks>
        /// <param name="p_cdtData">The code completion selection that was chosen.</param>
        /// <param name="p_txaTextArea">The area containing the document being edited.</param>
        /// <param name="p_intInsertionOffset">Where the selection should be inserted into the document.</param>
        /// <param name="p_chrKey">The character that was used to choose this completion selection.</param>
        /// <returns><lang cref="true"/> if the insertion of <paramref name="p_chrKey"/> was handled;
        /// <lang cref="false"/> otherwise.</returns>
        public bool InsertAction(ICompletionData p_cdtData, TextArea p_txaTextArea, int p_intInsertionOffset, char p_chrKey)
        {
            p_txaTextArea.Caret.Position = p_txaTextArea.Document.OffsetToPosition(p_intInsertionOffset);
            bool booInserted = p_cdtData.InsertAction(p_txaTextArea, p_chrKey);

            if (p_cdtData.Text.StartsWith("/"))
            {
                p_txaTextArea.Document.FormattingStrategy.IndentLine(p_txaTextArea, p_txaTextArea.Caret.Position.Line);
                if (p_chrKey == '/')
                    return true;
            }
            return booInserted;
        }
开发者ID:BioBrainX,项目名称:fomm,代码行数:25,代码来源:XmlCompletionProvider.cs

示例5: InsertAction

        /// <summary>
        /// Called when entry should be inserted. Forward to the insertion action of the completion data.
        /// </summary>
        public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
        {
            textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
            if (!(data as UserDefaultCompletionData).IsOnOverrideWindow)
            {
                int ind = data.Text.IndexOf('<');
                if (ind != -1 && data.Text.Length > ind + 1 && data.Text[ind + 1] == '>') data.Text = data.Text.Substring(0, ind);
            }
            else
                data.Text = data.Description;

            return data.InsertAction(textArea, key);
        }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:16,代码来源:CodeCompletionProvider.cs

示例6: InsertAction

        public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
        {
            if (this.InsertSpace)
            {
                textArea.Document.Insert(insertionOffset++, " ");
            }
            textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);

            var res = data.InsertAction(textArea, key);
            var fdoComp = (FdoCompletionData)data;
            if (fdoComp.ImageIndex == 0 && fdoComp.AppendText.Length > 2) //Function and not an empty function call
            {
                //Rewind caret so it is at the start of the function call (at first parameter)
                var offset = textArea.Caret.Offset;
                offset -= (fdoComp.AppendText.Length - 1);
                textArea.Caret.Position = textArea.Document.OffsetToPosition(offset);
                textArea.SelectionManager.ClearSelection();
                textArea.SelectionManager.SetSelection(textArea.Caret.Position, textArea.Document.OffsetToPosition(offset + (fdoComp.HighlightLength - 1)));
            }
            return res;
        }
开发者ID:kanbang,项目名称:Colt,代码行数:21,代码来源:FdoExpressionCompletionDataProvider.cs

示例7: InsertAction

 /// <summary>
 /// Called when entry should be inserted. Forward to the insertion action of the completion data.
 /// </summary>
 public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
 {
     textArea.SelectionManager.SetSelection(textArea.Document.OffsetToPosition(
         Math.Min(insertionOffset - ((AEGISCompletionData)data).Expression.Length, textArea.Document.TextLength)
         ), textArea.Caret.Position);
     return data.InsertAction(textArea, key);
 }
开发者ID:scriptord3,项目名称:RagnarokNPCEditor,代码行数:10,代码来源:CodeCompletionProvider.cs


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