Skip to content

Commit

Permalink
Fix #3946 Env pair should use dirty content AST
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Jun 27, 2023
1 parent cb6d2f5 commit 53b0130
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/envpair.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as vscode from 'vscode'
import * as lw from '../lw'
import { getLogger } from './logger'
import type * as Ast from '@unified-latex/unified-latex-types'
import { argContentToStr } from '../utils/parser'
import { parser } from './parser'

const logger = getLogger('EnvPair')

Expand Down Expand Up @@ -68,11 +68,9 @@ export class EnvPair {
constructor() {}

async buildCommandPairTree(document: vscode.TextDocument): Promise<CommandPair[]> {
await lw.cacher.wait(document.fileName)
const content = lw.cacher.get(document.fileName)?.content
const ast = lw.cacher.get(document.fileName)?.ast
if (!content || !ast) {
logger.log(`Error loading ${content ? 'AST' : 'content'} during structuring: ${document.fileName} .`)
const ast = await parser.parseLaTeX(document.getText())
if (!ast) {
logger.log('Error parsing current document as AST.')
return []
}

Expand Down

0 comments on commit 53b0130

Please sign in to comment.