Skip to content

Commit 1e32965

Browse files
authored
Merge pull request #412 from superle3/superle3/issue411
[FEATURE] Disable Auto subscript when in \ce environment
2 parents 12395f7 + b94175c commit 1e32965

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/snippets/environment.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ export interface Environment {
99
/**
1010
* a mapping of triggers to environments where they should not run
1111
*/
12-
export const EXCLUSIONS:{[trigger: string]: Environment} = {
13-
"([A-Za-z])(\\d)": {openSymbol: "\\pu{", closeSymbol: "}"},
14-
"->": {openSymbol: "\\ce{", closeSymbol: "}"}
15-
}
16-
12+
export const EXCLUSIONS: { [trigger: string]: Environment[] } = {
13+
"([A-Za-z])(\\d)": [
14+
{ openSymbol: "\\pu{", closeSymbol: "}" },
15+
{ openSymbol: "\\ce{", closeSymbol: "}" },
16+
],
17+
"->": [{ openSymbol: "\\ce{", closeSymbol: "}" }],
18+
};

src/snippets/parse.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function insertSnippetVariables(trigger: string, variables: SnippetVariables) {
231231
function getExcludedEnvironments(trigger: string): Environment[] {
232232
const result = [];
233233
if (EXCLUSIONS.hasOwnProperty(trigger)) {
234-
result.push(EXCLUSIONS[trigger]);
234+
result.push(...EXCLUSIONS[trigger]);
235235
}
236236
return result;
237237
}

0 commit comments

Comments
 (0)