psi_cookbook.md: Format code snippet

This commit is contained in:
Karol Lewandowski 2023-10-18 15:52:54 +02:00
parent 0b9985dfb4
commit 1d13a1ff1a

View File

@ -1,7 +1,7 @@
# PSI Cookbook
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. --> <!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# PSI Cookbook
<link-summary rel="excerpt"/> <link-summary rel="excerpt"/>
<p id="excerpt"> <p id="excerpt">
This page gives recipes for the most common operations for working with the PSI (Program Structure Interface). This page gives recipes for the most common operations for working with the PSI (Program Structure Interface).
@ -56,9 +56,9 @@ Unlike [Developing Custom Language Plugins](custom_language_support.md), it is a
### How do I get a reference to the containing package of a Java class? ### How do I get a reference to the containing package of a Java class?
```java ```java
PsiJavaFile javaFile = (PsiJavaFile)psiClass.getContainingFile(); PsiJavaFile javaFile = (PsiJavaFile) psiClass.getContainingFile();
PsiPackage psiPackage = JavaPsiFacade.getInstance(project) PsiPackage psiPackage = JavaPsiFacade.getInstance(project)
.findPackage(javaFile.getPackageName()); .findPackage(javaFile.getPackageName());
``` ```
or or