Skip to content

fix(language-service): fix caching of semantic diagnostics#141

Merged
johnsoncodehk merged 1 commit intomasterfrom
fix-semantic-errors-caching
Feb 26, 2024
Merged

fix(language-service): fix caching of semantic diagnostics#141
johnsoncodehk merged 1 commit intomasterfrom
fix-semantic-errors-caching

Conversation

@remcohaszing
Copy link
Member

This fixes a caching issue regarding semanric diagnostics. I don’t fully understand why. Returning an empty array from https://github.com/mdx-js/mdx-analyzer/blob/f6a43853d5ae0509b93001fdf6f58e1466106605/packages/language-service/lib/service-plugin.js#L163 fixed the issue, so I figured this was an upstream problem in Volar.

Refs mdx-js/mdx-analyzer#400

@johnsoncodehk
Copy link
Member

LGTM, thanks!

The reason is that when the service returns undefined result, the following lines cannot replace the response cache.

if (result) {
cache.errors = result;
cache.snapshot = sourceFile?.snapshot;
}

@johnsoncodehk johnsoncodehk merged commit 2de64b2 into master Feb 26, 2024
@johnsoncodehk johnsoncodehk deleted the fix-semantic-errors-caching branch February 26, 2024 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants