mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
psi_cookbook.md: Format code snippet
This commit is contained in:
parent
0b9985dfb4
commit
1d13a1ff1a
@ -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. -->
|
||||
|
||||
# PSI Cookbook
|
||||
|
||||
<link-summary rel="excerpt"/>
|
||||
<p id="excerpt">
|
||||
This page gives recipes for the most common operations for working with the PSI (Program Structure Interface).
|
||||
@ -56,8 +56,8 @@ 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?
|
||||
|
||||
```java
|
||||
PsiJavaFile javaFile = (PsiJavaFile)psiClass.getContainingFile();
|
||||
PsiPackage psiPackage = JavaPsiFacade.getInstance(project)
|
||||
PsiJavaFile javaFile = (PsiJavaFile) psiClass.getContainingFile();
|
||||
PsiPackage psiPackage = JavaPsiFacade.getInstance(project)
|
||||
.findPackage(javaFile.getPackageName());
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user