Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Oct 11, 2016

Fixes #11250

Since we're defining a new data structure, it might be a good time to define enums for ScriptElementKind and ScriptElementKindModifier rather than strings.

@ghost ghost assigned mhegazy and vladima Oct 11, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Oct 11, 2016

@Andy-MS can you also port this to release-2.0.5

@ghost ghost merged commit 4fde1af into master Oct 12, 2016
@ghost ghost deleted the navtree branch October 12, 2016 16:01
@angelozerr
Copy link

@Andy-MS could you explain please the difference between navtree and navbar? I have noticed that VSCode uses navtree. In my case I use navbar to fill Eclipse Outline.

Is navtree is more performant than navbar? The only difference that I have noticed is that body is an object and not an array like navbar.

Many thanks for your answer.

@ghost
Copy link
Author

ghost commented Oct 19, 2016

navigationBarItemsFunctions is a good example.

It says that given this code:

function foo() {
    var x = 10;
    function bar() {
        var y = 10;
        function biz() {
            var z = 10;
        }
    }
}

function baz() {
    var v = 10;
}

with the navigation tree, we get output represented as a tree:

<global>
    baz
        v
    foo
        bar
            biz
                z
            y
        x

and with the navigation bar, we get a dual-column setup:

<global>
    baz
    foo
baz
    v
foo
    bar
    x
bar
    biz
    y

If the outline view supports N levels of nesting, you should use a tree, but if it only supports one, you should use the navigation bar.

(The navigation bar also makes some decisions about what's worthy of showing up in the left column, so biz only shows up on the right, so z never shows up at all.)

As for performance, I wouldn't expect much difference, because they share most of their code. The tree output will generally be smaller, as the navigation bar needs to duplicate entries for the left and right columns.

@angelozerr
Copy link

Many thanks @Andy-MS for your great explanation!

I have integrated navtree inside typescript.java. Here the result:

  • If you are using TypeScript < 2.0.6, Outline will be filled like this:

  • otherwise the Outline will be filled like this:

See https://github.com/angelozerr/typescript.java/wiki/New-and-Noteworthy-1.1.0#outline-as-tree

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants