Skip to content

Commit fbe3e43

Browse files
committed
changed prepend to take number of lines
1 parent 9441287 commit fbe3e43

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

client/src/extension.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ async function setLanguageVersion(uri: string, version: number) {
8686
return;
8787
}
8888
try {
89-
const response = await client.sendRequest("source/publishInfo", { [uri]: { chapter: version , prelude: "\n\n\n" } });
89+
const response = await client.sendRequest("source/publishInfo", { [uri]: { chapter: version } });
9090
window.showInformationMessage(`Language version set to ${version}`);
9191
} catch (error) {
9292
window.showErrorMessage(`Failed to set language version: ${error}`);

server/src/ast.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class AST {
2424

2525
// If prepend is supplied, prepend it to text, and offset all locations returned back to client
2626
constructor(text: string, context: Context, uri: string) {
27-
this.prependLines = context.prelude ? context.prelude.split("\n").length : 0;
27+
this.prependLines = context.prepend ? context.prepend : 0
2828
const acornOptions: Options = {
2929
ecmaVersion: DEFAULT_ECMA_VERSION,
3030
sourceType: "module",

server/src/server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ connection.onRequest("source/publishInfo", (info: { [uri: string]: Context }) =>
227227
validateTextDocument(document)
228228
}
229229
// Check if context changed
230-
else if (context.chapter !== oldContext.chapter || context.prelude !== oldContext.prelude) {
230+
else if (context.chapter !== oldContext.chapter || context.prepend !== oldContext.prepend) {
231231
contextCache.set(uri, context);
232232
astCache.delete(uri);
233233
validateTextDocument(document);

server/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,5 @@ export enum Chapter {
106106

107107
export interface Context {
108108
chapter: Chapter,
109-
prelude?: string
109+
prepend?: number
110110
}

0 commit comments

Comments
 (0)