Code structure headers were introduced in version 10 and are quite handy. However, it lacks the precision of other implementations. In particular, Visual Studio Code shows more context for inline callbacks and, most useful, for properties in JSON files: sticky scroll - YouTube
Thus, I was wondering if there is a way to customise that behaviour (perhaps, by setting specific scope names in language grammars) but couldn’t find anything in the API docs. Are there any published insights on how this works?
Code structure headers are currently built from any symbol that has a range extending below the line intersecting the top of the editor.
A custom language grammar can gain headers just by ensuring that a symbol has its full scoped range as part of its definition (e.g., for a class, this would include its defining line all the way up to the end of its containing brackets / “end” keyword).