# Alternatives for @Internal

**URL:** <https://platform.jetbrains.com/t/alternatives-for-internal/287>\
**Category:** IntelliJ Platform\
**Created:** [February 8, 2025, 8:25am UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287 "2025-02-08T08:25:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tzengshinfu](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/tzengshinfu/32/281_2.png) [@tzengshinfu](https://platform.jetbrains.com/u/tzengshinfu)\
**Post date:** [February 8, 2025, 8:25am UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/1 "2025-02-08T08:25:18Z")

</div>

Hi, folks:  
I developed an IDEA plugin, but during the compatibility verification before publishing, it was flagged for using an [internal API](https://github.com/JetBrains/intellij-community/commit/55a5cc91f5d13eb0df2cd12d74c677b9b6a2f6c6).

I used the class **DocumentFragmentTooltipRenderer** , which has now been marked as an internal API, to display tooltips.

I initially attempted to replace it with the following code:

```java
DocumentFragment range = createDocumentFragment(editorEx, region);  
HintManager.getInstance().showInformationHint(editorEx, editorEx.getDocument().getText(range.getTextRange()));  

```

However, the tooltip no longer displays syntax highlighting as it originally did:

 ![expected_actual](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/1X/e6c802d386298cec851c97d008d03e4ef309b324.png)

Any suggestions would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![tzengshinfu](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/tzengshinfu/32/281_2.png) [@tzengshinfu](https://platform.jetbrains.com/u/tzengshinfu)\
**Post date:** [February 10, 2025, 2:45am UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/2 "2025-02-10T02:45:24Z")

</div>

Additionally, I have created [this issue](https://youtrack.jetbrains.com/issue/MP-7255/DocumentFragmentTooltipRenderer-was-marked-as-internal) in the issue tracker.

---

<div class="post-metadata">

**Author:** ![yann.cebron](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/yann.cebron/32/15_2.png) [@yann.cebron](https://platform.jetbrains.com/u/yann.cebron)\
**Post date:** [February 10, 2025, 10:25am UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/3 "2025-02-10T10:25:52Z")

</div>

Thanks for highlighting, discussion should continue in the created issue.

---

<div class="post-metadata">

**Author:** ![tzengshinfu](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/tzengshinfu/32/281_2.png) [@tzengshinfu](https://platform.jetbrains.com/u/tzengshinfu)\
**Post date:** [March 21, 2025, 10:10am UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/4 "2025-03-21T10:10:51Z")

</div>

Hello @yann.cebron,

Regarding the previously mentioned plugin, to be precise, I have forked an outdated plugin.  
It creates custom `FoldRegion`s and uses

```java
TooltipController.getInstance().showTooltip(  
    editor,  
    point,  
    new DocumentFragmentTooltipRenderer(documentFragment),  
    false,  
    FOLDING_TOOLTIP_GROUP  
);  

```

to display the original text of the folded region.

The effect is similar to:

 ![showTooltip](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/1X/fbbd3f665432d1c1408941bf14549a3c1c5ef777.png)

Since `DocumentFragmentTooltipRenderer` has been marked as an internal API,  
I would like to replace it with an alternative method, such as

`HintManager.getInstance().showInformationHint`

However, I noticed that other custom `FoldRegion`s automatically display the original folded text when the mouse moves, **even without using `showTooltip`**.

How can I programmatically disable the automatic display of folded text for FoldRegion?

---

<div class="post-metadata">

**Author:** ![yann.cebron](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/yann.cebron/32/15_2.png) [@yann.cebron](https://platform.jetbrains.com/u/yann.cebron)\
**Post date:** [March 24, 2025, 9:16am UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/5 "2025-03-24T09:16:11Z")

</div>

> [@tzengshinfu](#):
>
> How can I programmatically disable the automatic display of folded text for FoldRegion?

Why? Users should have opportunity to quickly inspect the folded context using the provided placeholderText.

---

<div class="post-metadata">

**Author:** ![tzengshinfu](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/tzengshinfu/32/281_2.png) [@tzengshinfu](https://platform.jetbrains.com/u/tzengshinfu)\
**Post date:** [March 24, 2025, 2:12pm UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/6 "2025-03-24T14:12:49Z")

</div>

Because I found that only this specific FOLDREGION requires calling `DocumentFragmentTooltipRenderer` manually to display the folded text when the mouse is moved, while other regions can display the folded text automatically,  
I wanted to disable the automatic display for all regions and use an alternative method to show it manually.  
Actually, I don’t quite understand when IDEA automatically displays the original text of a FoldRegion…

---

<div class="post-metadata">

**Author:** ![yann.cebron](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/yann.cebron/32/15_2.png) [@yann.cebron](https://platform.jetbrains.com/u/yann.cebron)\
**Post date:** [March 24, 2025, 2:21pm UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/7 "2025-03-24T14:21:13Z")

</div>

You can specify the placeholder text when building the fold region, not sure why there would be any need for anything else.  
This behaviour with showing placeholder text (or `...` if not specified) is consistent within the platform and should not be overridden by plugins.

---

<div class="post-metadata">

**Author:** ![tzengshinfu](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/tzengshinfu/32/281_2.png) [@tzengshinfu](https://platform.jetbrains.com/u/tzengshinfu)\
**Post date:** [April 8, 2025, 3:25am UTC](https://platform.jetbrains.com/t/alternatives-for-internal/287/8 "2025-04-08T03:25:29Z")

</div>

@yann.cebron Thanks for the tip! I changed the placeholder text from an empty string to a zero-width space, so now even hidden FoldRegions will show the tooltip text when hovered over with the mouse.
