aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Move ide::AnalysisChange -> base_db::ChangeAleksey Kladov2020-10-0211-93/+122
| | | | | | This seems like a better factoring logically; ideally, clients shouldn't touch `set_` methods of the database directly. Additionally, I think this should remove the unfortunate duplication in fixture code.
* Expectify find_references testsAleksey Kladov2020-10-021-176/+181
|
* Merge #6121bors[bot]2020-10-022-13/+14
|\ | | | | | | | | | | | | | | | | 6121: Reduce visibiity r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Reduce visibiityAleksey Kladov2020-10-022-13/+14
|/
* Merge #5988bors[bot]2020-10-023-2/+338
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5988: Postfix completions for fmt-like string literals r=matklad a=popzxc This pull request adds a bunch of new postfix completions for `format`-like string literls. For example, `"{32} {some_var:?}".println` will expand to `println!("{} {:?}", 32, some_var)`. Postfix completions were added for most common format-like macros: - `println` -> `println!(...)` - `fmt` -> `format!(...)` - `panic` -> `panic!(...)` - `log` macros: + `logi` -> `log::info!(...)` + `logw` -> `log::warn!(...)` + `loge` -> `log::error!(...)` + `logt` -> `log::trace!(...)` + `logd` -> `log::debug!(...)` ![fmt_postfix](https://user-images.githubusercontent.com/12111581/92998650-a048af80-f523-11ea-8fd8-410146de8caa.gif) Co-authored-by: Igor Aleksanov <[email protected]>
| * Use expect_test to make format_str_parser test more data-drivenIgor Aleksanov2020-10-021-35/+35
| |
| * Use lookup table instead of enum for postfix completion kindsIgor Aleksanov2020-10-021-62/+20
| |
| * Use ast::String for extracting string literal contentsIgor Aleksanov2020-10-022-14/+19
| |
| * Improve format-like completions code appearanceIgor Aleksanov2020-10-022-32/+26
| |
| * Add missing entry to doc-commentIgor Aleksanov2020-10-021-0/+1
| |
| * Simplify is_string_literal functionIgor Aleksanov2020-10-021-9/+5
| |
| * Improve checks for postfix suggestionsIgor Aleksanov2020-10-023-16/+23
| |
| * Add postfix completion for format-like string literalsIgor Aleksanov2020-10-023-1/+376
| |
* | Merge #5954bors[bot]2020-10-0210-2/+67
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5954: Add flexible configuration for runnables r=popzxc a=popzxc This PR introduces two new configuration options for runnables: `overrideCargo` and `cargoExtraArgs`. These options are applied to all the "run" tasks of rust analyzer, such as binaries and tests. Overall motivation is that rust-analyzer provides similar options, for example, for `rustfmt`, but not for runnables. ## `overrideCargo` This option allows user to replace `cargo` command with something else (well, something that is compatible with the cargo arguments). Motivation is that some projects may have wrappers around cargo (or even whole alternatives to cargo), which do something related to the project, and only then run `cargo`. With this feature, such users will be able to use lens and run tests directly from the IDE rather than from terminal. ![cargo_override](https://user-images.githubusercontent.com/12111581/92306622-2f404f80-ef99-11ea-9bb7-6c6192a2c54a.gif) ## `cargoExtraArgs` This option allows user to add any additional arguments for `cargo`, such as `--release`. It may be useful, for example, if project has big integration tests which take too long in debug mode, or if any other `cargo` flag has to be passed. ![cargo_extra_args](https://user-images.githubusercontent.com/12111581/92306658-821a0700-ef99-11ea-8be9-bf0aff78e154.gif) Co-authored-by: Igor Aleksanov <[email protected]>
| * | Fix failing testIgor Aleksanov2020-10-021-0/+6
| | |
| * | Support 'runnables' options in the vs code extensionIgor Aleksanov2020-10-025-2/+31
| | |
| * | Replace 'cargo_prefix' option with 'override_cargo'Igor Aleksanov2020-10-024-10/+10
| | |
| * | Add support of runnables arguments in Rust AnalyzerIgor Aleksanov2020-10-024-0/+30
| |/
* | Merge #6105bors[bot]2020-10-021-48/+85
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | 6105: Fix path comparison not comparing paths correctly with unequal lengths r=matklad a=Veykril ~~This PR includes the commit from #6102 there as I found a bug while writing that(so either merging this or both in order works) so I included a test there already which was just ignored.~~ This PR fixes that, basically inserting imports didn't consider path length for equality, so depending on the order it might insert the path before or after another import if they only differ in segment length. ~~Diff without the commit of #6102 https://github.com/rust-analyzer/rust-analyzer/commit/2d90d3937d71f9a00f3d44c15b20679215311637~~ Co-authored-by: Lukas Wirth <[email protected]>
| * Fix path comparison not comparing paths correctly with unequal lengthsLukas Wirth2020-10-011-48/+85
| |
* | Merge #6118bors[bot]2020-10-021-0/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 6118: Document Clippy strategy r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Document Clippy strategyAleksey Kladov2020-10-021-0/+10
| | |
* | | Merge #6104bors[bot]2020-10-026-7/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6104: Minor clippy performance suggestions r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
| * | | Minor clippy performance suggestionskjeremy2020-09-306-7/+7
| | | |
* | | | Merge #6116bors[bot]2020-10-023-19/+19
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | 6116: Up rustc-ap-rustc_lexer to 681 r=matklad a=kjeremy cargo update as well Co-authored-by: kjeremy <[email protected]>
| * | | Up rustc-ap-rustc_lexer to 681kjeremy2020-10-013-19/+19
| | |/ | |/| | | | | | | cargo update as well
* | | Merge #6114bors[bot]2020-10-011-5/+4
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | 6114: Improve grammar and fix code example in style guide r=kjeremy a=lnicola Co-authored-by: Laurențiu Nicola <[email protected]>
| * | Improve grammar and fix code example in style guideLaurențiu Nicola2020-10-011-5/+4
|/ /
* | Merge #6101bors[bot]2020-10-011-12/+19
|\ \ | | | | | | | | | | | | | | | | | | | | | 6101: cargo update r=kjeremy a=kjeremy Co-authored-by: kjeremy <[email protected]>
| * | cargo updatekjeremy2020-09-301-12/+19
| |/
* | Merge #6102bors[bot]2020-09-301-21/+52
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6102: Fix MergingBehaviour::Last creating unintuitive import trees r=jonas-schievink a=Veykril The way this behaviour currently works is actually a bit weird. Imagine the following three imports get requested for insertion in the given order: - `winapi::um::d3d11::ID3D11Device` - `winapi::shared::dxgiformat::DXGI_FORMAT` - `winapi::um::d3d11::D3D11_FILTER` After the first two you will have the following tree: ```rust use winapi::{shared::dxgiformat::DXGI_FORMAT, um::d3d11::ID3D11Device}; ``` which is to be expected as they arent nested this kind of merging is allowed, but now importing the third one will result in: ```rust use winapi::{shared::dxgiformat::DXGI_FORMAT, um::d3d11::ID3D11Device, um::d3d11::D3D11_FILTER}; ``` which is still fine according to the rules, but it looks weird(at least in my eyes) due to the long paths that are quite similar. The changes in this PR will change the criteria for when to reject `Last` merging, it still disallows multiple nesting but it also only allows single segment paths inside of the `UseTreeList`. With this change you get the following tree after the first two imports: ```rust use winapi::um::d3d11::ID3D11Device; use winapi::shared::dxgiformat::DXGI_FORMAT; ``` and after the third: ```rust use winapi::shared::dxgiformat::DXGI_FORMAT; use winapi::um::d3d11::{ID3D11Device, D3D11_FILTER}; ``` Which I believe looks more like what you would expect. Co-authored-by: Lukas Wirth <[email protected]>
| * Fix MergingBehaviour::Last not working properlyLukas Wirth2020-09-301-21/+52
|/
* Merge #6096bors[bot]2020-09-298-32/+85
|\ | | | | | | | | | | | | | | | | 6096: Extend **Status** command to also show dep info for the file r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Extend **Status** command to also show dep info for the fileAleksey Kladov2020-09-298-32/+85
| | | | | | | | This should help with troubleshooting wrong project configuration
* | Merge #6095bors[bot]2020-09-296-64/+13
|\| | | | | | | | | | | | | | | | | 6095: Remove periodic gc stub r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Remove periodic gc stubAleksey Kladov2020-09-296-64/+13
|/
* Merge #6094bors[bot]2020-09-291-1/+3
|\ | | | | | | | | | | | | | | 6094: More panic_context r=matklad a=matklad bors r+\n🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * More panic_contextAleksey Kladov2020-09-291-1/+3
| |
* | Merge #6093bors[bot]2020-09-293-2/+55
|\| | | | | | | | | | | | | | | 6093: Add panic_context module for better panic messages r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
| * Add panic_context module for better panic messagesAleksey Kladov2020-09-293-2/+55
|/
* Merge #6090bors[bot]2020-09-291-0/+52
|\ | | | | | | | | | | | | | | 6090: More style advice r=matklad a=matklad bors r+\n🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * More style adviceAleksey Kladov2020-09-291-0/+52
| |
* | Merge #5928bors[bot]2020-09-297-9/+175
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5928: Add method references CodeLens r=vsrs a=vsrs The PR adds CodeLens for methods and free-standing functions: ![method_refs](https://user-images.githubusercontent.com/62505555/91858244-95fbfb00-ec71-11ea-90c7-5b3ee067e305.png) Relates to #5836 Co-authored-by: vsrs <[email protected]>
| * | Replace "No references" with "0 references".vsrs2020-09-291-2/+3
| | |
| * | Add testsvsrs2020-09-291-3/+77
| | |
| * | Do not show references CodeLens for tests.vsrs2020-09-293-14/+26
| | |
| * | Make method references CodeLens lazy.vsrs2020-09-292-43/+56
| | |
| * | Make method references CodeLens off by default.vsrs2020-09-292-3/+3
| | |
| * | Add method references CodeLensvsrs2020-09-294-8/+74
|/ /
* | Merge #6080bors[bot]2020-09-295-13/+149
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: <[email protected]> /// 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 <[email protected]>