Update Combinatory.newt, fix parse error
This commit is contained in:
@@ -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": "Δ",
|
||||
"\\[[": "⟦",
|
||||
"\\]]": "⟧",
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user