vscode-code-outline icon indicating copy to clipboard operation
vscode-code-outline copied to clipboard

Is it possible to disable expand/collapse on click?

Open radix opened this issue 7 years ago • 5 comments

I click on tree nodes to jump to the source code in my editor, but when I do, it expands the tree even when I don't click on the collapse arrow (i.e. just when I click on the name of the thing I want to jump to). This means I end up with tons of expanded things in my code outline, or that I have to click extra times to collapse them again after I expand them.

I think it would be better to only expand when clicking on the arrow to explicitly expand the item. If that's unacceptable, a configuration option to disable it would also help.

radix avatar Jul 03 '17 02:07 radix

Unfortunately that is a problem with how VSCode currently implements tree views 😞

patrys avatar Jul 03 '17 09:07 patrys

Any [hope for] progress now? Any workaround not to use tree view then? For example, I need only function names to see. So, I tried:

    "symbolOutline.expandNodes": [],
    "symbolOutline.sortOrder": [
        "Function",
    ],

but...it has no effect :D Functions still expanding and not only items in outline :(

Frodox avatar Dec 13 '17 22:12 Frodox

I also use Code Outline for its table of contents of functions and methods, as a way to quickly jump to the right place in my code. Expanding the tree view interrupts this process, somewhat.

Would it be possible to add a config that causes the tree view to be populated with only the function name (so no disclosure widget)? It would be worthwhile (to me) to lose the ability to expand function names if it meant an easy way to jump straight to a function without the extra scrolling that an expanded tree view requires. Maybe "symbolOutline.expandNodes": false?

Edit: I was able to hack this change by commenting out parent.addChild(currentNode); at line 123.

JeffBerman avatar Feb 07 '18 17:02 JeffBerman

set the following setting and it will stop expanding folders on singleClick "workbench.list.openMode": "doubleClick"

brainJamStark avatar Feb 21 '18 09:02 brainJamStark

This seems worse to me as a solution, because you still need to double click to navigate to that section, and I prefer single click in the other explorer tabs personally. I could see this working if:

  1. Code Outline can have a setting that enables this for just its section
  2. Single clicking can still be detected, and this will navigate the user to the desired location

thejtshow avatar Feb 28 '18 12:02 thejtshow