vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Feature request: symbols tree view

Open boyvinall opened this issue 10 years ago • 152 comments

VSCode very quickly got to nearly being my default editor. One thing I'm missing is something like https://atom.io/packages/symbols-tree-view where I can view the structure of a file whilst editing. I've used this view across many editors for years.

boyvinall avatar Apr 21 '16 12:04 boyvinall

Ideally, it would expose API this for extension authors.

bgse avatar Apr 21 '16 13:04 bgse

This is available though not as a separate view and a flat list. You can press Ctrl+Shift+O to get a symbol outline of the currently open file.Ctrl+T shows all symbols in the workspace. You can type in there to filter the list down.

capture

dbaeumer avatar Apr 21 '16 13:04 dbaeumer

Thanks Dirk. Yes, I saw that already, but I find it less of an interruption when that view is constantly onscreen in a separate panel. Also, the ability to filter this list so as e.g. not to include variables is useful - which is harder to do in a pop-down view.

boyvinall avatar Apr 21 '16 13:04 boyvinall

@dbaeumer Sometimes, this seems to cut off unnecessarily early, see here:

vscode_outline

Thinking about it, I probably even like the current approach better, need to get used to it a little, but it is faster to use compared with traditional outline presentation.

bgse avatar Apr 21 '16 13:04 bgse

@bgse known issue. I opened a issue in the TS repository for this.

dbaeumer avatar Apr 22 '16 08:04 dbaeumer

Had a request for this for Dart Code. Am I right in assuming we can't implement this (even ourselves) and would need support from Code?

DanTup avatar Aug 17 '16 18:08 DanTup

Not sure TBH. I'm still interested in it, but my (available_time / skill_set_proficiency) isn't likely to find me investigating any time soon. Appreciate any other efforts here.

boyvinall avatar Aug 17 '16 21:08 boyvinall

@DanTup you mean a tree view. Yes. this would need support from the Workbench. Filling the Ctrl+Shift+O flat list is API.

dbaeumer avatar Aug 18 '16 07:08 dbaeumer

@dbaeumer Yeah, I meant the tree - we're already providing the document symbols for the flat list. Thanks for confirming!

DanTup avatar Aug 18 '16 09:08 DanTup

As I mentioned in #10788 , the "symbols tree view" could be made a LOT more powerful than in atom. In my humble opinion, Eclipse got that aspect of the UI absolutely right. Here's a screenshot of the outline view displayed by Eclipse for a Java file:

outline

There are several things worth mentioning here:

  • The view is a sidebar and permanently visible. It is always in sync with the current file in the editor.
  • It's a tree view, where each class is a node and every member of that class becomes a child of the class node. Nodes can be collapsed or expanded, as with any other standard tree.
  • The view displays a lot more information than the plain element names
    • The shape/silhouette of icons for fields are different than the icons of methods to allow to distinguish them easily
    • Icons have decorators to indicate that a member is final (a.k.a. readonly), static, abstract, or overrides a declaration in the parent class (to name a few examples)
    • The color of the icons indicate their visibility (public = green, protected = yellow, private = red)
    • The type of each field is written directly after the name
    • The parameter types and return types are written directly after method names. This also allows to easily see the number of parameters at a glance.
  • A click on a member jumps to the declaration in the code
  • There are also refactoring features built into this UI in Eclipse:
    • Dragging a member and dropping it to another position also refactors the code by moving the code block belonging to that member to the position indicated by the drop target.
    • Deleting a tree node also deletes the corresponding sections of code in the file.
    • Any node has a context menu that allows for different operations, e.g. rename
  • The context menu also offers things like "find references" or "open call hierarchy"
  • A toggle button on the UI allows to switch between alphabetic sorting and "as occurs in file" sorting in the outline display.
  • The current cursor position is shown in the outline view by highlighting the member (or class) where the cursor currently resides within. E.g. if my cursor is within method "bar()" of class "Foo", then the outline will highlight the tree node "Foo" and the child node "bar()".

I think that this particular feature is brilliantly done in Eclipse, and I would love to see it realized in VScode for Typescript in particular. When I navigate through code in Eclipse and search for something, it's usually just a sequence of "open type -> check outline". You don't even have to look at the source code for navigation, which makes it very fast, elegant and "brain friendly".

MartinHaeusler avatar Aug 23 '16 11:08 MartinHaeusler

If you do add support for a tree; could you also consider allowing it to be used for type hierarchy too? Had that request too, but current ideas (eg. using quick pick) kinda suck: https://github.com/Dart-Code/Dart-Code/issues/133

DanTup avatar Aug 28 '16 15:08 DanTup

Having a Object Viewer / Structure Inspector / Class Hierarchy tree integrated into the View Bar and Side Bar (components A,B in graph below) VSC UI

would be a great improvement for user experience and code navigation.

I asked for it in #397 and then again in #6376 to no avail.

Last time I looked at the APIs there was no way to interact with Side & View Bar in order to create it as an external plug-in.

--R

RobertoMalatesta avatar Sep 07 '16 16:09 RobertoMalatesta

@MartinHaeusler is right. You should focus and working on this feature as in Eclipse. It would definitely one of your killing feature to stand against Atom / Sublime.

alexisgahon avatar Sep 13 '16 08:09 alexisgahon

VOTE

GaryFurash avatar Sep 22 '16 15:09 GaryFurash

+1

leaxoy avatar Sep 24 '16 21:09 leaxoy

In case that there was any doubt after my post:

+1.

MartinHaeusler avatar Sep 24 '16 21:09 MartinHaeusler

+1

dakk avatar Sep 29 '16 07:09 dakk

Is this being looked at? For me, this would be really important.

MartinHaeusler avatar Oct 05 '16 12:10 MartinHaeusler

+1

phunghv avatar Oct 07 '16 07:10 phunghv

+1

funvit avatar Oct 07 '16 12:10 funvit