Added small section to Editor Components (#784)

added a small section to editor_components.md describing convenient `EditorTextField` subclasses
This commit is contained in:
Makhnev Petr 2022-05-31 10:12:14 +03:00 committed by GitHub
parent 5f38854dbb
commit 120224b135
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -22,6 +22,7 @@ Inlay Hints
Minor Changes and Additions
:
- Add a small section to [](editor_components.md) describing convenient `EditorTextField` subclasses.
- Add descriptions for the following EPs to [](additional_minor_features.md): [](additional_minor_features.md#recognizing-complex-multi-block-expressions), [](additional_minor_features.md#breadcrumbs), [](additional_minor_features.md#plain-text-completion), [](additional_minor_features.md#splitting-and-joining-list-constructs), [](additional_minor_features.md#suggesting-rename-and-change-signature-refactorings), [](additional_minor_features.md#reader-mode), [](additional_minor_features.md#background-colors-for-editors-and-project-view), [](additional_minor_features.md#custom-names-and-tooltips-for-editor-tabs).
- Add small section to [](project_view.md#decorating-project-view-nodes) describing how to modify the representation of nodes in the project view.
- Add [](rename_refactoring.md) paragraphs mentioning `RenameInputValidator` and `RenameInputValidatorEx`.

View File

@ -20,6 +20,27 @@ Several commonly needed customization implementations exist, including:
- [`HorizontalScrollBarEditorCustomization`](upsource:///platform/platform-impl/src/com/intellij/ui/HorizontalScrollBarEditorCustomization.java) to turn on/off horizontal scrollbar
- [`ErrorStripeEditorCustomization`](upsource:///platform/platform-impl/src/com/intellij/ui/ErrorStripeEditorCustomization.java) to turn on/off error stripes on right
`EditorTextField` has a number of subclasses that can be used as needed for additional features.
If you want to use an editor as an input field in a dialog box, then consider using
[`LanguageTextField`](upsource:///platform/platform-impl/src/com/intellij/ui/LanguageTextField.java),
it provides a more accessible API.
If you want to add autocompletion to the editor, then use
[`TextFieldWithCompletion`](upsource:///platform/platform-impl/src/com/intellij/util/textCompletion/TextFieldWithCompletion.java).
The constructor takes as an argument a class that implements
[`TextCompletionProvider`](upsource:///platform/platform-impl/src/com/intellij/util/textCompletion/TextCompletionProvider.java)
to provide autocompletion variants.
Use
[`TextFieldCompletionProvider`](upsource:///platform/lang-impl/src/com/intellij/util/TextFieldCompletionProvider.java)
to create your own provider. For this, override the `addCompletionVariants()` and add completion variants using `CompletionResultSet.addElement()`.
See also
[`TextFieldCompletionProviderDumbAware`](upsource:///platform/lang-impl/src/com/intellij/util/TextFieldCompletionProviderDumbAware.java)
for completion even at the indexing stage.
Refer to the [](code_completion.md) to learn more about completion.
### Java
A common use case for `EditorTextField` is entering the name of a Java class or package.