Skip to content
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

refactor: URI-specific changes #182

Merged
merged 4 commits into from
May 24, 2024
Merged

refactor: URI-specific changes #182

merged 4 commits into from
May 24, 2024

Conversation

johnsoncodehk
Copy link
Member

@johnsoncodehk johnsoncodehk commented May 21, 2024

  • From 🐛 BUG: Neovim broken lsp on dynamic routes withastro/language-tools#802 (comment), we found that stringified URIs are not reliable document IDs. We should pass URI instances as document IDs whenever possible. This also allows for more reuse of URI instances and reduces URI parsing.

  • URIConverter (URI <-> fileName) is specific to TypeScript and should not be coupled with language-server/language-service.

  • The scriptId of LanguagePlugin could be in either fileName or stringified URI format in the past, which caused confusion. Now, we can explicitly declare this through generic parameters, where LanguagePlugin should specify the accepted script ID type. For TS plugins, it should be LanguagePlugin<string>, and for LSP, it should be LanguagePlugin<URI>. Alternatively, a more common approach is to accept both types simultaneously, LanguagePlugin<URI | string>.

@johnsoncodehk johnsoncodehk changed the base branch from master to 2.3 May 24, 2024 00:34
@johnsoncodehk johnsoncodehk marked this pull request as ready for review May 24, 2024 00:35
@johnsoncodehk johnsoncodehk merged commit 89a368e into 2.3 May 24, 2024
6 checks passed
@johnsoncodehk johnsoncodehk deleted the 2.3-uri branch May 24, 2024 00:36
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.

1 participant