mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
update references to "PsiViewer" functionality
This commit is contained in:
parent
c40b0571c5
commit
b4be530258
@ -155,8 +155,9 @@ must not be used, see [](api_internal.md) for more details and replacements.
|
|||||||
## 3 Tools and References
|
## 3 Tools and References
|
||||||
|
|
||||||
### 3.1 Use Internal Mode and PsiViewer
|
### 3.1 Use Internal Mode and PsiViewer
|
||||||
|
{id="internalMode"}
|
||||||
|
|
||||||
As a plugin developer, you should enable the [internal mode](enabling_internal.md) in IntelliJ IDEA.
|
When developing plugins, always enable the [internal mode](enabling_internal.md) in IntelliJ IDEA.
|
||||||
This provides access to a suite of tools to help you develop, debug, and test IntelliJ Platform plugins.
|
This provides access to a suite of tools to help you develop, debug, and test IntelliJ Platform plugins.
|
||||||
|
|
||||||
One of its most helpful features is the [UI Inspector](internal_ui_inspector.md),
|
One of its most helpful features is the [UI Inspector](internal_ui_inspector.md),
|
||||||
|
@ -72,7 +72,7 @@ This last example shows that corner cases need to be considered carefully even f
|
|||||||
## Tools and Debugging
|
## Tools and Debugging
|
||||||
|
|
||||||
Working with element patterns can be tricky, and plugin authors need a solid understanding of the underlying PSI structure to get it right.
|
Working with element patterns can be tricky, and plugin authors need a solid understanding of the underlying PSI structure to get it right.
|
||||||
Therefore, it is recommended to use the [PsiViewer plugin or built-in PSI viewer](explore_api.md#31-use-internal-mode-and-psiviewer) and verify that elements indeed have the expected structure and properties.
|
Therefore, it is recommended to use the [PsiViewer plugin or built-in PSI viewer](explore_api.md#internalMode) and verify that elements indeed have the expected structure and properties.
|
||||||
|
|
||||||
### Debugging
|
### Debugging
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
# Program Structure Interface (PSI)
|
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||||
|
|
||||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
# Program Structure Interface (PSI)
|
||||||
|
|
||||||
<link-summary>Introduction to Program Structure Interface (PSI) responsible for parsing and creating the syntactic and semantic code model.</link-summary>
|
<link-summary>Introduction to Program Structure Interface (PSI) responsible for parsing and creating the syntactic and semantic code model.</link-summary>
|
||||||
|
|
||||||
The Program Structure Interface, commonly referred to as just PSI, is the layer in the IntelliJ Platform responsible for parsing files and creating the syntactic and semantic code model that powers so many of the platform's features.
|
The Program Structure Interface, commonly referred to as PSI, is the layer in the IntelliJ Platform responsible for parsing files and creating the syntactic and semantic code model that powers so many of the platform's features.
|
||||||
|
|
||||||
* [PSI Files](psi_files.md)
|
* [PSI Files](psi_files.md)
|
||||||
* [File View Providers](file_view_providers.md)
|
* [File View Providers](file_view_providers.md)
|
||||||
* [PSI Elements](psi_elements.md)
|
* [PSI Elements](psi_elements.md)
|
||||||
|
|
||||||
> See [useful tools](explore_api.md#31-use-internal-mode-and-psiviewer) on how to inspect the PSI structure and its properties.
|
> See [useful tools](explore_api.md#internalMode) on how to inspect the PSI structure and its properties.
|
||||||
|
@ -18,8 +18,8 @@ This allows the formatting engine to calculate the smallest number of whitespace
|
|||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
The easiest way to understand how formatting works in practice is to use a small code example in an existing language and
|
The easiest way to understand how formatting works in practice is to use a small code example in an existing language and
|
||||||
use [PsiViewer](explore_api.md#31-use-internal-mode-and-psiviewer) to inspect how formatting blocks are built.
|
use the [built-in PSI viewer](explore_api.md#internalMode) to inspect how formatting blocks are built.
|
||||||
To invoke PsiViewer with the possibility of inspecting <control>Block Structure</control>,
|
To invoke the builtin PSI viewer with the possibility of inspecting <control>Block Structure</control>,
|
||||||
use <ui-path>Tools | View PSI Structure...</ui-path> or <ui-path>Tools | View PSI Structure of Current File...</ui-path>.
|
use <ui-path>Tools | View PSI Structure...</ui-path> or <ui-path>Tools | View PSI Structure of Current File...</ui-path>.
|
||||||
|
|
||||||
{width="706"}
|
{width="706"}
|
||||||
|
@ -87,7 +87,7 @@ Every element which can be renamed or referenced (a class definition, a method d
|
|||||||
|
|
||||||
Several functions which can be used for implementing and using the PSI can be found in the `com.intellij.psi.util` package, and in particular in the [`PsiUtilCore`](%gh-ic%/platform/core-api/src/com/intellij/psi/util/PsiUtilCore.java) and [`PsiTreeUtil`](%gh-ic%/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java) classes.
|
Several functions which can be used for implementing and using the PSI can be found in the `com.intellij.psi.util` package, and in particular in the [`PsiUtilCore`](%gh-ic%/platform/core-api/src/com/intellij/psi/util/PsiUtilCore.java) and [`PsiTreeUtil`](%gh-ic%/platform/core-api/src/com/intellij/psi/util/PsiTreeUtil.java) classes.
|
||||||
|
|
||||||
> Use [builtin tools and PsiViewer plugin](explore_api.md#31-use-internal-mode-and-psiviewer) to explore and inspect PSI.
|
> Use [PsiViewer plugin or built-in PSI viewer](explore_api.md#internalMode) to explore and inspect PSI.
|
||||||
>
|
>
|
||||||
|
|
||||||
Please see [Indexing and PSI Stubs](indexing_and_psi_stubs.md) for advanced topics.
|
Please see [Indexing and PSI Stubs](indexing_and_psi_stubs.md) for advanced topics.
|
||||||
|
@ -116,6 +116,7 @@ key\ with\ spaces = This is the value that could be looked up with the key "key
|
|||||||
tab : \u0009
|
tab : \u0009
|
||||||
```
|
```
|
||||||
|
|
||||||
Now open the <control>PsiViewer</control> tool window and check how the lexer breaks the content of the file into tokens, and the parser transforms the tokens into PSI elements.
|
Use the [PsiViewer plugin or built-in PSI viewer](explore_api.md#internalMode) and check how the lexer breaks the content of the file into tokens,
|
||||||
|
and the parser transforms the tokens into PSI elements.
|
||||||
|
|
||||||

|

|
||||||
|
@ -40,8 +40,8 @@ Note the last few lines define a purposely incorrect key.
|
|||||||
{src="simple_language_plugin/src/test/testData/ParsingTestData.simple"}
|
{src="simple_language_plugin/src/test/testData/ParsingTestData.simple"}
|
||||||
|
|
||||||
## Copy the Expected PSI Tree
|
## Copy the Expected PSI Tree
|
||||||
The easiest way to get the expected PSI structure for any file is to use the PSI Viewer.
|
The easiest way to get the expected PSI structure for any file is to use the [built-in PSI viewer](explore_api.md#internalMode).
|
||||||
Run the project and use <ui-path>Tools | View PSI Structure</ui-path>
|
Run the project and use <ui-path>Tools | View PSI Structure...</ui-path>
|
||||||
(enable [Internal Mode](enabling_internal.md) explicitly for the IDE instance if the menu is not available).
|
(enable [Internal Mode](enabling_internal.md) explicitly for the IDE instance if the menu is not available).
|
||||||
|
|
||||||

|

|
||||||
|
Loading…
x
Reference in New Issue
Block a user