scalameta / metals-feature-requests

Issue tracker for Metals feature requests
37 stars 4 forks source link

multiline `package` declarations take a lof of space in Sticky Scroll (VS Code) #328

Open Sporarum opened 1 year ago

Sporarum commented 1 year ago

Is your feature request related to a problem? Please describe.

When sticky scroll is enabled on a file that begins like

package outer
package middle
package inner

Those 3 lines take the majority of the sticky scroll, which reduces available space to look at the code Especially since Scala already encourages nesting, so the sticky scroll can easily be more than 6 lines long (for example 3 for package, 1 for class, 2 for nested methods, 1 for current innermost method)

Describe the solution you'd like

A setting in metals to skip over package lines for sticky scroll

Describe alternatives you've considered

It would also be possible to automatically collapse the multiple package declarations into a single one: package outer.middle.inner, as the semantics are similar (but not equivalent !)

Additional context

No response

Search terms

sticky scroll, package, vs code, quality of life

ckipp01 commented 1 year ago

Thanks for the report @Sporarum although I'm not really sure this is anything that we can address in Metals. As far as I know, Metals has nothing to do with sticky scroll as it's a feature of VS Code. Maybe as an alternative you can utilize code folding and just fold your imports?

tgodzik commented 1 year ago

Actually, we could address it in Metals, but not sure if we should. Sticky scroll uses document outline and we could possibly collapse multiple packages into one, but this would mean that they would be treated as one declaration. Or maybe that would be better, since having them separate doesn't really add anything?

ckipp01 commented 1 year ago

Actually, we could address it in Metals, but not sure if we should. Sticky scroll uses document outline and we could possibly collapse multiple packages into one, but this would mean that they would be treated as one declaration. Or maybe that would be better, since having them separate doesn't really add anything?

Ahh, so it'd be something custom in the VS Code plugin then right?

Sporarum commented 1 year ago

since having them separate doesn't really add anything?

I'm not sure I understand what you mean, but be careful IIRC:

package A
package B

is equivalent to

package A.B
import A.*

And not just

package A.B

Ahh, so it'd be something custom in the VS Code plugin then right?

That's what I was thinking (I am assuming it is possible)

tgodzik commented 1 year ago

Sitcky scroll uses the existing textDocument/documentSymbol, so we would need to change the results we get there.

I'm not sure I understand what you mean, but be careful IIRC:

This is just presentation, it has nothing to do with types, but true this could potentially be misleading