From 10241e8be416deba410c3eeae7088ae4950917c1 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 27 Jan 2026 16:19:42 +0100 Subject: [PATCH] Add actual Lua code body for LuaDirectives to parent nodes for completion events --- client/client.ts | 5 ++++- client/codemirror/smart_quotes.ts | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/client.ts b/client/client.ts index 03d3f9f3..a6a13b7c 100644 --- a/client/client.ts +++ b/client/client.ts @@ -863,9 +863,12 @@ export class Client { if (currentNode) { let node: SyntaxNode | null = currentNode; do { - if (node.name === "FencedCode" || node.name === "FrontMatter") { + if (["FencedCode", "FrontMatter"].includes(node.name)) { const body = editorState.sliceDoc(node.from + 3, node.to - 3); parentNodes.push(`${node.name}:${body}`); + } else if (node.name === "LuaDirective") { + const body = editorState.sliceDoc(node.from + 2, node.to - 1); + parentNodes.push(`${node.name}:${body}`); } else { parentNodes.push(node.name); } diff --git a/client/codemirror/smart_quotes.ts b/client/codemirror/smart_quotes.ts index 2f1b76b7..06199950 100644 --- a/client/codemirror/smart_quotes.ts +++ b/client/codemirror/smart_quotes.ts @@ -36,7 +36,9 @@ function keyBindingForQuote( // Figure out the context, if in some sort of code/comment fragment don't be smart let node = syntaxTree(target.state).resolveInner(cursorPos); while (node) { - if (straightQuoteContexts.includes(node.type.name)) { + if ( + straightQuoteContexts.find((sqc) => sqc.startsWith(node.type.name)) + ) { return false; } if (node.parent) {