diff --git a/package.json b/package.json index f1732854d..84c392988 100644 --- a/package.json +++ b/package.json @@ -198,6 +198,12 @@ "command": "linguafranca.createNewFile" } ], + "commandPalette": [ + { + "command": "linguafranca.getVersion", + "when": "false" + } + ], "view/title": [ { "command": "linguafranca.refreshEntries", @@ -282,13 +288,7 @@ "name": "Lingo Libraries" } ] - }, - "commandPalette": [ - { - "command": "linguafranca.getVersion", - "when": "false" - } - ] + } }, "devDependencies": { "@types/chai": "^4.3.1", diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index 4ec2edd1e..1262176d6 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -59,20 +59,6 @@ export class LFDataProviderNode extends vscode.TreeItem { this.iconPath = new vscode.ThemeIcon(icon); this.contextValue = role; if (position) { this.position = position; } - - // this.registerNodeCommand(); - - } - - /** - * Registers a command for the node based on its role and type. - */ - registerNodeCommand(): void { - this.command = this.role === LFDataProviderNodeRole.REACTOR ? { - title: "", - command: this.type == LFDataProviderNodeType.LOCAL ? "linguafranca.goToFile" : "linguafranca.goToLibraryFile", - arguments: [this] - } : undefined; } } @@ -241,7 +227,9 @@ export class LFDataProvider implements vscode.TreeDataProvider { uris.forEach(uri => { this.client.sendRequest('generator/getLibraryReactors', uri.toString()).then(node => { - this.addDataItem(node); + if (node) { + this.addDataItem(node as LFDataProviderNode); + } }); }); }); @@ -254,7 +242,7 @@ export class LFDataProvider implements vscode.TreeDataProvider 0) { - dataNode.children.forEach((child: any) => { - node.children!.push(new LFDataProviderNode(child.label, - child.uri, + if (dataNode.children!.length > 0) { + dataNode.children!.forEach((child: LFDataProviderNode) => { + node.children!.push(new LFDataProviderNode(child.label!.toString(), + child.uri.toString(), LFDataProviderNodeRole.REACTOR, this.type, [], child.position @@ -287,14 +275,14 @@ export class LFDataProvider implements vscode.TreeDataProvider 0) { - dataNode.children.forEach((child: any) => { - node.children!.push(new LFDataProviderNode(child.label, - child.uri, + addDataItemLibrary(dataNode: LFDataProviderNode) { + const root = this.buildRoot(dataNode.uri.toString()); + const library_root = this.buildLibraryRoot(dataNode.uri.toString(), root); + let node = new LFDataProviderNode(dataNode.label!.toString(), dataNode.uri.toString(), LFDataProviderNodeRole.FILE, this.type, []); + if (dataNode.children!.length > 0) { + dataNode.children!.forEach((child: LFDataProviderNode) => { + node.children!.push(new LFDataProviderNode(child.label!.toString(), + child.uri.toString(), LFDataProviderNodeRole.REACTOR, this.type, [], child.position