Fix flakiness caused by expired cache entries

master
Brad Cornes 2022-04-12 19:11:48 +01:00
parent de3861757c
commit d344400688
1 changed files with 4 additions and 2 deletions

View File

@ -96,8 +96,10 @@ export function getLanguageBoundaries(
text: string = doc.getText() text: string = doc.getText()
): LanguageBoundary[] | null { ): LanguageBoundary[] | null {
let cacheKey = `${doc.languageId}:${text}` let cacheKey = `${doc.languageId}:${text}`
if (cache.has(cacheKey)) {
return cache.get(cacheKey) let cachedBoundaries = cache.get(cacheKey)
if (cachedBoundaries !== undefined) {
return cachedBoundaries
} }
let defaultType = isVueDoc(doc) let defaultType = isVueDoc(doc)