Skip to content

Commit

Permalink
mathenv AST node is different from env
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Nov 2, 2023
1 parent f90f46c commit c5f9646
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/providers/completer/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) => {
Expand Down

0 comments on commit c5f9646

Please sign in to comment.