Skip to content

Commit

Permalink
fix race condition on plugin registration. closes #645
Browse files Browse the repository at this point in the history
  • Loading branch information
mtxr committed Jul 22, 2020
1 parent 85045ef commit 8e44168
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ route: /changelog
- **Extension**
- Enhanced auto connect messages and notifications.
- Enhanced edit connection error message. [#646](https://github.com/mtxr/vscode-sqltools/issues/646).
- Fixed race condition on plugin registration. [#645](https://github.com/mtxr/vscode-sqltools/issues/645).

### v0.22.10 - (Jun 26, 2020)

Expand Down
2 changes: 2 additions & 0 deletions packages/extension/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ export class SQLToolsExtension implements IExtension {
this.pluginsQueue = [];
this.loaded = this.loaded || true;
for (let plugin of pluginsQueue) {
log.extend('info')(`registering plugin %s. type %s`, plugin.name, plugin.type);
try {
Promise.resolve(plugin.register(this)).then(() => {
if (plugin.extensionId) {
this.extPlugins[plugin.type || 'general'] = this.extPlugins[plugin.type || 'general'] || [];
if (!this.extPlugins[plugin.type || 'general'].includes(plugin.extensionId)) {
this.extPlugins[plugin.type || 'general'].push(plugin.extensionId);
}
this.updateExtPluginsInfo();
}
}).catch(err => {
this.errorHandler(`Error loading plugin ${plugin.name}`, err);
Expand Down

0 comments on commit 8e44168

Please sign in to comment.