In python , can I somehow use # %% as top hierarchy in outline for VS Code?

I read this. How can you configure python outline mode in VS Code to show only classes and methods

But VS Code 1.40.0 can not do yet. Spyder can do nearly, but I want to use VS Code. What I want to do is only one.

Can I somehow make VS Code show

    # %% Top hierarchy
    def abc():

    # %% Top hierarchy
    def xyz():

as

 Top hierarchy
   abc
 Top hierarchy
   abc

in outline ?

Or should I wait for next version?

1 answer

  • answered 2019-11-08 17:42 Ian Huff

    Hey KennylSHIMURA (I'm a developer on the VSCode Python Extension),

    The outline explorer in Spyder functions differently from the Outline window in VS Code. Both IDEs have the concept of code cells (areas of code marked by # %%). But in VS Code they are just used for navigating inside the file and in submitting blocks to the Interactive Window. They do not show up in the Outline window. If you want, you could suggest this on our github page here as a suggestion:

    https://github.com/microsoft/vscode-python