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


Java ForeignLeafPsiElement类代码示例

本文整理汇总了Java中com.intellij.psi.impl.source.tree.ForeignLeafPsiElement的典型用法代码示例。如果您正苦于以下问题:Java ForeignLeafPsiElement类的具体用法?Java ForeignLeafPsiElement怎么用?Java ForeignLeafPsiElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ForeignLeafPsiElement类属于com.intellij.psi.impl.source.tree包,在下文中一共展示了ForeignLeafPsiElement类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMatchingLength

import com.intellij.psi.impl.source.tree.ForeignLeafPsiElement; //导入依赖的package包/类
private static int getMatchingLength(@NotNull FileElement treeElement, @NotNull CharSequence text, boolean fromStart) {
  int patternIndex = fromStart ? 0 : text.length() - 1;
  int finalPatternIndex = fromStart ? text.length() - 1 : 0;
  int direction = fromStart ? 1 : -1;
  ASTNode leaf = fromStart ? TreeUtil.findFirstLeaf(treeElement, false) : TreeUtil.findLastLeaf(treeElement, false);
  int result = 0;
  while (leaf != null && (fromStart ? patternIndex <= finalPatternIndex : patternIndex >= finalPatternIndex)) {
    if (!(leaf instanceof ForeignLeafPsiElement)) {
      CharSequence chars = leaf.getChars();
      if (chars.length() > 0) {
        int matchingLength = getLeafMatchingLength(chars, text, patternIndex, finalPatternIndex, direction);
        result += matchingLength;
        if (matchingLength != chars.length()) {
          break;
        }
        patternIndex += (fromStart ? matchingLength : -matchingLength);
      }
    }
    leaf = fromStart ? TreeUtil.nextLeaf(leaf, false) : TreeUtil.prevLeaf(leaf, false);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DocumentCommitProcessor.java

示例2: visitLeaf

import com.intellij.psi.impl.source.tree.ForeignLeafPsiElement; //导入依赖的package包/类
@Override
public void visitLeaf(LeafElement leaf) {
  String leafText = leaf instanceof ForeignLeafPsiElement ? "" : leaf.getText();
  catLeafs.append(leafText);
  final TextRange leafRange = leaf.getTextRange();

  StringBuilder leafEncodedText = constructTextFromHostPSI(leafRange.getStartOffset(), leafRange.getEndOffset());

  if (leaf.getElementType() == TokenType.WHITE_SPACE && prevElementTail != null) {
    // optimization: put all garbage into whitespace
    leafEncodedText.insert(0, prevElementTail);
    newTexts.remove(prevElement);
    storeUnescapedTextFor(prevElement, null);
  }
  if (!Comparing.equal(leafText, leafEncodedText)) {
    newTexts.put(leaf, leafEncodedText.toString());
    storeUnescapedTextFor(leaf, leafText);
  }
  prevElementTail = StringUtil.startsWith(leafEncodedText, leafText) && leafEncodedText.length() != leafText.length() ?
                    leafEncodedText.substring(leafText.length()) : null;
  prevElement = leaf;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LeafPatcher.java

示例3: getMatchingLength

import com.intellij.psi.impl.source.tree.ForeignLeafPsiElement; //导入依赖的package包/类
private static int getMatchingLength(@Nonnull FileElement treeElement, @Nonnull CharSequence text, boolean fromStart) {
  int patternIndex = fromStart ? 0 : text.length() - 1;
  int finalPatternIndex = fromStart ? text.length() - 1 : 0;
  int direction = fromStart ? 1 : -1;
  ASTNode leaf = fromStart ? TreeUtil.findFirstLeaf(treeElement, false) : TreeUtil.findLastLeaf(treeElement, false);
  int result = 0;
  while (leaf != null && (fromStart ? patternIndex <= finalPatternIndex : patternIndex >= finalPatternIndex)) {
    if (!(leaf instanceof ForeignLeafPsiElement)) {
      CharSequence chars = leaf.getChars();
      if (chars.length() > 0) {
        int matchingLength = getLeafMatchingLength(chars, text, patternIndex, finalPatternIndex, direction);
        result += matchingLength;
        if (matchingLength != chars.length()) {
          break;
        }
        patternIndex += fromStart ? matchingLength : -matchingLength;
      }
    }
    leaf = fromStart ? TreeUtil.nextLeaf(leaf, false) : TreeUtil.prevLeaf(leaf, false);
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ChangedPsiRangeUtil.java

示例4: visitElement

import com.intellij.psi.impl.source.tree.ForeignLeafPsiElement; //导入依赖的package包/类
@Override
public void visitElement(PsiElement element) {
  if (!(element instanceof ForeignLeafPsiElement) && element.isPhysical()) {
    super.visitElement(element);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:PsiVisitors.java

示例5: createLeafNode

import com.intellij.psi.impl.source.tree.ForeignLeafPsiElement; //导入依赖的package包/类
@Override
@NotNull
public ASTNode createLeafNode(CharSequence leafText) {
  return new ForeignLeafPsiElement(this, getValue());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ForeignLeafType.java

示例6: createLeafNode

import com.intellij.psi.impl.source.tree.ForeignLeafPsiElement; //导入依赖的package包/类
@Override
@Nonnull
public ASTNode createLeafNode(CharSequence leafText) {
  return new ForeignLeafPsiElement(this, getValue());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:ForeignLeafType.java


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