Commit Graph

276 Commits

Author SHA1 Message Date
Guillaume Gomez
4b14573d50 Add minification process 2018-05-12 19:15:06 +02:00
Guillaume Gomez
d0840fd63b Fix paths search 2018-05-05 12:44:10 +02:00
Guillaume Gomez
135ee85aba Rename "show type declaration" to "show declaration" 2018-04-30 22:32:17 +02:00
Guillaume Gomez
acf0adf798 Add setting to go to item if there is only one result 2018-04-26 19:53:21 +02:00
Guillaume Gomez
ac0f99c03f Some JS improvements 2018-04-25 09:01:32 +02:00
Guillaume Gomez
f33af5c4de fix search bar bug 2018-04-23 23:55:36 +02:00
bors
28193e873c Auto merge of #49954 - GuillaumeGomez:doc-settings, r=ollie27,QuietMisdreavus
Add rustdoc settings menu

Fixes #18167.

r? @QuietMisdreavus
2018-04-22 11:04:41 +00:00
Guillaume Gomez
d0e2d26ceb remove unused condition 2018-04-21 22:02:54 +02:00
Guillaume Gomez
ca3213c338 fix invalid items removal 2018-04-21 22:02:54 +02:00
Guillaume Gomez
03b0856849 Add aliases in the search as well 2018-04-21 22:02:53 +02:00
Guillaume Gomez
654cb84852 Add specific never search 2018-04-21 22:01:38 +02:00
Guillaume Gomez
f2ad3c3f6c Add rustdoc settings menu 2018-04-17 23:35:43 +02:00
Guillaume Gomez
47a9ffa573 Add multi-query search 2018-04-14 17:01:28 +02:00
Guillaume Gomez
238583a50f Fix anchors issue when everything is collapsed 2018-04-04 16:16:53 +02:00
bors
15e8c5d846 Auto merge of #49412 - GuillaumeGomez:hide-type-decl, r=QuietMisdreavus
Hide type declarations by default

I'm not very happy for the moment about the rendering but the bases are here:

<img width="610" alt="screen shot 2018-03-27 at 11 56 27" src="https://user-images.githubusercontent.com/3050060/37960492-0e045954-31b6-11e8-9cea-1ef8a3f980c4.png">

r? @QuietMisdreavus
2018-03-30 01:45:54 +00:00
kennytm
1a89250356
Rollup merge of #49439 - GuillaumeGomez:trait-impl-collapse, r=QuietMisdreavus
Fix trait implementation not collapsing docs

r? @QuietMisdreavus
2018-03-28 17:55:16 +02:00
kennytm
611ceef28d
Rollup merge of #49429 - GuillaumeGomez:fix-collapse-toggle-insertion, r=QuietMisdreavus
Fix collapse toggle insertions on impl with docs

Just went through this one randomly... When an impl has docs, the collapse toggle isn't generated. This fixes it.

r? @QuietMisdreavus
2018-03-28 17:55:14 +02:00
Guillaume Gomez
884153a257 Fix trait implementation not collapsing docs 2018-03-28 09:51:18 +02:00
Guillaume Gomez
8be26a2ca0 Fix collapse toggle insertions on impl with docs 2018-03-27 22:49:55 +02:00
Guillaume Gomez
73b97c7e7c Hide type declarations by default 2018-03-27 11:57:00 +02:00
Guillaume Gomez
96ef2f8ab9 Fix search appearance 2018-03-27 10:33:31 +02:00
Guillaume Gomez
90588a9086 Fix IE11 search 2018-03-23 21:27:15 +01:00
Guillaume Gomez
5581aa8eeb Fix events handling in rustdoc 2018-03-18 16:32:41 +01:00
kennytm
15d71d3285
Rollup merge of #48631 - focusaurus:remember-collapse-setting, r=QuietMisdreavus
Remember state of top-level collapse toggle widget

This change allows the big top-right expand/collapse toggle to remember its setting across navigation or page reloads. Prior to this change, there was this annoyance:

