From 0f779264ba8d69247dd0521c7ababef38a21a60f Mon Sep 17 00:00:00 2001 From: Hebi Li Date: Wed, 21 Dec 2022 12:33:39 -0800 Subject: [PATCH] fix: annotation offset for @export keyword --- ui/src/lib/parser.tsx | 4 ++-- ui/src/lib/runtime.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/lib/parser.tsx b/ui/src/lib/parser.tsx index d84f8270..a34f6dfa 100644 --- a/ui/src/lib/parser.tsx +++ b/ui/src/lib/parser.tsx @@ -52,7 +52,7 @@ export function analyzeCodeViaQuery(code) { let ispublic = false; if (code.trim().startsWith("@export")) { ispublic = true; - code = code.slice(7).trim(); + code = code.replace("@export", " ".repeat("@export".length)); } // magic commands if (code.startsWith("!")) return { ispublic, annotations }; @@ -99,7 +99,7 @@ export function analyzeCode(code) { let ispublic = false; if (code.trim().startsWith("@export")) { ispublic = true; - code = code.slice(7).trim(); + code = code.replace("@export", " ".repeat("@export".length)); } // magic commands if (code.startsWith("!")) return { ispublic, annotations }; diff --git a/ui/src/lib/runtime.tsx b/ui/src/lib/runtime.tsx index 73c09514..181e4f9f 100644 --- a/ui/src/lib/runtime.tsx +++ b/ui/src/lib/runtime.tsx @@ -48,7 +48,7 @@ function rewriteCode(id: string, get: () => RepoSlice & RuntimeSlice) { let pod = pods[id]; let code = pod.content; if (code.trim().startsWith("@export")) { - code = code.slice(7).trim(); + code = code.replace("@export", " ".repeat("@export".length)); } if (code.startsWith("!")) return code; // replace with symbol table