Skip to content

Commit

Permalink
Enhanced hover tooltips
Browse files Browse the repository at this point in the history
Hover tooltips now extract documentation and declarations from
source based on the the file and span information that comes out
of the save-analysis. If the save-analysis data is missing (i.e.
there is no `Def` available), racer is used as fallback and the
`Def` is sythesized from the racer `Match` if one is found.

Function and object declarations are formatted using rustfmt and
context for local variables is also included in the tooltips.

All documentation that is discovered is now post-processed in order
to clean up code blocks so that syntax coloring works in in editors
that support markdown.

The racer fallback can be disabled via the `racer_completion`
configuration flag.
  • Loading branch information
aloucks committed Jul 30, 2018
1 parent a528e2f commit 3efe567
Show file tree
Hide file tree
Showing 90 changed files with 3,594 additions and 29 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ os:
- osx
rust:
- nightly
install:
install: |
# Required for Racer autoconfiguration
rustup component add rust-src
rustup component add rust-analysis
script: |
#!/bin/bash
set -e
cargo build -v
cargo test -v
set +e
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ Currently we accept the following options:
* `no_default_features` (`bool`, defaults to `false`) disables default Cargo
features
* `racer_completion` (`bool`, defaults to `true`) enables code completion using
racer (which is, at the moment, our only code completion backend)
racer (which is, at the moment, our only code completion backend). Also enables
hover tooltips to fall back to racer when save-analysis data is unavailable.
* `clippy_preference` (`String`, defaults to `"opt-in"`) controls eagerness of clippy
diagnostics when available. Valid values are _(case-insensitive)_:
- `"off"` Disable clippy lints.
Expand All @@ -131,6 +132,14 @@ and the following unstable options:
* `cfg_test` (`bool`, defaults to `false`) checks the project as if you were
running `cargo test` rather than `cargo build`. I.e., compiles (but does not
run) test code.
* `full_docs` (`bool`, defaults to `false`) instructs rustc to populate the
save-analysis data with full source documentation. When set to `false`, only the
first paragraph is recorded. This option _currently_ has little to no effect on
hover tooltips. The save-analysis docs are only used if source extraction fails.
This option has no effect on the standard library.
* `show_hover_context` show additional context in hover tooltips when available.
This is often the local variable declaration. When set to false the content is
only availabe when holding the `ctrl` key in some editors.


## Troubleshooting
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ install:
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
# Required for Racer autoconfiguration
- rustup component add rust-src
- rustup component add rust-analysis
# Print version info
- rustc -Vv
- cargo -V
Expand Down
Loading

0 comments on commit 3efe567

Please sign in to comment.