microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.38k stars 28.94k forks source link

Feature request: symbols tree view #5605

Closed boyvinall closed 6 years ago

boyvinall commented 8 years ago

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.

bgse commented 8 years ago

Ideally, it would expose API this for extension authors.

dbaeumer commented 8 years ago

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

boyvinall commented 8 years ago

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.

bgse commented 8 years ago

@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.

dbaeumer commented 8 years ago

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

DanTup commented 8 years ago

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?

boyvinall commented 8 years ago

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.

dbaeumer commented 8 years ago

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

DanTup commented 8 years ago

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

MartinHaeusler commented 8 years ago

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:

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".

DanTup commented 8 years ago

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

RobertoMalatesta commented 8 years ago

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

alexisgahon commented 8 years ago

@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.

GaryFurash commented 8 years ago

VOTE

leaxoy commented 8 years ago

+1

MartinHaeusler commented 8 years ago

In case that there was any doubt after my post:

+1.

dakk commented 8 years ago

+1

MartinHaeusler commented 8 years ago

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

phunghv commented 8 years ago

+1

funvit commented 8 years ago

+1

Tyriar commented 8 years ago

Hi all, prefer :+1: reactions on the original issue comment as that helps us with prioritization. If you're on a mobile device you can use reactions by first hitting the "Desktop version" button at the bottom of the page.

ozanh commented 7 years ago

+1

chun-wang commented 7 years ago

+1

sychan commented 7 years ago

+1

Zielak commented 7 years ago

Stop typing plus one, I'm listening for real updates!

LiPengfei19820619 commented 7 years ago

I'm expecting the feature appearing in VSCode.

bdesemb commented 7 years ago

+1

vegarringdal commented 7 years ago

+1

ToMakeSense commented 7 years ago

@MartinHaeusler Outline view of Eclipse is really my favorite feature in all kinds of IDEs.

MartinHaeusler commented 7 years ago

@ToMakeSense Mine too. I can't understand how people can work without it.

gertcuykens commented 7 years ago

Can you just add a Ctrl+T icon into the side bar please like the file explorer? I think just adding one more icon that opens the workspace symbol tree with a sub icon toggle button Ctrl+Shift+O in the tree panel itself is good enough for now until you have time to figure out something more advanced. image

scmaverick commented 7 years ago

So, giving my vote here, I requested the same thing, to have the Netbeans Navigator panel in VS Code as well.

ralphavalon commented 7 years ago

+1

leaxoy commented 7 years ago

this is useful for source code reading. Is there any work on it?

NonTestatum commented 7 years ago

+1

fractalspace commented 7 years ago

I vote for this feature. A must have.

38b3eff8 commented 7 years ago

+1

GaryBoone commented 7 years ago

+1 to this feature request. Here's a hack while we wait for this feature: just do a search to see a nice outline view. In the search panel, put

 function\s([_A-Za-z0-9]+)\s*\(

replacing 'function' with your language's function keyword, and hitting the "Use regular expressions" button on the right.

It doesn't show symbols, just functions, but it's useful and looks like how I'd like the real feature to look.

[Courtesy: Picard at Stack Overflow ]

vaderdan commented 7 years ago

I hacked it a bit to show top level symbols only.

You can do it too. the change is in src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts

On line 55 modify the code accordingly:


const parentEntries = this.entries.filter((entry: SymbolEntry) => {
    return entry.getType() == 'class' || entry.getType() == 'interface' || entry.getType() == 'namespace'
}).map((entry) => {
    return entry.getLabel()
})

// Check for match and update visibility and group label
this.entries.forEach((entry: SymbolEntry) => {

    // Clear all state first
    entry.setGroupLabel(null);
    entry.setShowBorder(false);
    entry.setHighlights(null);
    entry.setHidden(false);

    // Filter by search
    if (normalizedSearchValue) {
        const highlights = filters.matchesFuzzy(normalizedSearchValue, entry.getLabel());
        if (highlights) {
            entry.setHighlights(highlights);
            entry.setHidden(false);
        } else if (!entry.isHidden()) {
            entry.setHidden(true);
        }
    }
    else {
        const isHidden = (entry.getDescription() !== undefined && entry.getDescription().trim() !== '' && parentEntries.indexOf(entry.getDescription()) == -1) || entry.getLabel().trim() == '<function>' //(for anonymous funcs)
        entry.setHidden(isHidden);
    }
});

basically it checks if symbol description is empty (all items in inner scope have description - otherwise the top methods and classes don't)

Then package the vscode and you'll have tree view, kinda.

Also I have extension that will help you to further customize the symbols to look a bit more like tree view: https://marketplace.visualstudio.com/items?itemName=dannylazarov.bettergoto

AlGantori commented 7 years ago

VSCode release 1.10.0 came with this thing called minimap side view. I don't have a retina display, so perhaps that's why I did not find it useful AT ALL. I turned it off as soon as I turned it on :)

Looking forward to this "document outline" I hope it will come with some customizations like

  1. filter down to only methods I care about eg. methods, fields, props, etc....
  2. allow to switch between different sorting, like current layout versus sorting alphabetical versus by type and by access.

Both 1 and 2 features should be toggles via some toolbar buttons on this tree view pane, not some configuration thingy buried in settings.json :)

  1. Moving blocks of code reliably might become more appealing via drag-drop in this tree view pane. I can live without this, as most of my files are only 2 to 3 pages long.

I have subscribed to this issue and hope to see it closed :) soon Thank you.

drinktee commented 7 years ago

I think tagbar is better than command+shift+o

forevering commented 7 years ago

+1

LiPengfei19820619 commented 7 years ago

+1

raphael-volt commented 7 years ago

+1

skol-pro commented 7 years ago

Now that the minimap has been integrated, I really hope to see this "tagbar" concept in the near future ! <3

liuhaopen commented 7 years ago

+1

bostonsqd commented 7 years ago

+1 to this feature request.

Zielak commented 7 years ago

no more +1s please. PLEASE.

agwells commented 7 years ago

To reiterate what was mentioned a while back:

Hi all, prefer :+1: reactions on the original issue comment as that helps us with prioritization. If you're on a mobile device you can use reactions by first hitting the "Desktop version" button at the bottom of the page.

In other words, please don't comment "+1" at the bottom of this page. Instead add a :+1: to the first comment on this issue.

sbimikesmullin commented 7 years ago

why did you close this? all the related issues are marked duplicate and closed now but no solution :o

also, +1