Java Code Examples for com.intellij.psi.impl.DebugUtil#psiToString()
The following examples show how to use
com.intellij.psi.impl.DebugUtil#psiToString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PsiViewerDialog.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override protected Action[] createActions() { AbstractAction copyPsi = new AbstractAction("Cop&y PSI") { @Override public void actionPerformed(ActionEvent e) { PsiElement element = parseText(myEditor.getDocument().getText()); List<PsiElement> allToParse = new ArrayList<PsiElement>(); if (element instanceof PsiFile) { allToParse.addAll(((PsiFile)element).getViewProvider().getAllFiles()); } else if (element != null) { allToParse.add(element); } String data = ""; for (PsiElement psiElement : allToParse) { data += DebugUtil.psiToString(psiElement, !myShowWhiteSpacesBox.isSelected(), true); } CopyPasteManager.getInstance().setContents(new StringSelection(data)); } }; return ArrayUtil.mergeArrays(new Action[]{copyPsi}, super.createActions()); }
Example 2
Source File: BaseCppTestCase.java From CppTools with Apache License 2.0 | 6 votes |
protected void doParseTest(final String fileName, @NotNull @NonNls final String ext) throws Throwable { Runnable action = new Runnable() { public void run() { try { myFixture.testHighlighting(fileName + (ext.length() > 0 ? "." + ext : "")); } catch (Exception e) { throw new RuntimeException(e); } String s = DebugUtil.psiToString(myFixture.getFile(), true); final String expected = LoadTextUtil.loadText( LocalFileSystem.getInstance().findFileByIoFile(new File(getTestDataPath() + File.separator + fileName + ".txt")) ).toString(); assertEquals( expected, s ); } }; BuildState.invokeOnEDTSynchroneously(action); }
Example 3
Source File: StubBasedPsiElementBase.java From consulo with Apache License 2.0 | 5 votes |
/** * @return a not-null child of specified type, taken from stubs (if this element is currently stub-based) or AST (otherwise). */ @Nonnull public <S extends StubElement, Psi extends PsiElement> Psi getRequiredStubOrPsiChild(@Nonnull IStubElementType<S, Psi> elementType) { Psi result = getStubOrPsiChild(elementType); if (result == null) { throw new AssertionError("Missing required child of type " + elementType + "; tree: " + DebugUtil.psiToString(this, false)); } return result; }
Example 4
Source File: HaxeDebugPsiUtil.java From intellij-haxe with Apache License 2.0 | 4 votes |
public static String printElementTree(PsiElement root) { if (null == root) return "<NULL>"; return DebugUtil.psiToString(root, false); }
Example 5
Source File: ParsingTestCase.java From consulo with Apache License 2.0 | 4 votes |
protected static String toParseTreeText(final PsiElement file, boolean skipSpaces, boolean printRanges) { return DebugUtil.psiToString(file, skipSpaces, printRanges); }
Example 6
Source File: CompletionAssertions.java From consulo with Apache License 2.0 | 4 votes |
private static Attachment createAstAttachment(PsiFile fileCopy, final PsiFile originalFile) { return new Attachment(originalFile.getViewProvider().getVirtualFile().getPath() + " syntactic tree.txt", DebugUtil.psiToString(fileCopy, false, true)); }