Skip to content

Fix merging auto-imports with existing import statements #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2020

Conversation

dfreeman
Copy link
Member

I wasn't able to come up with a way to get tsserver to produce merged imports itself, but this should fix #1.

An unfortunate side effect of the intermediary transformed modules we use in @glint/tsserver-plugin means that from TypeScript's perspective, there's never an existing import for the non-transformed module to merge with, and the logic that generates import completions is completely private within the TypeScript codebase, so we can't reuse it.

Having to maintain this code ourselves would be one point in favor of using a separate file extension + standalone language server for files with embedded templates, but it's not clear that outweighs all the other advantages we get from the current approach. The whole "tsserver plugin vs standalone language server" issue is likely worth a writeup on its own to capture the tradeoffs inherent in each approach.

@dfreeman dfreeman added the bug Something isn't working label Jun 28, 2020
@dfreeman dfreeman merged commit d5aa66f into master Jun 28, 2020
@dfreeman dfreeman deleted the fix-auto-import branch June 28, 2020 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-import doesn't merge with existing imports
1 participant