- browse to some docs
- Click the minus button to collapse them
- browse to other docs (or reload the page)
- Everything is expanded again

The solution is based on storing a simple boolean flag in localStorage. I think it's a good improvement, but it does introduce the following potentially surprising behavior:

- browse to some docs
- click the minus button to collapse them
- click to expand a particular item (not the main top-right big one)
- reload the page, everything is collapsed

Paired with @debugsteven on this.
2018-03-13 05:01:15 +08:00
Guillaume Gomez
9e0ccc5a47 Fix escape not working when searchbar selected 2018-03-09 17:45:44 +01:00
Guillaume Gomez
6235ef0422 Add missing items in the sidebar for functions 2018-03-09 17:45:44 +01:00
Guillaume Gomez
a628543891 Don't generate '[+]'/'[-]' on 'empty' traits 2018-03-05 23:39:34 +01:00
Peter Lyons
2dd81c86c5 Rename doc collapse sentinal to rustdoc-collapse 2018-03-01 02:50:32 -07:00
Peter Lyons
55cc9a4336 Remember state of top-level collapse toggle widget 2018-03-01 00:03:47 -07:00
kennytm
71ce38eb9e
Rollup merge of #48381 - GuillaumeGomez:rustdoc-theme-securities, r=QuietMisdreavus
Rustdoc theme securities

Fixes #48375.
Fixes #48376.

r? @steveklabnik
cc @QuietMisdreavus
2018-02-28 19:15:31 +08:00
bors
89e5a0796e Auto merge of #47894 - vi:rustdoc_foldable_impls, r=GuillaumeGomez,QuietMisdreavus
rustdoc: Foldable impl blocks

Addresses #40363, #45720, #24483, #23986 and so on

* Expands and refactors collapseDocs and toggleAllDocs
* Adds [-] toggle to all impls (including inherent impl)
* Makes it hiding though main css file, not though element inline style

May need to be addressed:

* "[-]" and anchor link copier are overlaid a bit
* Inherent methods are also hidden by the global [-] toggle.
* Auto-collapsing "Iterator" and so on by default is not implemented yet
* Tested only shallowly and only in Chromiuim
* No tests. Are there tests for css/js part here?
* The new implementation may be a bit slower.

What next steps are need to be done before the integration?
2018-02-28 04:24:18 +00:00
Guillaume Gomez
5b61b615f5 Allow to not switch to a theme if it doesn't exist 2018-02-20 20:11:58 +01:00
Aaron Hill
64a1f6fbfd
Fix inlining 2018-02-18 16:29:25 -05:00
Aaron Hill
1531fbe9be
Cleanup formatting 2018-02-18 16:29:25 -05:00
Aaron Hill
6728f21d85
Generate documentation for auto-trait impls
A new section is added to both both struct and trait doc pages.

On struct/enum pages, a new 'Auto Trait Implementations' section displays any
synthetic implementations for auto traits. Currently, this is only done
for Send and Sync.

On trait pages, a new 'Auto Implementors' section displays all types
which automatically implement the trait. Effectively, this is a list of
all public types in the standard library.

Synthesized impls for a particular auto trait ('synthetic impls') take
into account generic bounds. For example, a type 'struct Foo<T>(T)' will
have 'impl<T> Send for Foo<T> where T: Send' generated for it.

Manual implementations of auto traits are also taken into account. If we have
the following types:

'struct Foo<T>(T)'
'struct Wrapper<T>(Foo<T>)'
'unsafe impl<T> Send for Wrapper<T>' // pretend that Wrapper<T> makes
this sound somehow

Then Wrapper will have the following impl generated:
'impl<T> Send for Wrapper<T>'
reflecting the fact that 'T: Send' need not hold for 'Wrapper<T>: Send'
to hold

Lifetimes, HRTBS, and projections (e.g. '<T as Iterator>::Item') are
taken into account by synthetic impls

However, if a type can *never* implement a particular auto trait
(e.g. 'struct MyStruct<T>(*const T)'), then a negative impl will be
generated (in this case, 'impl<T> !Send for MyStruct<T>')

All of this means that a user should be able to copy-paste a synthetic
impl into their code, without any observable changes in behavior
(assuming the rest of the program remains unchanged).
2018-02-18 16:29:24 -05:00
Guillaume Gomez
e9bcb4eb89 Hide theme button under menu in mobile mode and fix top margin issue (in mobile too) 2018-02-08 23:47:49 +01:00
Guillaume Gomez
dde3611281 Fix rendering issues on mobile 2018-02-03 13:13:29 +01:00
Vitaly _Vi Shukela
28efcfc083
rustdoc: Fix erroneous collapsing of second+ inherent impl. 2018-02-01 17:07:43 +03:00
Vitaly _Vi Shukela
a3acd10297
rustdoc: Auto-collapse all non-inherent impls 2018-02-01 16:53:29 +03:00
Vitaly _Vi Shukela
c904b1bef4
rustdoc: Fix some minor issues per reviewer 2018-01-31 17:35:57 +03:00
Vitaly _Vi Shukela
7cd0280226
rustdoc: Fix tidy errors found by travis 2018-01-31 04:02:51 +03:00
Vitaly _Vi Shukela
73f52d3d8f
rustdoc: Foldable impl blocks
Addresses #40363, #45720, #24483, #23986 and so on

* Expands and refactors collapseDocs and toggleAllDocs
* Adds [-] toggle to all impls (including inherent impl)
* Makes it hiding though main css file, not though element style

May need to be addressed:

* "[-]" and anchor link copier are overlaid a bit
* Inherent methods are also hidden by the global [-] toggle.
* Auto-collapsing "Iterator" and so on by default is not implemented yet
* Tested only shallowly and only in Chromiuim
* No tests. Are there tests for css/js part here?
* The new implementation may be a bit slower.
2018-01-31 03:48:16 +03:00
bors
4e3901d35f Auto merge of #47678 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

- Successful merges: #47423, #47425, #47440, #47541, #47549, #47554, #47558, #47610, #47635, #47655, #47661, #47662, #47667, #47672
- Failed merges:
2018-01-23 16:13:18 +00:00
Guillaume Gomez
7cc3cb29bd Fix quoted search 2018-01-22 22:49:44 +01:00
Guillaume Gomez
003b2bc1c6 Add possibility to have multiple themes 2018-01-21 17:34:55 +01:00
Guillaume Gomez
53d8ec0ecb Prepare main.js for tests 2018-01-12 22:51:34 +01:00
Guillaume Gomez
eea860f84c Fix search bar defocus 2018-01-05 01:14:10 +01:00
Johannes Boczek
3153d23bb7 Indentation fix
Fixed intentaion (tabs -> spaces)
Added trailing newline
2018-01-02 19:58:06 +01:00
Johannes Boczek
0772b6faed Defocus search bar in rustdoc pages
Escape now removes focus from the search bar
2018-01-02 19:47:44 +01:00
Guillaume Gomez
7f5c2f9249 Fix sidebar on ios 2017-12-20 01:53:18 +01:00
Guillaume Gomez
25e5af8a27 Rollup merge of #46824 - GuillaumeGomez:doc-sidebar, r=QuietMisdreavus
Fix dynamic crates listing in doc sidebar

Fixes #46687.

r? @QuietMisdreavus
2017-12-18 23:08:40 +01:00
Guillaume Gomez
cf18b1f22a Fix dynamic crates listing in doc sidebar 2017-12-18 21:15:46 +01:00
Guillaume Gomez
97c18f420e Improve results a bit 2017-12-15 15:42:38 +01:00
Guillaume Gomez
6351ebb7e5 make doc search more relevant 2017-12-15 14:44:49 +01:00
Guillaume Gomez
557236c508 Fix type filter in rustdoc js 2017-12-12 00:19:36 +01:00
Guillaume Gomez
423e5ac6f3 Fix JS errors 2017-12-07 22:55:14 +01:00
Guillaume Gomez
71b70feb1f Greatly improve sidebar when width < 700px 2017-12-07 22:42:46 +01:00
bors
bb1bd88ec3 Auto merge of #46221 - GuillaumeGomez:doc-script-load-speedup, r=nrc
Speedup search loading when search url is received

