Commit 53c81cde authored by Lorenz Brun's avatar Lorenz Brun

Add editorconfig and run prettier

parent fd9758f6
Pipeline #3612 passed with stage
in 15 seconds
[*.ts]
indent_style = tab
\ No newline at end of file
......@@ -8,21 +8,21 @@ import * as fs from 'fs-extra';
export function activate(context: vscode.ExtensionContext) {
let taskTreeProvider = new TaskTreeDataProvider(context, [new TaskMetadata]);
let recentTaskTreeProvider = new RecentSolutionTreeDataProvider(context, []);
//var status = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, 0 );
//var outputChannel = vscode.workspace.getConfiguration( 'todo-tree' ).debug ? vscode.window.createOutputChannel( "todo-tree" ) : undefined;
let taskTreeProvider = new TaskTreeDataProvider(context, [new TaskMetadata]);
let recentTaskTreeProvider = new RecentSolutionTreeDataProvider(context, []);
//var status = vscode.window.createStatusBarItem( vscode.StatusBarAlignment.Left, 0 );
//var outputChannel = vscode.workspace.getConfiguration( 'todo-tree' ).debug ? vscode.window.createOutputChannel( "todo-tree" ) : undefined;
vscode.window.createTreeView("create-soitask", { treeDataProvider: taskTreeProvider });
vscode.window.createTreeView("recent-soitask", { treeDataProvider: recentTaskTreeProvider });
vscode.window.createTreeView("create-soitask", { treeDataProvider: taskTreeProvider });
vscode.window.createTreeView("recent-soitask", { treeDataProvider: recentTaskTreeProvider });
let createEmptyTaskCommand = vscode.commands.registerCommand('soicode.createEmptyTask', createEmptyTask);
let createEmptyTaskCommand = vscode.commands.registerCommand('soicode.createEmptyTask', createEmptyTask);
context.subscriptions.push(createEmptyTaskCommand);
console.log('SOICode has been loaded');
context.subscriptions.push(createEmptyTaskCommand);
console.log('SOICode has been loaded');
}
// this method is called when your extension is deactivated
......@@ -30,61 +30,61 @@ export function deactivate() {
}
async function createEmptyTask() {
console.log("Test");
let newWorkdir;
try {
newWorkdir = await vscode.window.showOpenDialog({
openLabel: "new empty SOITask",
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false
});
} catch (err) {
console.log(err);
return;
}
console.log(newWorkdir);
/* vscode.window.showOpenDialog({
openLabel: "new empty SOITask",
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false
}).then(wd => {
console.log(wd);
}); */
console.log("Test2");
if (newWorkdir === undefined || newWorkdir.length !== 1) {
vscode.window.showErrorMessage("You have to select one directory");
return;
}
// Check that newWorkdir is empty
try {
const files = await fs.readdir(newWorkdir[0].fsPath);
if (files.length > 0) {
vscode.window.showErrorMessage("Directory should be empty");
return;
}
} catch {
vscode.window.showErrorMessage("Can't access Directory");
}
// Write files into new Workdir
try {
await fs.writeFile(path.join(newWorkdir[0].fsPath, "main.cpp"), cppFile);
//await fs.mkdir(path.join(newWorkdir[0].fsPath, ".vscode"));
//await fs.writeFile(path.join(newWorkdir[0].fsPath, ".vscode","launch.json"), launchConfig);
//await fs.writeFile(path.join(newWorkdir[0].fsPath, ".vscode","tasks.json"), taskjson);
//await fs.writeFile(path.join(newWorkdir[0].fsPath, ".vscode","c_cpp_properties.json"), c_cpp_properties);
} catch (err) {
vscode.window.showErrorMessage(err.toString());
}
// There is a race condition in this code. once opening the folder is done, every extension is killed and gets restarted
vscode.commands.executeCommand('vscode.openFolder', newWorkdir[0]);
console.log("CDed into new directory");
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(path.join(newWorkdir[0].fsPath, "main.cpp")));
console.log("New workdir generated");
console.log("Test");
let newWorkdir;
try {
newWorkdir = await vscode.window.showOpenDialog({
openLabel: "new empty SOITask",
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false
});
} catch (err) {
console.log(err);
return;
}
console.log(newWorkdir);
/* vscode.window.showOpenDialog({
openLabel: "new empty SOITask",
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false
}).then(wd => {
console.log(wd);
}); */
console.log("Test2");
if (newWorkdir === undefined || newWorkdir.length !== 1) {
vscode.window.showErrorMessage("You have to select one directory");
return;
}
// Check that newWorkdir is empty
try {
const files = await fs.readdir(newWorkdir[0].fsPath);
if (files.length > 0) {
vscode.window.showErrorMessage("Directory should be empty");
return;
}
} catch {
vscode.window.showErrorMessage("Can't access Directory");
}
// Write files into new Workdir
try {
await fs.writeFile(path.join(newWorkdir[0].fsPath, "main.cpp"), cppFile);
//await fs.mkdir(path.join(newWorkdir[0].fsPath, ".vscode"));
//await fs.writeFile(path.join(newWorkdir[0].fsPath, ".vscode","launch.json"), launchConfig);
//await fs.writeFile(path.join(newWorkdir[0].fsPath, ".vscode","tasks.json"), taskjson);
//await fs.writeFile(path.join(newWorkdir[0].fsPath, ".vscode","c_cpp_properties.json"), c_cpp_properties);
} catch (err) {
vscode.window.showErrorMessage(err.toString());
}
// There is a race condition in this code. once opening the folder is done, every extension is killed and gets restarted
vscode.commands.executeCommand('vscode.openFolder', newWorkdir[0]);
console.log("CDed into new directory");
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(path.join(newWorkdir[0].fsPath, "main.cpp")));
console.log("New workdir generated");
}
......@@ -100,11 +100,11 @@ using namespace std;
#define int int64_t
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
ios::sync_with_stdio(false);
cin.tie(0);
int a, b;
cin >> a >> b;
cout << a + b << '\\n';
int a, b;
cin >> a >> b;
cout << a + b << '\\n';
}
`;
......@@ -2,38 +2,38 @@ import * as vscode from 'vscode';
class SolutionHeader {
solutionID: string = "";
path: string = "";
solutionID: string = "";
path: string = "";
}
export class RecentSolutionTreeDataProvider implements vscode.TreeDataProvider<number> {
private _onDidChangeTreeData: vscode.EventEmitter<number | undefined> = new vscode.EventEmitter<number | undefined>();
readonly onDidChangeTreeData: vscode.Event<number | undefined> = this._onDidChangeTreeData.event;
private recentSolutions: SolutionHeader[];
constructor(context: vscode.ExtensionContext, recentSolutionPaths: string[]) {
this.recentSolutions = [];
this.recentSolutions.push(new SolutionHeader());
}
getTreeItem(element: number): vscode.TreeItem {
let wip = new vscode.TreeItem('Not yet implemented', vscode.TreeItemCollapsibleState.None);
wip.tooltip = 'TODO: This still needs to be implemented';
return wip;
}
updateData() {
this._onDidChangeTreeData.fire(0);
}
getChildren(element?: number):number[] {
if (element === undefined) { // Get all children of root
return [1];
}
else {
return [];
}
}
private _onDidChangeTreeData: vscode.EventEmitter<number | undefined> = new vscode.EventEmitter<number | undefined>();
readonly onDidChangeTreeData: vscode.Event<number | undefined> = this._onDidChangeTreeData.event;
private recentSolutions: SolutionHeader[];
constructor(context: vscode.ExtensionContext, recentSolutionPaths: string[]) {
this.recentSolutions = [];
this.recentSolutions.push(new SolutionHeader());
}
getTreeItem(element: number): vscode.TreeItem {
let wip = new vscode.TreeItem('Not yet implemented', vscode.TreeItemCollapsibleState.None);
wip.tooltip = 'TODO: This still needs to be implemented';
return wip;
}
updateData() {
this._onDidChangeTreeData.fire(0);
}
getChildren(element?: number): number[] {
if (element === undefined) { // Get all children of root
return [1];
}
else {
return [];
}
}
}
\ No newline at end of file
......@@ -7,36 +7,36 @@ export class TaskMetadata {
export class TaskTreeDataProvider implements vscode.TreeDataProvider<number> {
private _onDidChangeTreeData: vscode.EventEmitter<number | undefined> = new vscode.EventEmitter<number | undefined>();
readonly onDidChangeTreeData: vscode.Event<number | undefined> = this._onDidChangeTreeData.event;
//_onDidChangeTreeData = new vscode.EventEmitter();
//onDidChangeTreeData = this._onDidChangeTreeData.event;
_taskList: [TaskMetadata];
constructor(context: vscode.ExtensionContext, private taskList: [TaskMetadata]) {
this._taskList = taskList;// I dont want warnings
this.taskList.push(new TaskMetadata());//I don't want warnings
}
getTreeItem(element: number): vscode.TreeItem {
let emptySOITask = new vscode.TreeItem('New Empty SOI Task', vscode.TreeItemCollapsibleState.None);
emptySOITask.command = {title: "Create Empty SOI Task", command: "soicode.createEmptyTask"};
return emptySOITask;
}
updateData() {
this._onDidChangeTreeData.fire(0);
}
getChildren(element?: number):number[] {
if (element === undefined) {
return [1];
}
else {
return [];
}
}
private _onDidChangeTreeData: vscode.EventEmitter<number | undefined> = new vscode.EventEmitter<number | undefined>();
readonly onDidChangeTreeData: vscode.Event<number | undefined> = this._onDidChangeTreeData.event;
//_onDidChangeTreeData = new vscode.EventEmitter();
//onDidChangeTreeData = this._onDidChangeTreeData.event;
_taskList: [TaskMetadata];
constructor(context: vscode.ExtensionContext, private taskList: [TaskMetadata]) {
this._taskList = taskList;// I dont want warnings
this.taskList.push(new TaskMetadata());//I don't want warnings
}
getTreeItem(element: number): vscode.TreeItem {
let emptySOITask = new vscode.TreeItem('New Empty SOI Task', vscode.TreeItemCollapsibleState.None);
emptySOITask.command = { title: "Create Empty SOI Task", command: "soicode.createEmptyTask" };
return emptySOITask;
}
updateData() {
this._onDidChangeTreeData.fire(0);
}
getChildren(element?: number): number[] {
if (element === undefined) {
return [1];
}
else {
return [];
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment