-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Move paths to lib #12415
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
Move paths to lib #12415
Conversation
I think you will need to change the versions from 0.0.0 to 0.1.0. |
Ok, I did that and added descriptions in the Cargo.toml for each |
The crate name |
What about prefix each with Or Or we could try to be "clever". |
☔ The latest upstream changes (presumably #12502) made this pull request unmergeable. Please resolve the merge conflicts. |
the @matklad you might wanna have a say in this matter |
Stuff in libs doesn’t and should have rust-analyzer specific naming. This can even be a litmus test for whether a thing should be in lib. However, stuff in libs has to have meaningful semver API. By moving stuff to lib, we are committing to not releasing too many major versions, and to having footgun-less API. vfs stuff doesn’t feel crates-io worthy to me. It would be great to have proper vfs implemented, but it has to be far more involved (see watchman). The hard part would be providing sound APIs which guarantee that no notification is missed, and provides anomaly-free view of a sequence of modifications. paths potentially is crates.io worthy, but it’s API should be carefully audited for any oddities. And the name should be longer for crates.io. “arena library” is indeed named after “el libro de arena” by Borges |
Yeah, paths look fine, but we need:
And… maybe paths name is OK? |
Important philosophical observation: the fact that something isn’t on crates.io does not preclude using it! The code is MIT licensed, so anyone is allowed and explicitly encouraged to vendor, fork, or publish in their name. This gives us freedom to make sure that, whatever we publish to crates.io, is actually good (makes a mental effort to ignore smol_str) |
Would this be just a type whose only field is the non-absolute (or non-relative) path or pathbuf? Is it enough to just return the thing itself instead of having error types? Adding error types would I think add 4 new types: Is the benefit that we could make them impl
Ok, removed that
Ok, removed
I didn't see any input (or output)
I think not. Some functions (like normalize) re-assert the invariants. Some just use
Ok, added
Fine with me (: A thought: would it be nice to have a wrapper function that returns |
Also, I walked back the changes to |
Yeah, I do think we need to add 4 error types (or maybe two,
I agree that adding a bunch of new types feels like a needless chore, two thoughts here:
|
rust-analyzer/crates/paths/src/lib.rs Line 133 in 7db7387
^^ that's the impl Trait |
Yeah, been considering this as well! I'd say this is not necessary, as in, API is fine without, and it can be added in a minor release. If there's a clear good solution, I'd do that. But I don't think there is -- I am wondering if we could/should cannibalize Result here? Eg, for try-into I think we do want to have proper errors, but maybe something like this would make sense as well?
|
☔ The latest upstream changes (presumably #12681) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #12808) made this pull request unmergeable. Please resolve the merge conflicts. |
This hasn't seen much movement, and I've adapted the parts I need for my own purposes. Going to close due to lack of interest. |
These aren't really rust (analyzer) specific, and might be useful in other language servers.
If this seems ok in principle, we might want to