From d35b4dff6e93b71e1f8d8a9c29e93632461f9b05 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Fri, 29 Jan 2016 21:22:16 +0100 Subject: [PATCH] Added listImports, bump version to 0.8.0 --- package.json | 2 +- src/workspace-d.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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); }