diff --git a/package.json b/package.json index 157207d..6f44d0f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-d", "description": "auto-complete, snippets, linter and formatter for dlang", - "version": "0.7.0", + "version": "0.8.0", "publisher": "webfreak", "repository": { "type": "git", diff --git a/src/workspace-d.ts b/src/workspace-d.ts index fcae812..509610e 100644 --- a/src/workspace-d.ts +++ b/src/workspace-d.ts @@ -320,7 +320,7 @@ export class WorkspaceD extends EventEmitter implements setConfiguration(config: string) { this.request({ cmd: "dub", subcmd: "set:configuration", configuration: config }).then((success) => { if (success) { - this.request({ cmd: "dub", subcmd: "list:import" }).then(console.log); + this.listImports().then(console.log); this.emit("configuration-change", config); } else @@ -377,7 +377,7 @@ export class WorkspaceD extends EventEmitter implements if (this.dcdReady) { this.request({ cmd: "dcd", subcmd: "refresh-imports" }).then(() => { resolve(true); - this.request({ cmd: "dub", subcmd: "list:import" }).then(console.log); + this.listImports().then(console.log); }); } else { vscode.window.showWarningMessage("Could not update DCD. Please restart DCD if its not working properly"); @@ -387,6 +387,12 @@ export class WorkspaceD extends EventEmitter implements }); } + listImports(): Thenable { + if (!this.dubReady) + return new Promise((resolve, reject) => { resolve([]); }); + return this.request({ cmd: "dub", subcmd: "list:import" }); + } + getDlangUI(): DlangUIHandler { return new DlangUIHandler(this); }