forked from mxsdev/ts-type-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: only request type data when it is visible in the treeView
- Loading branch information
Showing
2 changed files
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
import * as vscode from "vscode" | ||
import { StateManager } from "../state/stateManager" | ||
import { TypeTreeProvider } from "./typeTreeView" | ||
import { TypeTreeItem, TypeTreeProvider } from "./typeTreeView" | ||
|
||
export type ViewProviders = { | ||
typeTreeProvider: TypeTreeProvider | ||
} | ||
|
||
export let treeView: vscode.TreeView<TypeTreeItem> | undefined | ||
|
||
export function createAndRegisterViews( | ||
context: vscode.ExtensionContext, | ||
stateManager: StateManager | ||
): ViewProviders { | ||
const typeTreeProvider = new TypeTreeProvider(stateManager) | ||
|
||
context.subscriptions.push( | ||
vscode.window.registerTreeDataProvider("type-tree", typeTreeProvider) | ||
) | ||
treeView = vscode.window.createTreeView("type-tree", { | ||
treeDataProvider: typeTreeProvider, | ||
}) | ||
|
||
context.subscriptions.push(treeView) | ||
|
||
return { typeTreeProvider } | ||
} |