From 726df972d395fc986283c9e212956d4f2011c555 Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Wed, 9 Oct 2024 18:02:31 -0700 Subject: [PATCH 01/10] Indixing limited to single LF Projects --- package.json | 8 +++++++- src/lfview/lf-data-provider.ts | 19 ++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 098a25856..416bf7210 100644 --- a/package.json +++ b/package.json @@ -278,7 +278,13 @@ "name": "" } ] - } + }, + "viewsWelcome": [ + { + "view": "lf-lang-projects", + "contents": "No Lingua Franca project found. [Learn more](https://www.lf-lang.org/docs/) about setting up a Lingua Franca project structure.\n[Refresh](command:linguafranca.refreshEntries)" + } + ] }, "devDependencies": { "@types/chai": "^4.3.1", diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index 96e6c960b..7ab1c8506 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -183,7 +183,7 @@ export class LFDataProviderNode extends vscode.TreeItem { return editor.document.uri.fsPath.startsWith(this.uri.fsPath); } const pathSegments = this.uri.fsPath.split('/'); - const srcOrBuildIndex = pathSegments.indexOf(this.type === LFDataProviderNodeType.LIBRARY ? 'build' : 'src'); + const srcOrBuildIndex = pathSegments.lastIndexOf(this.type === LFDataProviderNodeType.LIBRARY ? 'build' : 'src'); if (srcOrBuildIndex === -1) { return false; @@ -219,9 +219,9 @@ export class LFDataProvider implements vscode.TreeDataProvider { uris.forEach(uri => { @@ -577,7 +574,7 @@ export class LFDataProvider implements vscode.TreeDataProvider item.label === projectLabel); @@ -598,7 +595,7 @@ export class LFDataProvider implements vscode.TreeDataProvider { vscode.window.showTextDocument(doc); From 372af0ef5929ff9593bf4dfc236a85f8d3a7f68c Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Thu, 10 Oct 2024 10:34:11 -0700 Subject: [PATCH 02/10] openFolder command instead of refreshEntries in viewsWelcome --- package.json | 2 +- src/extension.ts | 2 ++ src/lfview/lf-data-provider-commands.ts | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 416bf7210..ffc08e6fb 100644 --- a/package.json +++ b/package.json @@ -282,7 +282,7 @@ "viewsWelcome": [ { "view": "lf-lang-projects", - "contents": "No Lingua Franca project found. [Learn more](https://www.lf-lang.org/docs/) about setting up a Lingua Franca project structure.\n[Refresh](command:linguafranca.refreshEntries)" + "contents": "No Lingua Franca project found. [Learn more](https://www.lf-lang.org/docs/) about setting up a Lingua Franca project structure.\n[Open Lingua Franca Project](command:linguafranca.openFolder)" } ] }, diff --git a/src/extension.ts b/src/extension.ts index 983aa67ab..15c1e4d23 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -17,6 +17,7 @@ import { registerCollapseAllCommand, registerGoToLingoTomlCommand, registerImportReactorCommand, registerIncludeProjectCommand, + registerOpenFolderCommand, registerOpenInSplitViewCommand, registerOpenInTerminalCommand, registerRefreshCommand} from './lfview/lf-data-provider-commands'; @@ -99,6 +100,7 @@ export async function activate(context: vscode.ExtensionContext) { registerGoToLingoTomlCommand(context, lfDataProvider); registerIncludeProjectCommand(context, lfDataProvider); registerOpenInTerminalCommand(context); + registerOpenFolderCommand(context); context.subscriptions.push(vscode.commands.registerCommand( "linguafranca.checkDocker", checkDependencies.checkDocker diff --git a/src/lfview/lf-data-provider-commands.ts b/src/lfview/lf-data-provider-commands.ts index af6c6ddc8..9f4805d4e 100644 --- a/src/lfview/lf-data-provider-commands.ts +++ b/src/lfview/lf-data-provider-commands.ts @@ -103,3 +103,22 @@ export function registerOpenInTerminalCommand(context: vscode.ExtensionContext) )); } +export function registerOpenFolderCommand(context: vscode.ExtensionContext) { + context.subscriptions.push(vscode.commands.registerCommand( + 'linguafranca.openFolder', async ( ) => { + // Prompt the user to select a folder + const folderUri = await vscode.window.showOpenDialog({ + canSelectFolders: true, // Allow folder selection + canSelectFiles: false, // Disallow file selection + canSelectMany: false, // Allow only a single folder + openLabel: 'Select Folder' + }); + + if (folderUri && folderUri[0]) { + // Use vscode.openFolder to open the selected folder + vscode.commands.executeCommand('vscode.openFolder', folderUri[0], false); + } + } + )); +} + From f53f2bc6ea24545e1ba2a07517df7c538f42275f Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Thu, 10 Oct 2024 11:11:33 -0700 Subject: [PATCH 03/10] Modified search path for source files --- package.json | 8 -------- src/lfview/lf-data-provider.ts | 8 ++++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index ffc08e6fb..e6b734566 100644 --- a/package.json +++ b/package.json @@ -67,14 +67,6 @@ "dark": "#57cc99", "light": "#57cc99" } - }, - { - "id": "editorIcon.notCurrentProject", - "description": "Color for a TreeIteem label", - "defaults": { - "dark": "#fcbf49", - "light": "#fcbf49" - } } ], "semanticTokenScopes": [ diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index 7ab1c8506..7db752195 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -127,7 +127,7 @@ export class LFDataProviderNode extends vscode.TreeItem { newIcon, sameRootAsEditor ? new vscode.ThemeColor('editorIcon.currentProject') - : new vscode.ThemeColor('editorIcon.notCurrentProject') + : undefined ); } @@ -219,11 +219,11 @@ export class LFDataProvider implements vscode.TreeDataProvider = new vscode.EventEmitter(); From 4293ccdc3e45ffa8a610885fad06ca4561b55de7 Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Sat, 12 Oct 2024 13:07:44 -0700 Subject: [PATCH 04/10] Excluded nested 'src' folders from searchSourceFiles --- src/lfview/lf-data-provider.ts | 125 +++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 51 deletions(-) diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index 7db752195..edd0d4a7a 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -30,7 +30,7 @@ export enum LFDataProviderNodeRole { */ export enum LFDataProviderNodeType { LOCAL = 1, - LIBRARY = 2, + LIBRARY = 2, SOURCE = 3 } @@ -58,12 +58,12 @@ export class LFDataProviderNode extends vscode.TreeItem { constructor(label: string, uri: string, role: string, type?: LFDataProviderNodeType | undefined, - children?: LFDataProviderNode[] | undefined, + children?: LFDataProviderNode[] | undefined, position?: NodePosition | undefined) { let newLabel = type === LFDataProviderNodeType.SOURCE ? label : label.replace('.lf', ''); - super(newLabel, role === LFDataProviderNodeRole.REACTOR || - (role === LFDataProviderNodeRole.FILE && type === LFDataProviderNodeType.SOURCE) - ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed); + super(newLabel, role === LFDataProviderNodeRole.REACTOR || + (role === LFDataProviderNodeRole.FILE && type === LFDataProviderNodeType.SOURCE) + ? vscode.TreeItemCollapsibleState.None : vscode.TreeItemCollapsibleState.Collapsed); this.uri = vscode.Uri.parse(uri); this.children = children; this.role = role; @@ -71,7 +71,7 @@ export class LFDataProviderNode extends vscode.TreeItem { this.updateIcon(role, type); this.updateContextValue(role, type); if (position) { this.position = position; } - if(role === LFDataProviderNodeRole.FILE && type === LFDataProviderNodeType.SOURCE){ + if (role === LFDataProviderNodeRole.FILE && type === LFDataProviderNodeType.SOURCE) { this.command = { title: "Go to File", command: "vscode.open", @@ -90,7 +90,7 @@ export class LFDataProviderNode extends vscode.TreeItem { updateIcon(role: string, type?: LFDataProviderNodeType): void { const sameRootAsEditor = this.haveSameRootWithActiveEditor(); let newIcon = ''; - + switch (role) { case LFDataProviderNodeRole.PROJECT: newIcon = 'project'; @@ -122,15 +122,15 @@ export class LFDataProviderNode extends vscode.TreeItem { default: newIcon = 'default-icon'; // fallback for unknown roles } - + this.iconPath = new vscode.ThemeIcon( - newIcon, - sameRootAsEditor - ? new vscode.ThemeColor('editorIcon.currentProject') + newIcon, + sameRootAsEditor + ? new vscode.ThemeColor('editorIcon.currentProject') : undefined ); } - + /** * Updates the context value of the LFDataProviderNode based on its role and type. * The context value is used to determine the appropriate visual representation of the node in the tree view. @@ -140,9 +140,9 @@ export class LFDataProviderNode extends vscode.TreeItem { */ updateContextValue(role: string, type?: LFDataProviderNodeType): void { const sameRootAsEditor = this.haveSameRootWithActiveEditor(); - + let value: string = role; - + switch (role) { case LFDataProviderNodeRole.ROOT: value = sameRootAsEditor ? 'root-included' : 'root'; @@ -163,10 +163,10 @@ export class LFDataProviderNode extends vscode.TreeItem { value = sameRootAsEditor ? 'reactor-included' : 'reactor'; break; } - + this.contextValue = value; } - + /** * Determines whether the current node's root path is the same as the active editor's root path. * This is used to determine the appropriate context value for the node in the tree view. @@ -175,20 +175,20 @@ export class LFDataProviderNode extends vscode.TreeItem { */ haveSameRootWithActiveEditor(): boolean { const editor = vscode.window.activeTextEditor; - + if (!editor || !editor.document) { return false; } - if(this.role === LFDataProviderNodeRole.PROJECT){ + if (this.role === LFDataProviderNodeRole.PROJECT) { return editor.document.uri.fsPath.startsWith(this.uri.fsPath); } const pathSegments = this.uri.fsPath.split('/'); const srcOrBuildIndex = pathSegments.lastIndexOf(this.type === LFDataProviderNodeType.LIBRARY ? 'build' : 'src'); - + if (srcOrBuildIndex === -1) { return false; } - + const rootPath = pathSegments.slice(0, srcOrBuildIndex).join('/'); return editor.document.uri.fsPath.startsWith(rootPath); } @@ -219,11 +219,11 @@ export class LFDataProvider implements vscode.TreeDataProvider = new vscode.EventEmitter(); @@ -288,12 +288,12 @@ export class LFDataProvider implements vscode.TreeDataProvider { this.refreshTree(); }), - this.watcher.onDidCreate(() => { - this.refreshTree(); - }), - this.watcher.onDidDelete(() => { - this.refreshTree(); - }) + this.watcher.onDidCreate(() => { + this.refreshTree(); + }), + this.watcher.onDidDelete(() => { + this.refreshTree(); + }) context.subscriptions.push(this.watcher); } @@ -354,7 +354,7 @@ export class LFDataProvider implements vscode.TreeDataProvider { - uris.forEach(uri => { + + findFiles( + searchPath: string | vscode.GlobPattern, + excludePath: vscode.GlobPattern | null, + type: LFDataProviderNodeType + ): void { + vscode.workspace.findFiles(searchPath, excludePath).then(uris => { + const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; + + if (!workspaceFolder) { + vscode.window.showErrorMessage('No workspace folder is open.'); + return; + } + + // Process each URI found and get relative path + const filteredUris = (type === LFDataProviderNodeType.SOURCE) + ? uris.filter(file => { + const relativePath = vscode.workspace.asRelativePath(file, false); + // Count occurrences of nested '/src/' + const srcCount = (relativePath.match(/\/src\//g) || []).length; + // Exclude paths with more than one 'src' + return srcCount == 0; + }) + : uris; + + // Process each URI found + filteredUris.forEach(uri => { this.client.sendRequest('generator/getLibraryReactors', uri.toString()).then(node => { - if(node){ + if (node) { this.addDataItem(node as LFDataProviderNode, type); - } - else if(node === null){ + } else { vscode.window.showErrorMessage('Error retrieving data from the Language Server'); return; } @@ -495,7 +518,7 @@ export class LFDataProvider implements vscode.TreeDataProvider n.label === node.label)) + if (!localNode.children?.some(n => n.label === node.label)) localNode.children!.push(node); } @@ -507,7 +530,7 @@ export class LFDataProvider implements vscode.TreeDataProvider n.label === node.label)) + if (!srcNode.children?.some(n => n.label === node.label)) srcNode.children!.push(node); } @@ -574,19 +597,19 @@ export class LFDataProvider implements vscode.TreeDataProvider item.label === projectLabel); - if (!existingProject) { - const projectUri = splittedUri.slice(0, srcIdx).join('/') + '/'; - const root = new LFDataProviderNode(projectLabel, projectUri, LFDataProviderNodeRole.PROJECT, type!, []); - this.data.push(root); - return root; - } - return existingProject; + const srcIdx = splittedUri.lastIndexOf(!type || type == LFDataProviderNodeType.LIBRARY ? 'build' : 'src'); + const projectLabel = splittedUri[srcIdx - 1]; + + const existingProject = this.data.find(item => item.label === projectLabel); + if (!existingProject) { + const projectUri = splittedUri.slice(0, srcIdx).join('/') + '/'; + const root = new LFDataProviderNode(projectLabel, projectUri, LFDataProviderNodeRole.PROJECT, type!, []); + this.data.push(root); + return root; + } + return existingProject; } - + /** * Builds or retrieves the root node for a library project based on the URI. * @param uri - The URI of the data node. From 5b03d0bc298dab38cb704d4d4256a507790a8b10 Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Mon, 14 Oct 2024 10:09:34 -0700 Subject: [PATCH 05/10] Exclude the path 'src/lib/**' from 'searchSourceFiles' --- src/lfview/lf-data-provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index edd0d4a7a..ae12aed6c 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -223,7 +223,7 @@ export class LFDataProvider implements vscode.TreeDataProvider = new vscode.EventEmitter(); From 4d8075485791a730f74a9cb46823485f47ab1fee Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Mon, 14 Oct 2024 19:35:44 -0700 Subject: [PATCH 06/10] Added support to Windows path --- src/lfview/lf-data-provider.ts | 45 ++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index ae12aed6c..8a140e891 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -175,21 +175,23 @@ export class LFDataProviderNode extends vscode.TreeItem { */ haveSameRootWithActiveEditor(): boolean { const editor = vscode.window.activeTextEditor; - + if (!editor || !editor.document) { return false; } + if (this.role === LFDataProviderNodeRole.PROJECT) { return editor.document.uri.fsPath.startsWith(this.uri.fsPath); } - const pathSegments = this.uri.fsPath.split('/'); + + const pathSegments = this.uri.fsPath.split(path.sep); const srcOrBuildIndex = pathSegments.lastIndexOf(this.type === LFDataProviderNodeType.LIBRARY ? 'build' : 'src'); - + if (srcOrBuildIndex === -1) { return false; } - - const rootPath = pathSegments.slice(0, srcOrBuildIndex).join('/'); + + const rootPath = path.resolve(...pathSegments.slice(0, srcOrBuildIndex)); return editor.document.uri.fsPath.startsWith(rootPath); } } @@ -219,7 +221,7 @@ export class LFDataProvider implements vscode.TreeDataProvider { - const labelA = typeof a.label === 'string' ? a.label : a.uri.fsPath.split('/').pop() || ''; - const labelB = typeof b.label === 'string' ? b.label : b.uri.fsPath.split('/').pop() || ''; + const labelA = typeof a.label === 'string' + ? a.label + : a.uri.fsPath.split(path.sep).pop() || ''; + const labelB = typeof b.label === 'string' + ? b.label + : b.uri.fsPath.split(path.sep).pop() || ''; return labelA.localeCompare(labelB); }); this.data.forEach(n => this.sortNodes(n)); @@ -582,8 +588,8 @@ export class LFDataProvider implements vscode.TreeDataProvider 0) { node.children!.sort((a, b) => { - const labelA = typeof a.label === 'string' ? a.label : a.uri.fsPath.split('/').pop() || ''; - const labelB = typeof b.label === 'string' ? b.label : b.uri.fsPath.split('/').pop() || ''; + const labelA = typeof a.label === 'string' ? a.label : a.uri.fsPath.split(path.sep).pop() || ''; + const labelB = typeof b.label === 'string' ? b.label : b.uri.fsPath.split(path.sep).pop() || ''; return labelA.localeCompare(labelB); }); node.children!.forEach(n => this.sortNodes(n)); @@ -596,13 +602,13 @@ export class LFDataProvider implements vscode.TreeDataProvider item.label === projectLabel); if (!existingProject) { - const projectUri = splittedUri.slice(0, srcIdx).join('/') + '/'; + const projectUri = splittedUri.slice(0, srcIdx).join(path.sep) + path.sep; const root = new LFDataProviderNode(projectLabel, projectUri, LFDataProviderNodeRole.PROJECT, type!, []); this.data.push(root); return root; @@ -617,14 +623,14 @@ export class LFDataProvider implements vscode.TreeDataProvider item.label === projectLabel); if (!existingProject) { - const projectUri = splittedUri.slice(0, srcIdx).join('/') + '/'; + const projectUri = splittedUri.slice(0, srcIdx).join(path.sep) + path.sep; const root = new LFDataProviderNode(projectLabel, projectUri, LFDataProviderNodeRole.ROOT, LFDataProviderNodeType.LIBRARY, []); lingo.children!.push(root); return root; @@ -718,11 +724,11 @@ export class LFDataProvider implements vscode.TreeDataProvider { vscode.window.showTextDocument(doc); }); From 2d617a291631cad539121b217e88c6572c486fb6 Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Tue, 15 Oct 2024 16:57:20 -0700 Subject: [PATCH 07/10] Fix Windows path on VSCode extension - v2 --- src/lfview/lf-data-provider.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index 8a140e891..bc7e1e27b 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -184,7 +184,7 @@ export class LFDataProviderNode extends vscode.TreeItem { return editor.document.uri.fsPath.startsWith(this.uri.fsPath); } - const pathSegments = this.uri.fsPath.split(path.sep); + const pathSegments = this.uri.fsPath.split('/'); const srcOrBuildIndex = pathSegments.lastIndexOf(this.type === LFDataProviderNodeType.LIBRARY ? 'build' : 'src'); if (srcOrBuildIndex === -1) { @@ -571,10 +571,10 @@ export class LFDataProvider implements vscode.TreeDataProvider { const labelA = typeof a.label === 'string' ? a.label - : a.uri.fsPath.split(path.sep).pop() || ''; + : a.uri.fsPath.split('/').pop() || ''; const labelB = typeof b.label === 'string' ? b.label - : b.uri.fsPath.split(path.sep).pop() || ''; + : b.uri.fsPath.split('/').pop() || ''; return labelA.localeCompare(labelB); }); this.data.forEach(n => this.sortNodes(n)); @@ -588,8 +588,8 @@ export class LFDataProvider implements vscode.TreeDataProvider 0) { node.children!.sort((a, b) => { - const labelA = typeof a.label === 'string' ? a.label : a.uri.fsPath.split(path.sep).pop() || ''; - const labelB = typeof b.label === 'string' ? b.label : b.uri.fsPath.split(path.sep).pop() || ''; + const labelA = typeof a.label === 'string' ? a.label : a.uri.fsPath.split('/').pop() || ''; + const labelB = typeof b.label === 'string' ? b.label : b.uri.fsPath.split('/').pop() || ''; return labelA.localeCompare(labelB); }); node.children!.forEach(n => this.sortNodes(n)); @@ -602,13 +602,13 @@ export class LFDataProvider implements vscode.TreeDataProvider item.label === projectLabel); if (!existingProject) { - const projectUri = splittedUri.slice(0, srcIdx).join(path.sep) + path.sep; + const projectUri = splittedUri.slice(0, srcIdx).join('/') + '/'; const root = new LFDataProviderNode(projectLabel, projectUri, LFDataProviderNodeRole.PROJECT, type!, []); this.data.push(root); return root; @@ -623,14 +623,14 @@ export class LFDataProvider implements vscode.TreeDataProvider item.label === projectLabel); if (!existingProject) { - const projectUri = splittedUri.slice(0, srcIdx).join(path.sep) + path.sep; + const projectUri = splittedUri.slice(0, srcIdx).join('/') + '/'; const root = new LFDataProviderNode(projectLabel, projectUri, LFDataProviderNodeRole.ROOT, LFDataProviderNodeType.LIBRARY, []); lingo.children!.push(root); return root; @@ -728,7 +728,7 @@ export class LFDataProvider implements vscode.TreeDataProvider { vscode.window.showTextDocument(doc); From 8693054a0dfdcf8e4e6986562c25557b6ee62975 Mon Sep 17 00:00:00 2001 From: vinzbarbuto Date: Tue, 15 Oct 2024 18:11:19 -0700 Subject: [PATCH 08/10] Fix Windows path on VSCode extension - full tested --- src/lfview/lf-data-provider.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index bc7e1e27b..c8b768f9f 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -184,15 +184,15 @@ export class LFDataProviderNode extends vscode.TreeItem { return editor.document.uri.fsPath.startsWith(this.uri.fsPath); } - const pathSegments = this.uri.fsPath.split('/'); + const pathSegments = this.uri.path.split('/'); const srcOrBuildIndex = pathSegments.lastIndexOf(this.type === LFDataProviderNodeType.LIBRARY ? 'build' : 'src'); if (srcOrBuildIndex === -1) { return false; } - const rootPath = path.resolve(...pathSegments.slice(0, srcOrBuildIndex)); - return editor.document.uri.fsPath.startsWith(rootPath); + const rootPath = pathSegments.slice(0, srcOrBuildIndex).join('/'); + return editor.document.uri.path.startsWith(rootPath); } } @@ -674,7 +674,7 @@ export class LFDataProvider implements vscode.TreeDataProvider\n`; const position = await this.getTargetPosition(editor.document.uri); this.addTextOnActiveEditor(editor, position!.end, importText); @@ -718,7 +718,7 @@ export class LFDataProvider implements vscode.TreeDataProvider Date: Wed, 16 Oct 2024 10:54:33 -0700 Subject: [PATCH 09/10] Renamed view name and Lingo Packages section --- package.json | 2 +- src/lfview/lf-data-provider.ts | 30 +++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e6b734566..0d1270235 100644 --- a/package.json +++ b/package.json @@ -258,7 +258,7 @@ "activitybar": [ { "id": "lf-lang", - "title": "Lingua Franca Projects", + "title": "Lingua Franca Package Explorer", "icon": "images/logo/lf-logo-dark.svg" } ] diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index c8b768f9f..16b0228d3 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -402,6 +402,13 @@ export class LFDataProvider implements vscode.TreeDataProvider item.label === projectLabel); if (!existingProject) { const projectUri = splittedUri.slice(0, srcIdx).join('/') + '/'; @@ -682,7 +689,7 @@ export class LFDataProvider implements vscode.TreeDataProvider { return this.client.onReady().then(() => { @@ -784,18 +791,27 @@ export class LFDataProvider implements vscode.TreeDataProvider { - vscode.window.showTextDocument(doc); - }); + vscode.workspace.openTextDocument(vscode.Uri.file(newUri)) + .then(doc => { + vscode.window.showTextDocument(doc); + }, (error: Error) => { + vscode.window.showErrorMessage(`Failed to open Lingo.toml: ${error.message}`); + }); } } \ No newline at end of file From 3f0a7764fc453e216b1e1a655d1fdfb6d1502aeb Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 16 Oct 2024 11:13:41 -0700 Subject: [PATCH 10/10] Update src/lfview/lf-data-provider.ts --- src/lfview/lf-data-provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lfview/lf-data-provider.ts b/src/lfview/lf-data-provider.ts index 16b0228d3..75cedabc9 100644 --- a/src/lfview/lf-data-provider.ts +++ b/src/lfview/lf-data-provider.ts @@ -814,4 +814,4 @@ export class LFDataProvider implements vscode.TreeDataProvider