Fixes #45971.

r? @nrc

cc @rust-lang/docs
2017-12-07 09:47:01 +00:00
bors
d10b04d3df Auto merge of #45898 - JRegimbal:master, r=QuietMisdreavus
Change "Types/modules" title of search tab to be more accurate

From issue #45787. Used "In name" as per suggestion from @Seeker14491.
2017-12-06 03:02:17 +00:00
JRegimbal
41df62ce29 Changed tab names to those agreed upon.
Tabs are "In Names", "In Parameters", and "In Return Types".
2017-12-05 17:39:50 -05:00
Guillaume Gomez
30734c4e68 Fix deduplication of items 2017-12-01 20:55:25 +01:00
Guillaume Gomez
0a1219809d Fix global search 2017-11-26 13:13:14 +01:00
bors
ca8ef26293 Auto merge of #46081 - GuillaumeGomez:fix-path-search, r=QuietMisdreavus
Fix path search

Fixes #46015.

r? @QuietMisdreavus
2017-11-25 02:43:48 +00:00
Guillaume Gomez
de3a291455 Speedup search loading when search url is received 2017-11-23 21:19:48 +01:00
bors
421a2113a8 Auto merge of #45039 - QuietMisdreavus:doc-spotlight, r=GuillaumeGomez,QuietMisdreavus
show in docs whether the return type of a function impls Iterator/Read/Write

Closes #25928

This PR makes it so that when rustdoc documents a function, it checks the return type to see whether it implements a handful of specific traits. If so, it will print the impl and any associated types. Rather than doing this via a whitelist within rustdoc, i chose to do this by a new `#[doc]` attribute parameter, so things like `Future` could tap into this if desired.

### Known shortcomings

~~The printing of impls currently uses the `where` class over the whole thing to shrink the font size relative to the function definition itself. Naturally, when the impl has a where clause of its own, it gets shrunken even further:~~ (This is no longer a problem because the design changed and rendered this concern moot.)

The lookup currently just looks at the top-level type, not looking inside things like Result or Option, which renders the spotlights on Read/Write a little less useful:

<details><summary>`File::{open, create}` don't have spotlight info (pic of old design)</summary>

![image](https://user-images.githubusercontent.com/5217170/31209495-e59d027e-a950-11e7-9998-ceefceb71c07.png)

</details>

All three of the initially spotlighted traits are generically implemented on `&mut` references. Rustdoc currently treats a `&mut T` reference-to-a-generic as an impl on the reference primitive itself. `&mut Self` counts as a generic in the eyes of rustdoc. All this combines to create this lovely scene on `Iterator::by_ref`:

<details><summary>`Iterator::by_ref` spotlights Iterator, Read, and Write (pic of old design)</summary>

![image](https://user-images.githubusercontent.com/5217170/31209554-50b271ca-a951-11e7-928b-4f83416c8681.png)

</details>
2017-11-21 03:03:28 +00:00
Guillaume Gomez
c00eaa9969 Strongly improve search path 2017-11-20 21:54:27 +01:00
Guillaume Gomez
ad6324f6f7 Fix path search in docs 2017-11-19 12:14:56 +01:00
Guillaume Gomez
6047a03659 Add tooltip for important traits display 2017-11-18 14:37:10 +01:00
bors
18250b0349 Auto merge of #46073 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 4 pull requests

- Successful merges: #45767, #46044, #46066, #46071
- Failed merges:
2017-11-18 11:38:06 +00:00
Guillaume Gomez
85dcf2ecb6 Improve modal display and add JS events 2017-11-17 22:50:15 +01:00
Guillaume Gomez
aca1bd7d7e First step for important traits UI 2017-11-17 22:50:15 +01:00
QuietMisdreavus
cbe4ac3079 spotlight Iterator/Read/Write impls on function return types 2017-11-17 22:50:15 +01:00
Guillaume Gomez
955c054ab1 Fix primitive types not showing up 2017-11-17 22:33:02 +01:00
kennytm
2792b56a92
Support extern type in rustdoc.
Fixes #45640.
2017-11-15 18:20:28 +08:00
JRegimbal
42ae3dc45e "Types/modules" in tab to "In name"
"Types/modules" doesn't properly describe the results since it includes
other things whose name matches the search term.
2017-11-13 11:13:06 -05:00
Guillaume Gomez
0e4c829f2b Add "As parameters" items as well 2017-11-12 21:38:24 +01:00
Guillaume Gomez
5c5ab0d1fb Improve result output 2017-11-12 21:38:24 +01:00
Guillaume Gomez
6514f44bd1 Big JS optimization 2017-11-12 21:38:23 +01:00
Guillaume Gomez
c96be6f4cb Add elements count in tab search title 2017-11-12 21:38:23 +01:00
Guillaume Gomez
c3207ba0cf JS big updates 2017-11-12 21:38:23 +01:00
Guillaume Gomez
fec24adea8 Rollup merge of #45812 - GuillaumeGomez:links-and-search, r=QuietMisdreavus
Fix navbar click while in a search

Fixes #45790.
2017-11-11 13:38:06 +01:00
Guillaume Gomez
0d898998b1 Few improvements on search, history and title 2017-11-11 00:44:36 +01:00
Guillaume Gomez
72338b8ccb Allow to go back to previous search 2017-11-10 19:40:46 +01:00
Guillaume Gomez
5e116985eb Add "-" shortcut 2017-11-07 22:44:18 +01:00
Guillaume Gomez
acd5e8cd4e Fix navbar click while in a search 2017-11-06 23:49:47 +01:00
Guillaume Gomez
ee7e372bbf Remove duplicated results in the search 2017-11-01 13:41:43 +01:00
Guillaume Gomez
e8db5adcce fix function not appearing in first tab when appearing in another one. Thanks to @Seeker14491 for this one! 2017-11-01 13:41:43 +01:00
Guillaume Gomez
f6a546e14d Be more flexible when looking for something by using levenshtein method 2017-11-01 13:41:43 +01:00
Guillaume Gomez
6f21008aba Better check for returned value 2017-11-01 13:41:43 +01:00
Guillaume Gomez
56dbb3e32d Keep displaying good information when query is made 2017-11-01 13:41:43 +01:00
bors
a651106ad0 Auto merge of #45288 - GuillaumeGomez:tab-key-binding, r=QuietMisdreavus
Save the highlighted item when switching tab

To be merged after #45281.

r? @rust-lang/docs
2017-10-19 23:55:20 +00:00
kennytm
4913b92ff5 Rollup merge of #45281 - GuillaumeGomez:tab-selection, r=QuietMisdreavus
Save selected search tab

Fixes #45278.

r? @rust-lang/docs
2017-10-19 01:59:50 +08:00
Guillaume Gomez
c6ce067216 Hide help when search bar is focused 2017-10-14 18:46:29 +02:00
Guillaume Gomez
f44232688e Save current highlighted item in search tab 2017-10-14 18:24:27 +02:00
Guillaume Gomez
45bb03f60c Save selected search tab 2017-10-14 18:15:20 +02:00
Guillaume Gomez
3a65d12df7 Add tabs for search for better information access
Make tabs work
2017-10-09 23:26:10 +02:00
Guillaume Gomez
79f888da68 Add arrow and improve display 2017-09-11 22:31:37 +02:00
pravic
cb4a2d5078 Fix ES5 regression with shorthand names.
Reverts 1b6c9605e4.
2017-08-17 12:41:57 +03:00
Zack M. Davis
1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
QuietMisdreavus
1f9d032b38 rustdoc: put auto-hidden docblock labels in line with the toggle 2017-08-14 10:54:24 -05:00