Add a Tree View

Example of adding a tree view here

Creating the view

Instructions here are similar to Add a Tree View. Please jump to documentation there for additional details.

Integrate the view with the plugin

  1. Add new enum to DendronTreeViewKey
    export enum DendronTreeViewKey {
        ...,
        TREE_VIEW_V2 = "dendron.tree-view",
    }
    
  2. Edit description to TREE_VIEWS
    TREE_VIEWS = {
        ...,
        [DendronEditorViewKey.TREE_VIEW_V2]: {
            ...
        },
    }
    
  3. Update constants.ts
  • src/constants.ts
    DENDRON_VIEWS = [
        ...,
        {
            ...treeViewConfig2VSCodeEntry(DendronTreeViewKey.TREE_VIEW_V2),
            where: "explorer",
        },
    ]
    
  1. Update package.json

    1. Inside of vscode, use > Run Task
    2. Execute gen:config to update package.json`

  2. Create the webview
    • see src/views/DendronTreeViewV2.ts for an example
  3. Initialize webview on start
    DendronExtension {
        ...
        setupViews {
            ...
            const provider = new DendronTreeViewV2();
            vscode.window.registerWebviewViewProvider(
                DendronTreeViewV2.viewType,
                provider,
            )
        }
    }
    

Backlinks