Update Combinatory.newt, fix parse error

This commit is contained in:
2025-11-15 14:18:12 -08:00
parent acb240db3f
commit 75716091af
5 changed files with 39 additions and 76 deletions

View File

@@ -1,4 +1,5 @@
// This needs to be flexhed out a lot, I've been adding them as needed
// This needs to be fleshed out a lot, I've been adding them as needed
// There is a mix of agda, lean, and my own shortcuts here
export const ABBREV: Record<string, string> = {
"\\x": "×",
"\\r": "→",
@@ -8,20 +9,26 @@ export const ABBREV: Record<string, string> = {
"\\circ": "∘",
"\\oplus": "⊕",
"\\otimes": "⊗",
// lean
"\\1": "₁",
"\\2": "₂",
"\\<": "⟨",
"\\>": "⟩",
// agda
"\\_0": "₀",
"\\_1": "₁",
"\\_2": "₂",
"\\_3": "₃",
// lean has \n here, which is a royal pain
"\\neg": "¬",
"\\bN": "",
"\\bZ": "",
"\\gi": "ι",
"\\gs": "σ",
"\\gt": "τ",
"\\gD": "Δ",
"\\gG": "Γ"
"\\GG": "Γ",
"\\Gi": "ι",
"\\Gl": "λ",
"\\Gs": "σ",
"\\Gt": "τ",
"\\GD": "Δ",
"\\[[": "⟦",
"\\]]": "⟧",
};

View File

@@ -30,10 +30,14 @@ export function activate(context: vscode.ExtensionContext) {
const changes = event.contentChanges;
if (changes.length === 0) return;
// TODO - agda input mode does the replacement as soon as possible
// but if the sequence is a prefix, it will change for subsequent characters
// The latter would require keeping state, but if we don't allow sequences to prefix
// each other, we could activate quicker.
const lastChange = changes[changes.length - 1];
const text = lastChange.text;
// Check if the last change is a potential shortcut trigger
if (!text || !( " ')\\".includes(text) || text.startsWith('\n'))) return;
if (!text || !( " ')\\_".includes(text) || text.startsWith('\n'))) return;
const document = editor.document;
const position = lastChange.range.end;