mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
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.
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 dependenciesyarn build- to build the codevsce package- to produce an extension installation package
Launch ADS Dev instance with this extension
yarn install- to install dependenciesyarn 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