mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
file_view_providers.md: Add code formatting to titles
This commit is contained in:
parent
f4f060167c
commit
d26bf7444b
@ -1,4 +1,4 @@
|
|||||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||||
|
|
||||||
# File View Providers
|
# File View Providers
|
||||||
|
|
||||||
@ -12,21 +12,21 @@ Each of the PSI trees covers the entire contents of the file and contains specia
|
|||||||
|
|
||||||
A `FileViewProvider` instance corresponds to a single `VirtualFile`, a single `Document`, and can retrieve multiple `PsiFile` instances.
|
A `FileViewProvider` instance corresponds to a single `VirtualFile`, a single `Document`, and can retrieve multiple `PsiFile` instances.
|
||||||
|
|
||||||
## How do I get a FileViewProvider?
|
## How do I get a `FileViewProvider`?
|
||||||
|
|
||||||
| Context | API |
|
| Context | API |
|
||||||
|---------------------------------|------------------------------------------------------------------------------------------------------------------------|
|
|---------------------------------|------------------------------------------------------------------------------------------------------------------------|
|
||||||
| [PSI File](psi_files.md) | [`PsiFile.getViewProvider()`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiFile.java) |
|
| [PSI File](psi_files.md) | [`PsiFile.getViewProvider()`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiFile.java) |
|
||||||
| [Virtual File](virtual_file.md) | [`PsiManager.getInstance(project).findViewProvider()`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiManager.java) |
|
| [Virtual File](virtual_file.md) | [`PsiManager.getInstance(project).findViewProvider()`](%gh-ic%/platform/core-api/src/com/intellij/psi/PsiManager.java) |
|
||||||
|
|
||||||
## What can I do with a FileViewProvider?
|
## What can I do with a `FileViewProvider`?
|
||||||
|
|
||||||
* To get the set of all languages for which PSI trees exist in a file: `fileViewProvider.getLanguages()`
|
* To get the set of all languages for which PSI trees exist in a file: `fileViewProvider.getLanguages()`
|
||||||
* To get the PSI tree for a particular language: `fileViewProvider.getPsi(language)`.
|
* To get the PSI tree for a particular language: `fileViewProvider.getPsi(language)`.
|
||||||
For example, to get the PSI tree for XML, use `fileViewProvider.getPsi(XMLLanguage.INSTANCE)`.
|
For example, to get the PSI tree for XML, use `fileViewProvider.getPsi(XMLLanguage.INSTANCE)`.
|
||||||
* To find an element of a particular language at the specified offset in the file: `fileViewProvider.findElementAt(offset, language)`
|
* To find an element of a particular language at the specified offset in the file: `fileViewProvider.findElementAt(offset, language)`
|
||||||
|
|
||||||
## How do I extend the FileViewProvider?
|
## How do I extend the `FileViewProvider`?
|
||||||
|
|
||||||
To create a file type that has multiple interspersing trees for different languages, a plugin must contain an extension to the `com.intellij.fileType.fileViewProviderFactory` extension point.
|
To create a file type that has multiple interspersing trees for different languages, a plugin must contain an extension to the `com.intellij.fileType.fileViewProviderFactory` extension point.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user