Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexing single Lingua Franca projects #181

Merged
merged 10 commits into from
Oct 16, 2024
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)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we point to a specific page?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that’s the idea. Do you know which specific page?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.lf-lang.org/docs/tools/code-extension/#usage but this page it rather incomplete. Also, there is no functionality to create a new project, or a description of how to do so. Should be easy to let lingo do it via VS Code once it's available as a library...

}
]
},
"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
Loading