Rollup merge of #93217 - willcrichton:example-analyzer, r=GuillaumeGomez

Improve Rustdoc UI for scraped examples with multiline arguments, fix overflow in line numbers

This PR improves a few aspects of the scrape examples feature in Rustdoc.
* Only function names and not the full call expression are highlighted.
* For call-sites with multiline arguments, the minimized code viewer will scroll to the top of the call-site rather than the middle if the argument is larger than the viewer size, ensuring that the function name is visible.
* This fixes an issue where the line numbers column had a visible x-scroll bar.

r? `@GuillaumeGomez`
This commit is contained in:
Dylan DPC 2022-04-13 17:35:32 +02:00 committed by GitHub
commit db61452b7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 342 additions and 88 deletions

View file

@ -1,7 +1,6 @@
// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2'
// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1'
// @has foobar/fn.ok.html '//*[@class="highlight focus"]' '1'
// @has foobar/fn.ok.html '//*[@class="highlight"]' '2'
// @has foobar/fn.ok.html '//*[@class="highlight focus"]' '0'
// @has foobar/fn.ok.html '//*[@class="highlight focus"]' 'ok'
// @has foobar/fn.ok.html '//*[@class="highlight"]' 'ok'
pub fn ok(_x: i32) {}