Skip to content

Commit

Permalink
Merge pull request #181 from lf-lang/improvement/lf-project-indexing
Browse files Browse the repository at this point in the history
Indexing single Lingua Franca projects
  • Loading branch information
lhstrh authored Oct 16, 2024
2 parents 788be37 + 3f0a776 commit 0a34f75
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 85 deletions.
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@
"dark": "#57cc99",
"light": "#57cc99"
}
},
{
"id": "editorIcon.notCurrentProject",
"description": "Color for a TreeIteem label",
"defaults": {
"dark": "#fcbf49",
"light": "#fcbf49"
}
}
],
"semanticTokenScopes": [
Expand Down Expand Up @@ -266,7 +258,7 @@
"activitybar": [
{
"id": "lf-lang",
"title": "Lingua Franca Projects",
"title": "Lingua Franca Package Explorer",
"icon": "images/logo/lf-logo-dark.svg"
}
]
Expand All @@ -278,7 +270,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[Open Lingua Franca Project](command:linguafranca.openFolder)"
}
]
},
"devDependencies": {
"@types/chai": "^4.3.1",
Expand Down
2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { registerCollapseAllCommand,
registerGoToLingoTomlCommand,
registerImportReactorCommand,
registerIncludeProjectCommand,
registerOpenFolderCommand,
registerOpenInSplitViewCommand,
registerOpenInTerminalCommand,
registerRefreshCommand} from './lfview/lf-data-provider-commands';
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/lfview/lf-data-provider-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
));
}

Loading

0 comments on commit 0a34f75

Please sign in to comment.