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 Tree API additions #62073

Closed
2 tasks done
sandy081 opened this issue Oct 29, 2018 · 0 comments
Closed
2 tasks done

Test Tree API additions #62073

sandy081 opened this issue Oct 29, 2018 · 0 comments
Assignees
Milestone

Comments

@sandy081
Copy link
Member

sandy081 commented Oct 29, 2018

Testing #55879 #61313

Complexity: 3

Set Up

  • Use the Tree View Sample Extension
  • This contributes a Test View to explorer
  • Use that view for testing
  • Feel free to improvise testing by changing that view testView.ts.
  • Change the vscode.engine to * in package.json before doing npm install to get latest vscode.d.ts and revert it back.
  • Launch the extension

Expand option in reveal API

You can now expand an element while revealing it. You can also recursively expand the element's descendants maximum up to 3 levels.

  • There is a command contribution in testView.ts that reveals an element when you provide a label
vscode.commands.registerCommand('testView.reveal', async () => {
	const key = await vscode.window.showInputBox({placeHolder: 'Type the label of the item to reveal'});
	if (key) {
		await view.reveal({ key }, { focus: true, select: false, expand: true });
	}
});
  • Tweak expand value to boolean or number and verify expansion is working as expected.

Collapse All action (Proposed)

You can now have a collapse all action for your tree view by passing showCollapseAll flag to true while creating the view.

const view = vscode.window.createTreeView('testView', { treeDataProvider: aNodeWithIdTreeDataProvider(), showCollapseAll: true });
  • Make sure Collapse all action is shown in the title for the view and test whether it is working as expected.

Label Highlights (Proposed)

You can now provide ranges of the label to highlight

function getTreeItem(key: string): vscode.TreeItem2 {
	const treeElement = getTreeElement(key);
	return {
		label: <vscode.TreeItemLabel>{ label: key, highlights: key.length > 1 ? [[key.length - 2, key.length - 1]] : void 0},
		tooltip: `Tooltip for ${key}`,
		collapsibleState: treeElement && Object.keys(treeElement).length ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None
	};
}
  • Test if provided ranges are properly highlighted in the view
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

3 participants