Skip to content

refactor: URI-specific changes#182

Merged
johnsoncodehk merged 4 commits into2.3from
2.3-uri
May 24, 2024
Merged

refactor: URI-specific changes#182
johnsoncodehk merged 4 commits into2.3from
2.3-uri

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
@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