Skip to content

Commit 0e29e52

Browse files
authored
Merge branch 'main' into mcq-ui
2 parents 9d77218 + c248b20 commit 0e29e52

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

scripts/lsp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function main() {
2222

2323
async function downloadLsp() {
2424
const outputFolder = getOutputDir();
25-
const version = "0.1.4";
25+
const version = "0.1.8";
2626
const lspFilename = "source-lsp.js";
2727
const url = `https://github.com/source-academy/source-lsp/releases/download/v${version}/${lspFilename}`;
2828
// const url = `https://github.com/source-academy/source-lsp/releases/latest/download/${lspFilename}`;

src/commands/showPanel.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ async function handleMessage(
9595
// @ts-ignore
9696
_.set(info, `["${activeEditor.uri}"].chapter`, message.chapter ?? 1);
9797
// TODO: message.prepend can be undefined in runtime, investigate
98-
const nPrependLines = message.prepend
99-
? message.prepend.split("\n").length
100-
: 0;
98+
const nPrependLines =
99+
message.prepend && message.prepend !== ""
100+
? message.prepend.split("\n").length + 2 // account for start/end markers
101+
: 0;
101102
_.set(info, `["${activeEditor.uri}"].prepend`, nPrependLines);
102103
context.globalState.update("info", info);
103104
client.sendRequest("source/publishInfo", info);

src/utils/editor.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,15 @@ export class Editor {
6767
const uri = vscode.Uri.file(filePath);
6868
self.uri = uri.toString();
6969

70-
const contents = [
71-
"// PREPEND -- DO NOT EDIT",
72-
prepend,
73-
"// END PREPEND",
74-
initialCode,
75-
].join("\n");
70+
const contents =
71+
prepend !== ""
72+
? [
73+
"// PREPEND -- DO NOT EDIT",
74+
prepend,
75+
"// END PREPEND",
76+
initialCode,
77+
].join("\n")
78+
: initialCode;
7679

7780
await vscode.workspace.fs.readFile(vscode.Uri.file(filePath)).then(
7881
() => null,

0 commit comments

Comments
 (0)