コード例 #1
0
        protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            ITreeNode node = _highlighting.AssociatedNode;

            using (node.CreateWriteLock()) {
                ITokenNode nextToken = node.GetNextToken();
                ITreeNode  end       = nextToken != null && nextToken.GetTokenType() == T4TokenNodeTypes.NewLine ? nextToken : node;
                ModificationUtil.DeleteChildRange(node, end);
            }
            return(null);
        }
コード例 #2
0
        /// <summary>
        /// Swaps a DocCommentNode to a CommentNode.
        /// </summary>
        /// <param name="currentNode">
        /// The node to process.
        /// </param>
        public void SwapDocCommentNodeToCommentNode(ITreeNode currentNode)
        {
            IDocCommentNode docCommentNode = currentNode as IDocCommentNode;

            // found a triple slash comment thats not in an ElementHeader
            if (docCommentNode != null)
            {
                string newText = string.Format("//{0}", docCommentNode.CommentText);
                ICommentNode newCommentNode =
                    (ICommentNode)
                    CSharpTokenType.END_OF_LINE_COMMENT.Create(new JB::JetBrains.Text.StringBuffer(newText), new TreeOffset(0), new TreeOffset(newText.Length));

                using (currentNode.CreateWriteLock())
                {
                    LowLevelModificationUtil.ReplaceChildRange(currentNode, currentNode, new ITreeNode[] { newCommentNode });
                }
            }
        }