Skip to content

Commit

Permalink
Added Proyek import detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
robby-phd committed Oct 31, 2024
1 parent 314e376 commit 5aeee20
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"Programming Languages"
],
"activationEvents": [
"workspaceContains:.sireum"
"workspaceContains:.sireum",
"workspaceContains:bin/project.cmd"
],
"main": "./out/extension.js",
"contributes": {
Expand Down
4 changes: 3 additions & 1 deletion src/command_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,11 @@ export class SireumLogikaTaskProvider implements vscode.TaskProvider {
}
}

export const importProjectTask: Task = new ImportProject();

export const sireumTasks: Task[] = [
new InstallFonts(),
new ImportProject(),
importProjectTask
];

export const hamrTasks: Task[] = [
Expand Down
20 changes: 18 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,24 @@ export function activate(context: vscode.ExtensionContext) {
.join(ct.psep);
for (const f of workspaceFolders) {
const dotSireum = vscode.Uri.joinPath(f.uri, ".sireum");
const stat = vscode.workspace.fs.stat(dotSireum);
stat.then(value => { ct.importBuild(f.uri.fsPath, false); });
vscode.workspace.fs.stat(dotSireum).then(_ => {
ct.importBuild(f.uri.fsPath, false);
}, () => {
const binProject = vscode.Uri.joinPath(f.uri, "bin", "project.cmd");
vscode.workspace.fs.stat(binProject).then (_ => {
const bloop = vscode.Uri.joinPath(f.uri, ".bloop");
vscode.workspace.fs.stat(bloop).then(_ => {}, _ => {
vscode.window.showInformationMessage("Import Proyek?", "Yes", "No").then(async value => {
if (value == "Yes") {
if (await ct.importBuild(f.uri.fsPath, true)) {
vscode.tasks.executeTask(ct.getTask(ct.importProjectTask.type,
ct.importProjectTask.taskLabel, ct.importProjectTask.command, ct.importProjectTask.focus));
}
}
});
});
});
});
}
const ctMap = new Map<string, ct.Task>();
ct.sireumTasks.forEach((ct) => ctMap.set(ct.taskLabel, ct));
Expand Down

0 comments on commit 5aeee20

Please sign in to comment.