bors[bot] e813de6cdd
Merge #6080
6080: Add hover config `linksInHover` to suppress links r=flw-cn a=flw-cn

This PR solves the problem of using RA under vim8. It should close #6014.

Since vim8's popup-window doesn't capture focus, the URL given by RA is effectively useless. links are neither displayed correctly nor can they be clicked. This makes the hover window ugly and inefficient.

I'm providing this patch so that people who share my confusion (which I'm almost certain vim8 users do) will have a way to remove links from markdown.

I noticed that [gopls has an option](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#linksinhover-bool) for a similar purpose. So I added an option `linksInHover` to enable this behavior. This is a bool value and defaults to `true` to keep the behavior consistent with the master version. But you can suppress the links in the hover text by setting it to `false`.

The name of my option, `linksInHover`, is borrowed from gopls.

Before applying this patch:

<img width="1280" alt="image" src="https://user-images.githubusercontent.com/5546718/93285021-85698a00-f806-11ea-911d-e77fea4a47f0.png">

After applying this patch(with `"rust-analyzer.hoverActions.linksInHover": false,`):
<img width="1280" alt="image" src="https://user-images.githubusercontent.com/5546718/94332256-2e359780-0006-11eb-9724-1aed14130d0d.png">

This is the full test cases:
```
fn main() {
    let args: Vec<String> = std::env::args().collect();
    test();
    println!("args: {:?}", args);
}

/// Test cases:
/// case 1.  bare URL: https://rust-lang.org/
/// case 2.  inline URL with title: [foo](https://rust-lang.org/)
/// case 3.  code refrence: [`Result`]
/// case 4.  code refrence but miss footnote: [`String`]
/// case 5.  autolink: <http://rust-lang.org/>
/// case 6.  email address: <test@example.com>
/// case 7.  refrence: [bing][google]
/// case 8.  collapsed link: [bing][]
/// case 9.  shortcut link: [bing]
/// case 10. inline without URL: [bing]()
/// case 11. refrence: [foo][foo]
/// case 12. refrence: [foo][bar]
/// case 13. collapsed link: [foo][]
/// case 14. shortcut link: [foo]
/// case 15. inline without URL: [foo]()
/// case 16. just escaped text: \[hello]
/// case 17. inline link: [Foo](foo::Foo)
///
/// [`Result`]: ../../std/result/enum.Result.html
/// [^bing]: https://www.bing.com/
/// [^google]: https://www.google.com/
pub fn test() {
    println!("Hello");
}
```

screenshot:
<img width="1278" alt="image" src="https://user-images.githubusercontent.com/5546718/94332055-45738580-0004-11eb-9153-707f508d0c4b.png">

Co-authored-by: flw <flw@cpan.org>
2020-09-29 12:10:47 +00:00
2020-08-19 20:17:49 +02:00
2020-09-01 09:50:48 +02:00
2020-08-28 21:41:45 +10:00
2020-09-23 08:39:04 -07:00
2020-08-12 18:30:53 +02:00
2020-08-13 10:57:09 +02:00
2020-09-28 14:24:11 -04:00
2020-08-18 17:44:51 +02:00

rust-analyzer logo

rust-analyzer is an experimental modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.

Work on rust-analyzer is sponsored by

Ferrous Systems

Quick Start

https://rust-analyzer.github.io/manual.html#installation

Documentation

If you want to contribute to rust-analyzer or are just curious about how things work under the hood, check the ./docs/dev folder.

If you want to use rust-analyzer's language server with your editor of choice, check the manual folder. It also contains some tips & tricks to help you be more productive when using rust-analyzer.

Communication

For usage and troubleshooting requests, please use "IDEs and Editors" category of the Rust forum:

https://users.rust-lang.org/c/ide/14

For questions about development and implementation, join rls-2.0 working group on Zulip:

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frls-2.2E0

License

Rust analyzer is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Description
No description provided
Readme 1.4 GiB
Languages
Rust 96.2%
RenderScript 0.7%
JavaScript 0.6%
Shell 0.6%
Fluent 0.4%
Other 1.3%