mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
language_injection.md: minor edits
This commit is contained in:
parent
3b2d64f969
commit
852f1ea9d4
@ -1,7 +1,7 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
|
||||
# Language Injection
|
||||
|
||||
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
|
||||
<link-summary>Injecting a language into different language elements.</link-summary>
|
||||
|
||||
<tldr>
|
||||
@ -134,13 +134,13 @@ For instance, injecting SQLite into Python code is specified by the following op
|
||||
|
||||
Inside an injection, the following tags can be used:
|
||||
|
||||
| XML Tag | Description |
|
||||
|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `<display-name>` | A short name for the injection. |
|
||||
| `<place>` | The element pattern that defines where an injection will take place. The content is wrapped in `![CDATA[...]]`. |
|
||||
| `<prefix>` and `<suffix>` | Static content that is wrapped around the injected code, e.g., to make it a valid expression. For example, to a CSS color specification inside a string, it can be wrapped with the prefix `div { color:` and the suffix `;}` to make it a valid CSS expression. |
|
||||
| XML Tag | Description |
|
||||
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `<display-name>` | A short name for the injection. |
|
||||
| `<place>` | The element pattern that defines where an injection will take place. The content is wrapped in `![CDATA[...]]`. |
|
||||
| `<prefix>` and `<suffix>` | Static content that is wrapped around the injected code, e.g., to make it a valid expression. For example, to a CSS color specification inside a string, it can be wrapped with the prefix `div { color:` and the suffix `;}` to make it a valid CSS expression. |
|
||||
| `<value-pattern>` | A regex for the content that specifies when this injection should be applied. Regex groups can specify the text range of the injection (e.g. `^javascript:(.+)`, see [`xmlInjections-html.xml`](%gh-ic%/plugins/IntelliLang/xml-support/resources/xmlInjections-html.xml)). |
|
||||
| `<ignore-pattern>` | A regex for the content that specifies when this injection should not be applied. |
|
||||
| `<ignore-pattern>` | A regex for the content that specifies when this injection should not be applied. |
|
||||
|
||||
#### Create an XML File to Load the Configuration
|
||||
|
||||
@ -312,4 +312,4 @@ To control delegation of formatting to containing file, implement [`InjectedForm
|
||||
|
||||
## Injection Highlighting
|
||||
|
||||
To suppress highlighting from <control>Code | Injected language fragment</control> setting in <ui-path>Preferences | Editor | Color Scheme | General</ui-path>, injection host must implement [`InjectionBackgroundSuppressor`](%gh-ic%/platform/analysis-impl/src/com/intellij/psi/impl/source/tree/injected/InjectionBackgroundSuppressor.java).
|
||||
To suppress highlighting from <control>Code | Injected language fragment</control> setting in <ui-path>Settings | Editor | Color Scheme | General</ui-path>, injection host must implement [`InjectionBackgroundSuppressor`](%gh-ic%/platform/analysis-impl/src/com/intellij/psi/impl/source/tree/injected/InjectionBackgroundSuppressor.java).
|
||||
|
Loading…
x
Reference in New Issue
Block a user