rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

feature request: deeper display for outline functions

Open R3XP opened this issue 3 years ago • 7 comments

I think that it would be nice to have the outline go deeper into functions and also show match arms as an entry image

R3XP avatar Jul 29 '22 14:07 R3XP

I think that would be far too cluttered. The outline is supposed to be an outline, not a complete syntax tree.

flodiebold avatar Jul 29 '22 14:07 flodiebold

Yeah, the outline is just meant to be an item-level outline of the code. What's the use case for making it so detailed? Maybe there's a better way to show the information you're looking for.

jonas-schievink avatar Jul 29 '22 22:07 jonas-schievink

I personally just like the feeling of the outline in my react project, where I can easily find functions in the outline even when I just remember the code vaguely (as you can see below) - but it's probably just a personal preference ^^ image

about the clutter tho - you could just close the tabs down if you dont want them to clutter the outline afaik

R3XP avatar Jul 31 '22 20:07 R3XP

We can (and do) show nested items:

image

But I don't think it makes sense to show function calls or match arms. Does that even happen in the screenshot you've posted?

lnicola avatar Jul 31 '22 20:07 lnicola

Well yes and no - the useEffect() is a function call, however afaik there are no match statements in react ^^"

R3XP avatar Aug 12 '22 08:08 R3XP

the useEffect() is a function call

It has a special meaning in react that has non-local effects. The outline doesn't show all function calls for react either.

bjorn3 avatar Aug 12 '22 08:08 bjorn3

I don't know much about React, but I imagine JavaScript still has switch?

We show items in the outline (functions, traits, structs, impls), but not expressions. I don't think we should include local variables or match arms. Those often look like this:

image

Other than useEffect, we don't show less information than the JS/React extension.

lnicola avatar Aug 12 '22 08:08 lnicola

Closing this as wontfix. As mentioned before, the outline is meant for items, not arbitrarily small syntax like match arms.

jonas-schievink avatar Jan 31 '23 14:01 jonas-schievink