question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support folding ranges inside a line

See original GitHub issue

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, not Positions. 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.)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:76
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

28reactions
aeschlicommented, Jun 6, 2018

We currently have no plans for inline foldings. It would require some major work on the editor widget side.

20reactions
Will-Wrightwacommented, Apr 8, 2019

This would enable some Really Awesome language aware functionality. 🔥 Here are some examples.

  • markdown
    • fold url link destination
  • typescript:
    • hide types
  • javascript:
    • fold inline arrow functions
    • fold inline object literals
    • fold function arguments
  • python: fold list comprehension
  • jsx / html:
    • fold away element props
    • fold away element children
    • fold to self Closing Tag
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fold control statements with preprocessors in them?
Folding ranges are by default evaluated based on the indentation of lines. A folding range starts when a line has a smaller indent...
Read more >
10 Push Fold Charts for Poker Tournaments
When your stack gets short, your preflop options are reduced to two: push all-in or fold. Get optimal push fold charts for poker ......
Read more >
Explicit Folding - Visual Studio Marketplace
In your settings: ... So \n and multi-lines regexes aren't supported. ... You can define the automatic folding of the ranges with the ......
Read more >
VS Code tips — Manual folding ranges (Fold selection)
se the 'Create manual folding range from selection' command in VS Code to fold arbitrary sections of your code. This is useful when...
Read more >
fold.txt - Vim
To increase the fold level of a fold for a range of lines, define a fold inside it that has the same lines....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found