Skip to content

Commit 748c2a6

Browse files
xqzlgy2jdneo
andauthored
refactor: Change method signature to Promise (#407)
Co-authored-by: Sheng Chen <[email protected]>
1 parent 180c071 commit 748c2a6

12 files changed

+15
-15
lines changed

src/views/containerNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class ContainerNode extends DataNode {
2020
return this._project.uri && Uri.parse(this._project.uri).fsPath;
2121
}
2222

23-
protected loadData(): Thenable<INodeData[]> {
23+
protected async loadData(): Promise<INodeData[]> {
2424
return Jdtls.getPackageData({ kind: NodeKind.Container, projectUri: this._project.uri, path: this.path });
2525
}
2626
protected createChildNodeList(): ExplorerNode[] {

src/views/dataNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export abstract class DataNode extends ExplorerNode {
110110

111111
protected abstract get iconPath(): string | Uri | { light: string | Uri; dark: string | Uri } | ThemeIcon;
112112

113-
protected abstract loadData(): Thenable<any[] | undefined>;
113+
protected async abstract loadData(): Promise<any[] | undefined>;
114114

115115
protected abstract createChildNodeList(): ExplorerNode[] | undefined;
116116
}

src/views/dependencyDataProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
9494
this._refreshDelayTrigger = _.debounce(this.doRefresh, wait);
9595
}
9696

97-
public getTreeItem(element: ExplorerNode): TreeItem | Thenable<TreeItem> {
97+
public getTreeItem(element: ExplorerNode): TreeItem | Promise<TreeItem> {
9898
return element.getTreeItem();
9999
}
100100

src/views/documentSymbolNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class DocumentSymbolNode extends BaseSymbolNode {
1212
super(symbolInfo, parent);
1313
}
1414

15-
public getChildren(): ExplorerNode[] | Thenable<ExplorerNode[]> {
15+
public getChildren(): ExplorerNode[] | Promise<ExplorerNode[]> {
1616
const res: ExplorerNode[] = [];
1717
if (this.symbolInfo && (<DocumentSymbol>this.symbolInfo).children && (<DocumentSymbol>this.symbolInfo).children.length) {
1818
(<DocumentSymbol>this.symbolInfo).children.forEach((child) => {

src/views/fileNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export class FileNode extends DataNode {
1717
return false;
1818
}
1919

20-
protected loadData(): Thenable<INodeData[] | undefined> {
21-
return Promise.resolve(undefined);
20+
protected async loadData(): Promise<INodeData[] | undefined> {
21+
return undefined;
2222
}
2323

2424
protected createChildNodeList(): ExplorerNode[] | undefined {

src/views/folderNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class FolderNode extends DataNode {
1515
super(nodeData, parent);
1616
}
1717

18-
protected loadData(): Thenable<INodeData[]> {
18+
protected async loadData(): Promise<INodeData[]> {
1919
return Jdtls.getPackageData({
2020
kind: NodeKind.Folder,
2121
projectUri: this._project.uri,

src/views/hierarchicalPackageNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export class HierarchicalPackageNode extends PackageNode {
5656
}
5757
}
5858

59-
protected loadData(): Thenable<any[]> {
59+
protected async loadData(): Promise<any[]> {
6060
// Load data only when current node is a package
61-
return this.getHierarchicalNodeData().isPackage ? super.loadData() : Promise.resolve([]);
61+
return this.getHierarchicalNodeData().isPackage ? super.loadData() : [];
6262
}
6363

6464
protected createChildNodeList(): ExplorerNode[] {

src/views/packageNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class PackageNode extends DataNode {
1616
super(nodeData, parent);
1717
}
1818

19-
protected loadData(): Thenable<INodeData[]> {
19+
protected async loadData(): Promise<INodeData[]> {
2020
return Jdtls.getPackageData({
2121
kind: NodeKind.Package,
2222
projectUri: this._project.nodeData.uri,

src/views/packageRootNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class PackageRootNode extends DataNode {
2121
super(nodeData, parent);
2222
}
2323

24-
protected loadData(): Thenable<INodeData[]> {
24+
protected async loadData(): Promise<INodeData[]> {
2525
return Jdtls.getPackageData({
2626
kind: NodeKind.PackageRoot,
2727
projectUri: this._project.nodeData.uri,

src/views/projectNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class ProjectNode extends DataNode {
5252
return (childNode && paths.length > 0) ? childNode.revealPaths(paths) : childNode;
5353
}
5454

55-
protected loadData(): Thenable<INodeData[]> {
55+
protected async loadData(): Promise<INodeData[]> {
5656
let result: INodeData[] = [];
5757
return Jdtls.getPackageData({ kind: NodeKind.Project, projectUri: this.nodeData.uri }).then((res) => {
5858
const sourceContainer: IContainerNodeData[] = [];

0 commit comments

Comments
 (0)