Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Custom view API improvements #44364

Closed
3 tasks done
sandy081 opened this issue Feb 25, 2018 · 0 comments
Closed
3 tasks done

Test: Custom view API improvements #44364

sandy081 opened this issue Feb 25, 2018 · 0 comments

Comments

@sandy081
Copy link
Member

sandy081 commented Feb 25, 2018

Refs: #28974,
#32012,
#30288,

Complexity: 4

Write an extension that contributes a tree view to the Explorer. Refer to documentation and [samples] (https://github.com/Microsoft/vscode-extension-samples/tree/master/tree-view-sample).

Tree alignment

  • A place holder icon will be shown for the nodes with children, if there are other nodes with children has icons.
  • An empty place holder will be shown in the place of icon for the nodes without children, if there are other nodes without children has icons.
  • Test that alignment of the tree in various following cases
    • All nodes have icon
    • Only container nodes have icon
    • Only leaf nodes have icon
    • Some container nodes have icon
    • Some leaf nodes have icon
    • Some nodes have icons contributed from File Icon themes (Use resourceUri property on TreeItem) and some are directly contributed.
    • In Different file icon themes

Tooltip

  • Now you can provide toolTip to a tree item using tooltip property on TreeItem. Test that tool tip is shown in the tree view when provided.

reveal proposed API

  • Copy vscode.proposed.d.ts into your extension.
  • Enable your extension to use proposed api by adding following flag to package.json
"enableProposedApi": true
  • Test the documentation of new TreeView API in vscode.proposed.d.ts
  • Now extension authors can programmatically reveal a node in the custom view using this API. This API needs your tree data provider to implement an additional method getParent.
  • Implement a tree data provider that has getParent method. Example here
  • Register the tree data provider using the proposed API that returns TreeView.
export function registerTreeDataProvider<T>(viewId: string, treeDataProvider: TreeDataProvider<T>): TreeView<T>;
  • Implement and register a command that will call reveal API on the TreeView. See above example for reference.
  • Make sure that the requested node is shown in the view, when reveal is called on that node. By default revealed node is selected. You can reveal without selecting by passing appropriate options to reveal API.
  • Reveal API throws error if the data provider does not implement getParent method
  • Test revealing the node in following cases
    • When the node is loaded/seen by the user.
    • When the node is not loaded. This will call getParent method to load the parent chain of the node and reveal it.
    • When the view is collapsed
    • When the view is not shown aka a different viewlet is shown.
    • When the view is hidden using the context menu.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants