-
Notifications
You must be signed in to change notification settings - Fork 105
Open
Description
In #282, we changed the default URI type from url::Url
to fluent_uri::Uri
. Despite fluent_uri
is several order of magnitude less used (and maybe less tested?) than url
, it is also hard to use in the context of LSP servers and clients.
- We lacks the conversion method between
lsp_types::Uri
andfluent_uri::Uri
(and also the popularurl::Url
), makinglsp_types::Uri
a standalone type which can only be constructed by parsing a literal string throughFromStr
, which is costly and suffers from escaping traps (also see (2)). - Most of LSP URIs are
file://
paths, plusuntitled:
dangling files.url::Url
has convenientUrl::to_file_path
andUrl::from_file_path
for error-resistant conversions. Butfluent_uri
does not provide any relevant methods, and we can only serializing and parsing the path again. Non-UTF-8 and other URL-special characters (#
,?
and etc) should also be carefully handled by the user. - I'm not convinced by the reason in Consider not using url crate for directory specifiers? #261 for this big change. It complains that
.join
need some extra steps to work properly, but the crate migration makes it worse:fluent_uri
does not providejoin
at all. The same use-case in that issue will now need to serialize, concatenate and parse again, plus all escaping work mentioned in (2).
I suggest to either:
- Revert back to
Url
, warn user thatjoin
ing directory URLs should take extra cares. There are only few places that URLs refer to directories rather than files. - Change them to
String
, fully transferring the URL handling logic to downstream users.
Either of these approaches would provide better usability and interoperability of URLs from and into LSP protocol uses.
archseer, pascalkuthe, snowsignal, alesbrelih, T-256 and 37 morekritzcreek
Metadata
Metadata
Assignees
Labels
No labels