Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Update doc urls #85

Merged
merged 1 commit into from
Sep 11, 2017
Merged

Update doc urls #85

merged 1 commit into from
Sep 11, 2017

Conversation

jonasbb
Copy link
Contributor

@jonasbb jonasbb commented Sep 4, 2017

I tried to solve rust-lang/rls#452 This is my current approach. I tried updating the URL format as well. While changing the code I also added a test method for it.

The problem now is that some elements are missing/not working and I don't know how to fix them/if they need fixing.

Mainly taken from the test:

  • Primitives like i64. i64 is shown with type mod but requires name "primitive".
  • All methods (instead of trait methods, see as_mut), seem to only be available for generic qualname.
  • Unions like ManuallyDrop are not in the analysis file, just methods implemented for them or methods using them.
  • I don't think there is documentation for DefKind::Local/DefKind::Static, so this should not be a problem.

The PR is based on: #84

@nrc
Copy link
Member

nrc commented Sep 5, 2017

Using the namespaced URLs is a much better idea than trying to use the legacy rustdoc ones. There will be redirects for everything. I don't think we have enough information to generate the legacy URLs in every case. I don't remember exactly, but I think it went wrong for methods, because they are always treated as functions by Rust/save-analysis, but rustdoc makes a distinction between methods and functions. Or something like that.

Anyway, I think the fix here can be much simpler - we just need to know when the parent is a module and then treat that as a first class page, rather than as an anchor on the module page.

(It seems like the expected redirects for modules might be missing - https://doc.rust-lang.org/nightly/std/env.t.html doesn't work, you need https://doc.rust-lang.org/nightly/std/env. That kind of makes sense, but it means we have to be a bit more careful there, or add a redirect to rustdoc).

@jonasbb
Copy link
Contributor Author

jonasbb commented Sep 5, 2017

Thanks for the information about the URL format. I found some information here: rust-lang/rust#35020. I thought that the .t.html format is legacy, because it is only used in RLS and the struct.type.html URLs are much nicer for humans.

Unfortunately, it is not as easy as you describe it, but most of this PR is reusable.
I now changed the URLs to the new format, the tests are a bit extended, but I needed to keep the logic in mk_doc_url.

@jonasbb jonasbb changed the title WIP update doc urls Update doc urls Sep 7, 2017
@jonasbb
Copy link
Contributor Author

jonasbb commented Sep 11, 2017

@nrc Could you take a look at this please?

@nrc nrc merged commit 50a1f80 into rust-dev-tools:master Sep 11, 2017
@nrc
Copy link
Member

nrc commented Sep 11, 2017

This is great, thank you!

Sorry I missed the updated PR - I didn't see a notifcation - thanks for pinging me!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants