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>.
From https://github.com/withastro/language-tools/issues/802#issuecomment-2110838019, 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, whereLanguagePlugin
should specify the accepted script ID type. For TS plugins, it should beLanguagePlugin<string>
, and for LSP, it should beLanguagePlugin<URI>
. Alternatively, a more common approach is to accept both types simultaneously,LanguagePlugin<URI | string>
.