predragnikolic / inlinefold Goto Github PK
View Code? Open in Web Editor NEWA Sublime Text plugin that is useful to fold regions into a single line.
License: MIT License
A Sublime Text plugin that is useful to fold regions into a single line.
License: MIT License
With the changes to the Python default package, it is now possible to fold the non-summary parts of a docstring, i.e. everything but the first line. However, when the summary line is on the second line, it means that we have folded regions on both sides of a line that include newlines, which makes for a somewhat whacky experience when navigating the caret within the docstring. See the apng in the following PR for an example:
deathaxe/sublime-packages#2 (comment)
You can reproduce this by using the Python package from the Package's master
branch and the following config:
"inline_fold.rules":
[
{
"fold_selector": "comment.block.documentation.python - punctuation.definition.comment",
}
],
My proposal for this situation would be to add a configuration for context line where folding would not be applied for regions that are within n lines of the caret instead of on the same line as the caret.
Another idea related to this would be to unfold any regions that share a line with the currently active region (i.e. a region that would be folded if the caret wasn't inside it) and/or consider the additional config option here.
I've been using the package as a replacement for Fold Python Docstrings for quite a while now (and also testing the HTML class folding configuration) and I think it's definitely usable in its current form.
What do you think of publishing it? I just stubled upon this package again as I was comparing my installed (in PC configuration) vs actual packages list (on disk).
Not sure if this is even possible but some tools reload files after they are saved (for example, prettier
), and when that occurs all the area suddenly fold again which is a disturbing DX. Any ways to improve it or workaround it?
This isn't a huge priority, but I wanted to list it here as food for thought.
I'd like to only hide the class attribute text if it doesn't stand on its own line already, because that indicates that I am having exactly one attribute per line. In order to do that, I could match for \S\s+class="$
, but the current preceding_text
setting does not support this kind of flexibility.
Example:
<span class="text-danger">
some text be here. the class above should be folded
</span>
<span
class="text-danger"
>
more text. here, the class should not be folded
</span>
Hello ๐
Feel free to share your "inline_fold.rules"
with others!
Add an image so we can see it in action.
Use reactions.
Only write recipes in comments :) - I will hide any unrelated comment
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.