RFC: inline code folding in HTML-like languages and frameworks #939
Replies: 9 comments 9 replies
-
Tbh, this is one of the reasons I dislike libraries like TailWind. I don’t disagree with this proposal though, as long as it’s opt-in |
Beta Was this translation helpful? Give feedback.
-
What about something like the table on the MPS projectional editor? https://youtu.be/XolJx4GfMmg?si=krNT8zHycaDcHwSr&t=63 ![]() for example, an obj or xml expands to a table (floating or inlined)
|
Beta Was this translation helpful? Give feedback.
-
I really like the idea of providing a presentation of the code that focuses more on structure, leaving out details that likely aren’t relevant when scanning through the overall layout of the code. To benefit from such a feature, it’s important that switching between the different modes is quick and seamless — ideally available both via UI buttons and keyboard shortcuts (which I believe you’ve already mentioned in the proposal). Since I haven’t had the chance to try it out yet, it’s hard to judge how it will feel in practice. One thing I could imagine being a potential issue is a lot of UI “jumping” when switching modes. For example, if I’m looking at line 100 in Another idea that could be useful is something similar to the magnifying glass feature currently in WebStorm. When hovering over the vertical scrollbar, you get a ~10-line preview of that part of the file. It might be helpful to have something similar for this: when I hover over a folded section in Answers to your questions:
|
Beta Was this translation helpful? Give feedback.
-
I'll maybe go over the three other answers in more detailes later, but for question 3, I'd say I'll most likely be using the compact version by default, with moving the caret to classNames prop expanding it to view the tailwind classes. The biggest problem for me personally is tailwind, we have a strict no more than a one liner function passed to html attributes so the html for the most part is clean usually, only for the tailwind classes. I don't see myself really using the standard mode if this gets implemented. |
Beta Was this translation helpful? Give feedback.
-
Hey! This looks like an awesome idea – I’m all for anything that makes scanning code easier. If you haven’t seen it, the Tailwind Fold extension for VS Code does a great job with this. The way it folds classes with the Tailwind icon and the "..." is super clean, and the whole experience just feels great. Really helpful in day-to-day work. Might be worth checking out how they nailed the UX – could save some time and UI/UX effort. |
Beta Was this translation helpful? Give feedback.
-
I love this idea! Looking at the mock-ups, it looks like it would improve readability by a lot. This gives similar vibes to the structure window, which I use way less than I should. However, it's not great for deeply nested code (like HTML), so I don't think there's an overlap here. As for the questions:
|
Beta Was this translation helpful? Give feedback.
-
Looking forward to this feature 🤗
I would prefer to not change the alignment, as I think i can be hard to stay "focused" on the same code location when toggling the different modes.
My biggest pain point currently (without this feature) are too verbose class/className-Attributes. So probably I would only toggle between Compact Styles and Full modes.
I would like to have a simple shortcut. I Also could imagine that (in Compact or Structure mode) clicking on a folded attributes expandes the attribute and let it expanded. So that one could collapse attributes by switing to Compact or Structure mode and then selectively expanding single attributes. Also when adding a new attribute that would be folded by the current mode, it think it should stay expanded.
As long as the IDE remembers my setting per file, I don't care otherwise I would remain in Full Mode, as that is the "obvious" mode for users that are not aware of the folding feature. |
Beta Was this translation helpful? Give feedback.
-
Hey! I'm thrilled that this is already an RFC, and I think this would be a huge UX improvement for more complex templates. I'm also passing here my feedback from the Discord server. It is mostly React-related.
<Box ...> // everything folded to one-line
<Stack ...> // everything folded to one-line
<ProjectList
projects={myProjects} // not folded when inline object literal
onProject={projectHandler} // not folded when lambda
sx={...}/> // only sx folded
</Stack>
</Box> A nice reference for this is React Dev Tools, where you can filter out components based on type or regex of a component's name. Thanks, and I can't wait for this feature to appear in the IDE! |
Beta Was this translation helpful? Give feedback.
-
General Feedback & Urgency Positive Aspects of the Proposal Suggested Enhancements and Modifications
Regarding the questions posed in the RFC: Should IDE change how attributes are presented in a file in Compact mode? How frequently would you switch between Structure, Compact Styles, and Full modes? Which of the proposed methods for changing modes would work best for you? Which mode do you prefer as the default IDE behavior? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Abstract
Sometimes, when exploring the code, it can become challenging to navigate through lengthy attribute values in HTML-like code (React, Vue, Angular, Svelte). This is especially common in style systems like Tailwind CSS, where class or className attributes often contain a list of classes, making code exploration more difficult. Once we realized this, we saw an opportunity to improve the code navigation experience for framework developers.
Proposal
The RFC suggests introducing a feature for JetBrains IDEs that allows three modes for managing inline code folding* in HTML-like languages and frameworks (JSX/TSX, Angular, Vue, Svelte, etc.) to improve code readability:
Strucure Mode: IDE hides the values of all attributes in a file, making it easier to explore the code structure.
Compact Styles Mode: IDE hides values specifically for class, className, and style attributes in a file.
Full Mode: This is the default, standard IDE mode with no inline folding applied.
*Inline code folding refers to collapsing parts of a single line, while standard block code folding handles entire code blocks like functions or classes.
Mockup 1

Mockup 2

To switch between these modes, we have several implementation ideas:
An icon next to the attributes when values expand on caret, available in Compact or Compact Styles modes.
An icon in the gutter when values expand on caret, available in Compact or Compact Styles modes.
Icons in the upper-right corner in the editor.
The inline code folding behavior introduces two main differences from block code folding:
Caret-triggered expansion: When the caret is placed on a line with inline folding, the IDE automatically expands it. The folding collapses again when the caret moves to another line.
a. The mouse-triggered expansion works the same as in block code folding: When expanding folding with a mouse click, the expanded state persists after moving the caret away.
No collapse / expand arrows for foldings in the editor gutter: Code foldings arrows are shown by default in the editor gutter for all code foldings, it won’t be shown for inline code foldings to minimize the UI clutter;
Fold and unfold actions will respect the caret position within an attribute value. The caret placed outside the attribute value triggers familiar behavior where IDE uses the basic rules for folding block comments and tags.
What kind of feedback are we looking for?
We're looking forward to hearing your thoughts on this proposal! To help focus the discussion, we’ve outlined certain discussion points here. When providing your input, please specify which question(s) below you’re answering:
Beta Was this translation helpful? Give feedback.
All reactions