Skip to content

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

@phil294

Description

@phil294

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 ❤️

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions