Skip to content

Commit 8b07599

Browse files
committed
Fix error message when adding assembly from workspace
1 parent aaed6b5 commit 8b07599

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

vscode-extension/src/commands/decompileAssemblyInWorkspace.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export function registerDecompileAssemblyInWorkspace(
1616
return vscode.commands.registerCommand(
1717
"ilspy.decompileAssemblyInWorkspace",
1818
async () => {
19-
// The code you place here will be executed every time your command is executed
2019
const assembly = await pickAssembly();
2120
if (assembly) {
2221
await addAssemblyToTree(
@@ -36,7 +35,9 @@ async function pickAssembly(): Promise<AssemblyQuickPickItem | undefined> {
3635
createAssemblyQuickPickItem(info)
3736
);
3837
if (quickPickItems.length === 0) {
39-
vscode.window.showInformationMessage("No assembly found inside the workspace");
38+
vscode.window.showInformationMessage(
39+
"No assembly found inside the workspace"
40+
);
4041
} else {
4142
return await vscode.window.showQuickPick<AssemblyQuickPickItem>(
4243
quickPickItems
@@ -70,15 +71,17 @@ async function findAssemblies(): Promise<string[]> {
7071
/*include*/ "{**/*.dll,**/*.exe,**/*.winmd,**/*.netmodule}",
7172
/*exclude*/ "{**/node_modules/**,**/.git/**,**/bower_components/**}"
7273
);
73-
return resources.map((uri) => uri.fsPath).sort((s1, s2) => {
74-
if (s1 > s2) {
75-
return 1;
76-
} else if (s1 < s2) {
77-
return -1;
78-
} else {
79-
return 0;
80-
}
81-
});
74+
return resources
75+
.map((uri) => uri.fsPath)
76+
.sort((s1, s2) => {
77+
if (s1 > s2) {
78+
return 1;
79+
} else if (s1 < s2) {
80+
return -1;
81+
} else {
82+
return 0;
83+
}
84+
});
8285
}
8386

8487
function createAssemblyQuickPickItem(

vscode-extension/src/commands/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function addAssemblyToTree(
3636
) {
3737
const added = await decompiledTreeProvider.addAssembly(assembly);
3838
if (added) {
39-
const newNode = decompiledTreeProvider.findNode(
39+
const newNode = await decompiledTreeProvider.findNode(
4040
(node) => node.metadata?.assemblyPath === assembly
4141
);
4242
if (newNode) {

vscode-extension/src/decompiler/DecompiledTreeProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ export class DecompiledTreeProvider implements TreeDataProvider<Node> {
113113
};
114114
}
115115

116-
public findNode(predicate: (node: Node) => boolean) {
117-
return (this.getChildren() as Node[]).find(predicate);
116+
public async findNode(predicate: (node: Node) => boolean) {
117+
return ((await this.getChildren()) as Node[]).find(predicate);
118118
}
119119

120120
public getChildren(node?: Node): Node[] | Thenable<Node[]> {

0 commit comments

Comments
 (0)