Skip to content

Commit 23987e6

Browse files
committed
Add Unicode Autocomplete configuration checkbox defaulting to false
Signed-off-by: miguelraz <miguelraz@ciencias.unam.mx>
1 parent a29a91e commit 23987e6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,12 @@
584584
"default": false,
585585
"markdownDescription": "Enable the knowledge-base *tools* in the MCP server in addition to the knowledge-base *resources*. The two tools tlaplus_mcp_knowledge_list and tlaplus_mcp_knowledge_get allow you to search and read TLA+ knowledge-base articles as MCP tools. Restart VSCode to apply the changes. You’ll rarely need to enable this option, since both VSCode and Cursor already support MCP resources."
586586
},
587+
"tlaplus.unicode.autocomplete": {
588+
"type": "boolean",
589+
"scope": "window",
590+
"default": false,
591+
"markdownDescription": "Enable Unicode autocomplete in the editor. Requires reload to update."
592+
},
587593
"tlaplus.pdf.convertCommand": {
588594
"default": "pdflatex",
589595
"type": "string",

src/completions/tlaCompletions.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ export const TLA_OPERATORS = [
66
'E', 'A', 'X', 'lnot', 'land', 'lor', 'cdot', 'equiv', 'subseteq', 'in', 'notin', 'intersect',
77
'union', 'leq', 'geq', 'cup', 'cap'
88
];
9+
10+
const enableUnicodeAutocomplete = vscode.workspace.getConfiguration()
11+
.get<boolean>('tlaplus.unicode.autocomplete', false);
12+
913
const TLA_UNICODE_OPERATORS: Map<string, string> = new Map([
1014
['E', '∃'], ['A', '∀'], ['X', '◊'], ['lnot', '¬'], ['land', '∧'], ['lor', '∨'], ['cdot', '·'],
1115
['equiv', '≡'], ['subseteq', '⊆'], ['in', '∈'], ['notin', '∉'], ['intersect', '∩'],
@@ -101,7 +105,9 @@ export class TlaCompletionItemProvider implements vscode.CompletionItemProvider
101105
item.insertText = item.label + ' ';
102106
break;
103107
case vscode.CompletionItemKind.Operator:
104-
item.insertText = TLA_UNICODE_OPERATORS.get(item.label.toString().substring(1)) + ' ';
108+
item.insertText = enableUnicodeAutocomplete ?
109+
TLA_UNICODE_OPERATORS.get(item.label.toString().substring(1)) + ' ' :
110+
item.label.toString().substring(1) + ' ';
105111
break;
106112
}
107113
return item;

0 commit comments

Comments
 (0)