Skip to content

Commit d35b4df

Browse files
author
WebFreak001
committed
Added listImports, bump version to 0.8.0
1 parent bbd4f73 commit d35b4df

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-d",
33
"description": "auto-complete, snippets, linter and formatter for dlang",
4-
"version": "0.7.0",
4+
"version": "0.8.0",
55
"publisher": "webfreak",
66
"repository": {
77
"type": "git",

src/workspace-d.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export class WorkspaceD extends EventEmitter implements
320320
setConfiguration(config: string) {
321321
this.request({ cmd: "dub", subcmd: "set:configuration", configuration: config }).then((success) => {
322322
if (success) {
323-
this.request({ cmd: "dub", subcmd: "list:import" }).then(console.log);
323+
this.listImports().then(console.log);
324324
this.emit("configuration-change", config);
325325
}
326326
else
@@ -377,7 +377,7 @@ export class WorkspaceD extends EventEmitter implements
377377
if (this.dcdReady) {
378378
this.request({ cmd: "dcd", subcmd: "refresh-imports" }).then(() => {
379379
resolve(true);
380-
this.request({ cmd: "dub", subcmd: "list:import" }).then(console.log);
380+
this.listImports().then(console.log);
381381
});
382382
} else {
383383
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
387387
});
388388
}
389389

390+
listImports(): Thenable<string[]> {
391+
if (!this.dubReady)
392+
return new Promise((resolve, reject) => { resolve([]); });
393+
return this.request({ cmd: "dub", subcmd: "list:import" });
394+
}
395+
390396
getDlangUI(): DlangUIHandler {
391397
return new DlangUIHandler(this);
392398
}

0 commit comments

Comments
 (0)