-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support folding ranges inside a line #50840
Comments
We currently have no plans for inline foldings. It would require some major work on the editor widget side. |
This would allow js/ts folds to look nicer as well: if {⋯
} becomes if {⋯} Just have to figure out a UI for the possible multiple folds on one line. |
This would enable some Really Awesome language aware functionality. 🔥
|
@aeschli , would it be possible to support this at the token level (rather than character level)? Or could you go into a little more depth about the work that would be required? Taking the tokens (represented by Doing this for the first/last line of a multi-line selection, and then using the existing line-folding would cover both single and multi-line cases with essentially just a CSS class toggle and a button. This seems pretty straightforward, but I'm not sure what other challenges might be involved, like getting the span elements based on cursor selection. |
If you look at the current implementation you see that we have code to convert from document offsets to view model offsets and vice versa. The view model knows which line (or part of the line) is shown on the screen and is used for rendering but also for things like cursor movement. |
Huge +1. I'd love to use VSCode for all my Markdown editing needs, but first need collapsing of URLs and footnotes. Here's a screengrab of a workflow I recently put together in Typora (a web-based Markdown editor). I use a few CSS styles to collapse the contents of |
I want it :) |
This would be awesome. It could allow you to fold up all the utility classes in a framework like tailwind css. It would look something like this with the '...' representing the folded classes.
This would allow you to see the structure of the html instead of just all the utility classes. |
I've been wanting to do this for years. This might be related to #3352 |
Is this real or just some prototype? I'm trying to do/have the same :) |
Hi @CraftLogan @sawanm9000 There was no available API to implement this, but I used decorator API in a “hacky” way to achieve the experience of inline folding, I published it here: @CraftLogan thanks for the motivation, it is really useful with tailwind |
@moalamri This is really cool, I think it will be awesome to add a command to show and unshow all classes with a shortcut. |
@CraftLogan Awesome, Thanks for the suggestion, I'll work on it |
@moalamri @CraftLogan Could y'all move this discussion to the issue tracker on the extension repo? https://github.com/moalamri/vscode-inline-fold |
Up! |
Upvoted again. I just requested it again here: Before I requested it I didn't find anything else, but after I seem to be running into quite a few requests for the same feature. It met the 20 plus votes for this requirement quite some time ago. I sincerely hope this gets implemented. |
Please don't outsource this to extension developers, inline folding must be in the core feature set together with selection transposition, alignment and sorting, unicode glyph maps, path autocompletion, pretty printers (well, at least JSON!), insert/overtype switch and other useful little things, because today's extension landscape looks like a park of 18-wheelers whose huge reverberating box trailers deliver a single lonesome cake each. |
Yes, this can only be implemented in core, but there's currently no such work planned. |
Related on Stack Overflow: Is it possible to collapse custom regions in the middle of lines? |
Upvoted again for multiline folding |
@Will-Wrightwa @michfield I've forked @moalamri's to publish an extension that folds types based on the TypeScript AST: |
…ation Added the draft NB PR 7750 diff which allows supporting LSP clients which have line-only folding support. - This is the case of VS Code as referenced in microsoft/vscode#50840. Closes oracle#249 Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
…ation Added the backport of the draft NB PR 7750 diff which allows supporting LSP clients which have line-only folding support. - This is the case of VS Code as referenced in microsoft/vscode#50840. Closes oracle#249 Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
…ation Added the backport of the in-review NB PR 7750 diff which allows supporting LSP clients which have line-only folding support. - This is the case of VS Code as referenced in microsoft/vscode#50840. Closes oracle#249 Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
…ation Added the backport of the Netbeans PR apache/netbeans#7750 patch which allows supporting LSP clients which have line-only folding support. - This is the case of VS Code as referenced in microsoft/vscode#50840. Closes oracle#249 Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
…ation Added the backport of the Netbeans PR apache/netbeans#7750 patch which allows supporting LSP clients which have line-only folding support. - This is the case of VS Code as referenced in microsoft/vscode#50840. Closes oracle#249 Signed-off-by: Siddharth Srinivasan <siddharth.srinivasan@oracle.com>
Hey, I have read through the folding-related issues (like #3422, the linked ones and some other ones related to the
FoldingRangeProvider
API specifically), but I don't seem to have come across a conversation about inline folding ranges.Has this been discussed - or is it okay to start a discussion on the topic now?
I am interested in these, because I'd like to improve readability of MarkDown documents (using an extension) by collapsing MarkDown link targets (the URLs - which can be quite long) and instead linkifying the text range (using a
DocumentLinkProvider
).Researching the
FoldingRange
API though, I can see it only has start and end lines, notPosition
s. Is this an immutable deliberate design decision or something open to alternative with enough support behind it?I think other possible use cases could be folding of ternary expression branches, one-liner
if
statements and stuff like that. (But I'm mostly interested in my use-case described above.)The text was updated successfully, but these errors were encountered: