From c5f96469c9ddffdd664c7ee4c310f1ecf2e2f262 Mon Sep 17 00:00:00 2001 From: James Yu Date: Thu, 2 Nov 2023 19:52:11 +0000 Subject: [PATCH] mathenv AST node is different from env --- src/providers/completer/environment.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/providers/completer/environment.ts b/src/providers/completer/environment.ts index c74813b23..f4909183a 100644 --- a/src/providers/completer/environment.ts +++ b/src/providers/completer/environment.ts @@ -207,11 +207,17 @@ export class Environment implements IProvider { private parseAst(node: Ast.Node): CmdEnvSuggestion[] { let envs: CmdEnvSuggestion[] = [] - if (node.type === 'environment' || node.type === 'mathenv') { + if (node.type === 'environment') { const env = new CmdEnvSuggestion(`${node.env}`, '', [], -1, { name: node.env, args: '' }, vscode.CompletionItemKind.Module) env.documentation = '`' + node.env + '`' env.filterText = node.env envs.push(env) + } else if (node.type === 'mathenv') { + const nodeEnv = node.env as unknown as {content: string} + const env = new CmdEnvSuggestion(`${nodeEnv.content}`, '', [], -1, { name: nodeEnv.content, args: '' }, vscode.CompletionItemKind.Module) + env.documentation = '`' + nodeEnv.content + '`' + env.filterText = nodeEnv.content + envs.push(env) } const parseContent = (content: Ast.Node[]) => {