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


Java TreeUtil.ensureParsed方法代码示例

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


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

示例1: suggestKeywords

import com.intellij.psi.impl.source.tree.TreeUtil; //导入方法依赖的package包/类
private static Collection<String> suggestKeywords(PsiElement position) {
    TextRange posRange = position.getTextRange();
    CupFile posFile = (CupFile) position.getContainingFile();
    TextRange range = new TextRange(0, posRange.getStartOffset());
    String text = range.isEmpty() ? CompletionInitializationContext.DUMMY_IDENTIFIER : range.substring(posFile.getText());
    int completionOffset = posRange.getStartOffset() - range.getStartOffset(); // = posRange.getStartOffset() ...

    PsiFile file = PsiFileFactory.getInstance(posFile.getProject()).createFileFromText("a.cup", CupLanguage.INSTANCE, text, true, false);
    GeneratedParserUtilBase.CompletionState state = new GeneratedParserUtilBase.CompletionState(completionOffset) {
        @Nullable
        @Override
        public String convertItem(Object o) {
            if (o == CupTypes.IDENTIFIER) {
                return null;
            }
            return o.toString();
        }
    };
    file.putUserData(GeneratedParserUtilBase.COMPLETION_STATE_KEY, state);
    TreeUtil.ensureParsed(file.getNode());

    return state.items;
}
 
开发者ID:Tirke,项目名称:cup-plugin,代码行数:24,代码来源:CupCompletionContributor.java

示例2: suggestKeywords

import com.intellij.psi.impl.source.tree.TreeUtil; //导入方法依赖的package包/类
private Collection<String> suggestKeywords(@NotNull PsiElement position)
{
	PsiFile psiFile = position.getContainingFile();
	PsiElement topLevelElement = position;
	while(!(topLevelElement.getParent() instanceof PsiFile))
	{
		topLevelElement = topLevelElement.getParent();
	}
	PsiFile file = PsiFileFactory.getInstance(psiFile.getProject()).createFileFromText("a.thrift", ThriftLanguage.INSTANCE, topLevelElement.getText(), true, false);
	GeneratedParserUtilBase.CompletionState state = new GeneratedParserUtilBase.CompletionState(position.getTextOffset() - topLevelElement.getTextOffset());
	file.putUserData(GeneratedParserUtilBase.COMPLETION_STATE_KEY, state);
	TreeUtil.ensureParsed(file.getNode());
	return state.items;
}
 
开发者ID:consulo,项目名称:consulo-apache-thrift,代码行数:15,代码来源:ThriftKeywordCompletionContributor.java

示例3: suggestKeywords

import com.intellij.psi.impl.source.tree.TreeUtil; //导入方法依赖的package包/类
private Collection<String> suggestKeywords(@NotNull PsiElement position) {
  PsiFile psiFile = position.getContainingFile();
  PsiElement topLevelElement = position;
  while (!(topLevelElement.getParent() instanceof PsiFile)) {
    topLevelElement = topLevelElement.getParent();
  }
  PsiFile file = PsiFileFactory.getInstance(psiFile.getProject())
    .createFileFromText("a.thrift", ThriftLanguage.INSTANCE, topLevelElement.getText(), true, false);
  GeneratedParserUtilBase.CompletionState state =
    new GeneratedParserUtilBase.CompletionState(position.getTextOffset() - topLevelElement.getTextOffset());
  file.putUserData(GeneratedParserUtilBase.COMPLETION_STATE_KEY, state);
  TreeUtil.ensureParsed(file.getNode());
  return state.items;
}
 
开发者ID:fkorotkov,项目名称:intellij-thrift,代码行数:15,代码来源:ThriftKeywordCompletionContributor.java

示例4: ReplaceElementWithEvents

import com.intellij.psi.impl.source.tree.TreeUtil; //导入方法依赖的package包/类
private ReplaceElementWithEvents(@Nonnull CompositeElement oldRoot, @Nonnull CompositeElement newRoot) {
  myOldRoot = oldRoot;
  myNewRoot = newRoot;
  // parse in background to reduce time spent in EDT and to ensure the newRoot light containing file is still valid
  TreeUtil.ensureParsed(myOldRoot.getFirstChildNode());
  TreeUtil.ensureParsed(myNewRoot.getFirstChildNode());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:DiffLog.java

示例5: triggerParsingInFile

import com.intellij.psi.impl.source.tree.TreeUtil; //导入方法依赖的package包/类
private void triggerParsingInFile(PsiFile file) {
    TreeUtil.ensureParsed(file.getNode());
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:4,代码来源:KeywordCollector.java


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