Skip to content

Clean up and document createLanguageServicePlugin and createAsyncLanguageServicePlugin#261

Merged
johnsoncodehk merged 9 commits intovolarjs:masterfrom
machty:language-service-plugin-cleanup
Mar 4, 2025
Merged

Clean up and document createLanguageServicePlugin and createAsyncLanguageServicePlugin#261
johnsoncodehk merged 9 commits intovolarjs:masterfrom
machty:language-service-plugin-cleanup

Conversation

@machty
Copy link
Collaborator

@machty machty commented Feb 10, 2025

No description provided.

.flat();

// TODO: this logic does not seem to appear in the async variant
// (createAsyncLanguageServicePlugin)... bug?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPEN QUESTION: is it a bug that the async variant (createAsyncLanguageServicePlugin) does not add the extensions passed in to projectExternalFileExtensions? (This is also how it was prior to this PR).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional, in the case of async this will cause some internal error in the tsserver, which is why we need to explicitly pass the required extensions in createAsyncLanguageServicePlugin parameters.

if (updateLevel >= (1 satisfies ts.ProgramUpdateLevel.RootNamesAndUpdate)
|| !externalFiles.has(project)) {
const oldFiles = externalFiles.get(project);
const extensions = projectExternalFileExtensions.get(project);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we check projectExternalFileExtensions (see other comment)

@machty
Copy link
Collaborator Author

machty commented Feb 10, 2025

cc @remcohaszing

@johnsoncodehk
Copy link
Member

LGTM, thank you!

I've found that using jiti solves the need to asynchronously import esm modules in synchronous code, and if this works for MDX and glint cases, we might remove createAsyncLanguageServicePlugin since it's an unreliable implementation.

@johnsoncodehk johnsoncodehk merged commit 385ca0f into volarjs:master Mar 4, 2025
3 of 4 checks passed
@machty machty deleted the language-service-plugin-cleanup branch March 4, 2025 14:37
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