-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Sticky scroll - keep containers headers visible when scrolling #26757
Comments
Interesting idea! @egamma @alexandrudima FYI. |
I really like the idea, I have something very similar. I believe code folding could be use many ways to make code easier to absorb. |
I don't know any other editor with this kind of code folding feature. |
Hello,
So what I would like to see is more (+) in the left border to indicate a way to collapse or expand. Also this can be a lot easier to get in vscode if there are not a lot of limits. The OP made six points ATTOW and so:
This is one of those so simple looking additions to the editor that it would be a crime to leave out. Thank you. Good day. |
I thought user may not want to keep this settings on always. It will help more in code exploring situations. But may be someone will want to keep it on permanently. Then I have no objection to a permanent settings. Regarding branching nodes like if, else-if, else, cases for switch or others, it's true that freezing previous sibling node headers violates indent based folding expectations and the feature will then require language awareness of some sort. So the first or baseline implementation can leave it. But I think it's still a nice to have enhancement and language servers should be able to contribute to this part. |
One thing! When this feature is turned on, the usual code-folding has to be turned off. So enabling this can be part of |
This tweet has a nice illustration for this feature- |
Since the frozen part will take vertical space, it's better to limit the rows and collapse the middle rows with an explicit expand button. Something like this: class Foo{
...Expand 3+ hidden parent nodes...
constructor(public name:string){
---------------------------------------
// other codes...
}
} |
We could try that for breadcrumbs. I have created #75776 to make breadcrumbs being driven by the viewport, not the selection |
Hello, class Foo{
class Bar{
...Expand 3+ hidden parent nodes...
constructor(public name:string){
---------------------------------------
// other codes...
}
}
} OR ...Expand 3+ hidden parent nodes...
class Bar {
constructor(public name:string){
---------------------------------------
// other codes...
}
}
} Would it seem nice to always keep it all visually stacking? some languages nest better but it would look clumsy with this. Other languages are so thin in that you rarely nest but need to know scope. Thank you. Good day. |
@jrieken That can be a nice thing. Thanks for consideration. |
Something very, very much like this can be seen here: https://searchfox.org/mozilla-central/source/layout/generic/nsTextFrame.cpp#1229 |
👀 |
This is a great suggestion. Arguably the easiest, hackiest way to achieve this as an extension / styles override would be set the Sticky breadcrumbs based on nesting level is in general a feature that I am dearly missing in all websites and tools I know, be it Wikipedia, Reddit, or VSCode. |
https://twitter.com/NathanBLawrence/status/1544751141363167232?s=20&t=XbLO4-JgAxRiO0VVNzkwSA |
I don't think so. There's nothing that prevents you from having a collapsed function and when scrolling along just treat it as a single line. When the line is expanded you can see its contents, while when collapsed it's just like any other "single line statement" and you do no longer have to care about any of its child/nested contexts. Preferably you could even explicitly allow for folding the current contexts you are in, to allow for skipping to the next context. |
For anyone who's watching this issue, sticky-scroll is available as an experimental feature in today's release! https://code.visualstudio.com/updates/v1_70#_editor-sticky-scroll |
Why it only works for TS files? Is that intended? |
It doesn’t. I see it in Python files, too. I guess the language needs to expose a certain structure while it is in experimental state. Besides that here isn’t the right place to troubleshoot. |
@FezVrasta what language are you missing it in? Maybe the extension which adds that language to VS Code doesn't implement a DocumentSymbolProvider, or doesn't return the types of symbol that the new feature is driven off. |
Babel |
I'm properly seeing the semantic scroll work in C (haven't checked C++ yet), but with the headings only generated for the actual function I'm in, but not control structures within the function. Is this intentional? Or could there at least be a setting to enable this? With just the top-level header of the function this doesn't bring any advantages over the existing line above it:
Also I noticed a minor strangeness in that trying to scroll up, the cursor seems to move into a line hidden by the sticky-scroll display. Overall I like the feature and am looking forward to see these minor issues resolved in an upcoming version. NB: Screenshot done against htop-dev/htop@3e1908b in case someone needs the exact source to reproduce. Feel free to ask for further details as needed. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@The-Compiler please see #157185 (comment) |
Whoops, I missed that - thanks for the pointer and sorry for the noise! 👍 |
Thank you for all your comments and interest. If you are interested to see the latest new behavior of sticky scroll you may install the VSCode Insiders release for testing (https://code.visualstudio.com/insiders/). Some of the recurring issues have been solved there. These changes will appear in next month's stable release. |
To verify: Open a file, scroll in it |
This is a feature request. Starting with an example. Suppose we have following c# file-
If we are browsing the file at the end, it looks like this now-
And with this feature, I wish it to look something like this-
It means the parent syntax nodes of the area being browsed is automatically freezed, so that the user can easily guess the context of the current code, regardless of how far the parent nodes are. Some points being-
Edit:
Found a nice illustration for this feature from this tweet-
The text was updated successfully, but these errors were encountered: