Skip to content
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

Add option to base Sticky Scroll on indent, not Document Symbols #157165

Closed
phil294 opened this issue Aug 4, 2022 · 7 comments · Fixed by #159198
Closed

Add option to base Sticky Scroll on indent, not Document Symbols #157165

phil294 opened this issue Aug 4, 2022 · 7 comments · Fixed by #159198
Assignees
Labels
editor-sticky-scroll feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders verification-needed Verification of issue is requested verified Verification succeeded

Comments

@phil294
Copy link

phil294 commented Aug 4, 2022

Testing #156175

Basing Sticky Scroll on class/function/namespace etc. makes a lot of sense, but only as long as there is an active language server or language extension that provides good Document Symbols (Outline). For all languages that either have no LSP (so, so many), whose LSP provides no Outline, whose LSP provide invalid Outline or which simply have no concept of functions/classes etc., Sticky Scroll can not be leveraged :-(

I'd argue that in many cases the respective context could be inferred from the indentation instead. I realize this may not be desirable by default, so perhaps it should be either hidden behind a flag or configurable per language. For example, in a large JSON file, you might then get this context:

1  {
51     "a": {
52         "b": [
-----------------------------------------------
74             "current_line",
75             "..."

this is IMO immensely useful, especially for dealing with messy codebases.

Personally, I'd like to have SS in CoffeeScript, Crystal, AutoHotkey, Markdown, JSON, and pretty much everywhere else except maybe plain text files. I think it also helps a lot outside the currently selected document symbols: Why not add SS for if/else blocks, for example? Worst case scenario, it occupies one single extra line; best case scenario, it helps you navigate nicely in multi-page if-else constructs.

There is one very ugly workaround that comes to my mind: Add a generic, language-independent extension which provides indentation based document symbols, by simply marking every line as a function definition. But I hope that won't be necessary. Also not sure if that would even work, because which doc symbols does SS use when there's multiple providers?

That said, thank you so much for adding this feature, I'm so happy it's finally here ❤️

@phil294
Copy link
Author

phil294 commented Aug 4, 2022

I think the automatic issue assigning failed (?) Not sure what I did wrong, but just in case here's a ping @aiday-mar

@Animan8000
Copy link

I would also love to see this in AutoHotkey!

@phil294
Copy link
Author

phil294 commented Aug 14, 2022

So since this got put on the backlog, it won't happen anytime soon, I guess...? Could you give me a quick estimation on this? Because if it's still a long way, then I'll actually go ahead and create an extension with the questionable workaround mentioned above.

@aiday-mar
Copy link
Contributor

aiday-mar commented Aug 24, 2022

Hi @phil294 thank you for your contribution. I intend to investigate the issue in the coming days by seeing how we can use the folding ranges model to obtain a custom outline model. Not sure yet how long this will take to implement.

aiday-mar pushed a commit that referenced this issue Aug 25, 2022
@jrieken jrieken modified the milestones: Backlog, September 2022 Aug 26, 2022
@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Aug 30, 2022
@gulshan
Copy link

gulshan commented Aug 30, 2022

Is there an option now to always use the folding model for sticky scroll?

@phil294
Copy link
Author

phil294 commented Aug 31, 2022

@gulshan it only seems to be working as a fallback mechanism, nothing configurable though.

It's not yet part of the insiders build apparently, at least it did not work there for me so far.

@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Sep 2, 2022
phil294 added a commit to phil294/coffeesense that referenced this issue Sep 4, 2022
they were not in a usable state, and with next update [1], no symbols (outline) is better than broken outline, so sticky scroll still works fine

[1] microsoft/vscode#157165
@aiday-mar aiday-mar added the verification-needed Verification of issue is requested label Sep 28, 2022
@aiday-mar
Copy link
Contributor

  • To verify, open a file for which you do not have an extension containing a language server installed.
  • Verify that there is no outline in the explorer view
  • Verify that when you scroll the sticky lines are pinned at the same positions as the default start lines of the folding ranges

@rzhao271 rzhao271 added the verified Verification succeeded label Sep 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-sticky-scroll feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants