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

Scope-based cursor location information #2271

Open
susuro opened this issue May 17, 2023 · 3 comments
Open

Scope-based cursor location information #2271

susuro opened this issue May 17, 2023 · 3 comments

Comments

@susuro
Copy link

susuro commented May 17, 2023

Is your feature request related to a problem? Please describe.
When analyzing code in a large source file, it is often troublesome to tell the current position in the scope hierarchy - current class/object (inner class/inner object), current method (and nested method), etc.

Describe the solution you'd like
I would like to have the nested scope hierarchy of the cursor position presented in the editor. For example, in the following case (Scala 3):

object Outer:
  object Inner:
    def outer:
      def inner:
        new Trait:
          // I'm here

when the cursor is in the line with "I'm here", the information should be:
Outer$: Inner$: outer: inner: Trait
It can be presented as part of the LSP server status information (in the lower left corner of the editor window).

Describe alternatives you've considered
An alternative could be a dedicated panel presenting code structure, with the possibility to follow the cursor position. It would be more powerful (allowing code navigation) but it would require significant enhancement of Sublime Text.

Additional context
VS Code has similar functionality ("Outline" with "Follow cursor" option).

@predragnikolic
Copy link
Member

To drop additional ideas,
Fleet uses the status bar to display hierarchy information.
(although it uses it for the file structure, but we could use it to display the DocumentSymbol Hierarchy,
like Outer > Inner > outer > inner > Trait )

image

@rchl
Copy link
Member

rchl commented May 17, 2023

We wouldn't be able to navigate to given symbol by clicking though.

@susuro
Copy link
Author

susuro commented May 18, 2023

Thank you for your prompt replies.
Yes, this is what I meant - the status bar is a perfect place for the DocumentSymbol hierarchy. (I believe that the current file and path information in the status bar provides significantly less value than the contextual position in the file).
And yes, such presentation is limited in comparison to the "Outline with follow cursor" option. It should be relatively easily achievable, though. Small yet very helpful step :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants