Search code examples
treeviewvscode-extensions

Why the vscode tree view file item has a larger indentation than it should be?


I am currently developing an Vscode Extension, it uses TreeView.
The TreeView works fine, but it has one problem:

Why the vscode tree view file item has a larger indentation than it should be?
(folder item seems have correct indentation)

Is there any config I missed? Or what are the potential causes?


As graph shows: indentation chrome dev tool


(for the code, its complex, not worth showing; I may update a easier one later.)



Update:

  1. I made another simpler Normal Tree View, and the indentation is indeed there
    -- its: file's icon is aligned with the folder's icon
    -- its not: file's icon is aligned with the folder's > arrow
  2. but, mine's indentation is still even larger than that Normal one, Idk why
    -- file's icon is aligned with the folder's icon + more to the right
  3. I tried & found that the missing of align-icon-with-twisty css class is the key, but I have no idea why its missing (see graph)
    align-icon-with-twisty css class

Solution

  • Remove the parent folder's icon fixed the indent problem.

    (no idea why)