Files
azuredatastudio/samples/sqlservices
Alexander Ivanov ccde5123fa Improve tree control sample. (#14549)
While working on the tree control for our extension, I noticed that the sample implementation was not optimal. For instance, `vscode.TreeDataProvider.onDidChangeTreeData` should only be called once for the top-most node that has changed, as all children will be refreshed as well.

This change updates the code of the sample to track state changes during propagation and only raise the event for the top-most parent node that has its state changing.

There also was an issue with root node `1` not rendering, which impacted the new algorithm, as it was not refreshing the tree, when invisible root was changing. In order to address this, I updated `getChildren` to actually return the `1` node, when root was requested. This in turn changed the presentation (`1` is now rendered in the tree) and addressed the problem with tree not refreshing when `1` is the node that raises the event.

Lastly, there is one more optimization that I didn't make due to the bug that is in the works: `getTreeItem` can actually return the `element` directly, without the copy, as it already implements `TreeComponentItem`. The problem currently is that `TreeNode` also defines an `id`, which causes an error during refresh. Once that is addressed - this part can be optimized as well.
2021-03-04 11:38:30 -08:00
..
2020-11-04 13:07:20 -08:00
2021-03-04 11:38:30 -08:00
2018-04-13 15:59:18 -07:00
2018-04-13 15:59:18 -07:00
2020-12-14 20:28:43 -08:00

This is a sample extension that will show some basic model-backed UI scenarios. The long-term goal is to use SQL Service querying (e.g. see if Agent and other services are running) and visualize in interesting ways. Additional suggestions for improving this sample are welcome.

Run the following commands to produce an extension installation package

  • yarn install - to install the dependencies
  • yarn build - to build the code
  • vsce package - to produce an extension installation package

Launch ADS Dev instance with this extension

  • yarn install - to install dependencies
  • yarn build - to build the code
  • Launch VSCode and open the azuredatastudio's code folder, run the 'Launch azuredatastudio' debug option (to work around the issue. The next step won't work without doing this first)
  • Launch VSCode and open this folder, run the 'Debug in enlistment'
  • Once ADS launches, you should be able to run the sqlservices commands, for example: sqlservices.openDialog