Skip to content

Commit 86aaf21

Browse files
committed
fix merge issues
1 parent 1062e04 commit 86aaf21

File tree

2 files changed

+4
-68
lines changed

2 files changed

+4
-68
lines changed

src/utils/editor.ts

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,14 @@ export class Editor {
3838
return this.editor?.document.getText();
3939
}
4040

41-
<<<<<<< chapter-selection
4241
static getFilePath(assessmentName: string, questionId: number): string {
43-
let workspaceFolder = config.workspaceFolder;
44-
if (!workspaceFolder) {
45-
workspaceFolder = path.join(os.homedir(), ".sourceacademy");
46-
// TODO: Prompt the user to make this folder the default, and then set back to the config store.
47-
} else if (!path.isAbsolute(workspaceFolder)) {
48-
workspaceFolder = path.join(os.homedir(), workspaceFolder);
49-
}
50-
=======
51-
// TODO: This method is too loaded, it's not obvious it also shows the editor
52-
static async create(
53-
workspaceLocation: VscWorkspaceLocation,
54-
assessmentName: string,
55-
questionId: number,
56-
prepend: string = "",
57-
initialCode: string = "",
58-
): Promise<Editor> {
59-
const self = new Editor(workspaceLocation, assessmentName, questionId);
60-
self.assessmentName = assessmentName;
61-
self.questionId = questionId;
62-
6342
const workspaceFolder = canonicaliseLocation(config.workspaceFolder);
64-
>>>>>>> main
65-
6643
const filePath = path.join(
6744
workspaceFolder,
6845
`${assessmentName}_${questionId}.js`,
6946
);
7047

71-
return filePath
48+
return filePath;
7249
}
7350

7451
// TODO: This method is too loaded, it's not obvious it also shows the editor
@@ -100,18 +77,6 @@ export class Editor {
10077
await vscode.workspace.fs.readFile(vscode.Uri.file(filePath)).then(
10178
(value) => {
10279
if (value.toString() !== contents) {
103-
<<<<<<< chapter-selection
104-
self.log("EXTENSION: Conflict detected between local and remote, prompting user to choose one")
105-
vscode.window
106-
.showInformationMessage(
107-
"The program on file differs from the one on the Source Academy servers." +
108-
"Which program should we use? (Note that picking one will overwrite the other)",
109-
"Local", "Server")
110-
.then(async answer => {
111-
// By default the code displayed is the local one
112-
if (answer === "Server") {
113-
self.log('EXTENSION: Saving program from server to file')
114-
=======
11580
self.log(
11681
"EXTENSION: Conflict detected between local and remote, prompting user to choose one",
11782
);
@@ -128,16 +93,10 @@ export class Editor {
12893
// By default the code displayed is the local one
12994
if (answer === "Yes") {
13095
self.log("EXTENSION: Saving program from server to file");
131-
>>>>>>> main
13296
await vscode.workspace.fs.writeFile(
13397
uri,
13498
new TextEncoder().encode(contents),
13599
);
136-
<<<<<<< chapter-selection
137-
}
138-
})
139-
140-
=======
141100
} else if (answer === undefined) {
142101
// Modal cancelled
143102
const message = Messages.Text(
@@ -147,7 +106,6 @@ export class Editor {
147106
sendToFrontendWrapped(message);
148107
}
149108
});
150-
>>>>>>> main
151109
}
152110
},
153111
async () => {
@@ -171,27 +129,6 @@ export class Editor {
171129
vscode.commands.executeCommand("editor.fold");
172130

173131
self.editor = editor;
174-
<<<<<<< chapter-selection
175-
vscode.workspace.onDidChangeTextDocument((e: vscode.TextDocumentChangeEvent) => {
176-
if (!self.onChangeCallback) {
177-
return;
178-
}
179-
const text = editor.document.getText();
180-
if (e.contentChanges.length === 0) {
181-
self.log(`EXTENSION: Editor's code did not change, ignoring`);
182-
return;
183-
}
184-
if (Date.now() - self.replaceTime < 1000) {
185-
self.log(
186-
`EXTENSION: Ignoring change event, ${Date.now() - self.replaceTime}ms since last replace`,
187-
);
188-
return;
189-
}
190-
self.log(`EXTENSION: Editor's code changed!`);
191-
self.onChangeCallback(self);
192-
self.code = text;
193-
});
194-
=======
195132
vscode.workspace.onDidChangeTextDocument(
196133
(e: vscode.TextDocumentChangeEvent) => {
197134
if (!self.onChangeCallback) {
@@ -213,7 +150,6 @@ export class Editor {
213150
self.code = text;
214151
},
215152
);
216-
>>>>>>> main
217153
return self;
218154
}
219155

src/utils/messages.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ const Messages = createMessages({
5252
assessmentName: string,
5353
questionId: number,
5454
chapter: number,
55-
variant: string
55+
variant: string,
5656
) => ({
5757
assessmentName,
5858
questionId,
5959
chapter,
60-
variant
61-
})
60+
variant,
61+
}),
6262
NotifyAssessmentsOverview: (
6363
assessmentOverviews: VscAssessmentOverview[],
6464
courseId: number,

0 commit comments

Comments
 (0)