Commit Graph

14110 Commits

Author SHA1 Message Date
Laurențiu Nicola
fbeccf0b9d Allow spurious warning from rust-lang/rust#80501 2020-12-30 11:37:52 +02:00
bors[bot]
386c447038
Merge #7070
7070: Use applySnippetWorkspaceEdit again for actions, allow it to create files r=matklad a=Veykril

Fixes #7037

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-29 16:14:18 +00:00
Lukas Wirth
689898e4f6 Apply text edits manually in vscode client 2020-12-29 15:43:17 +01:00
bors[bot]
343029fa9e
Merge #7077
7077: Avoid a couple of allocations r=Veykril a=lnicola

r? @Veykril 

TBH I'm not sure this is worth it, but the other `Query` was already taking a `String`.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-29 13:15:07 +00:00
Laurențiu Nicola
42c24ff25f Avoid a couple of allocations 2020-12-29 14:35:49 +02:00
bors[bot]
ef1177c5b5
Merge #7064
7064: Ignore qualifiers when doing autoimport completions lookup r=lnicola a=SomeoneToIgnore

A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/6918#issuecomment-748511151 and the PR itself.

Tweaks the `import_map` query api to be more flexible with the ways to match against the import path and now fuzzy imports search in names only.
This had improved the completion speed for me locally in ~5 times for `fuzzy_completion` span time, but please recheck me here.

IMO we're fast and presice enough now, so I've added the modules back to the fuzzy search output.

Also tweaks the the expect tests to display functions explicitly, to avoid confusing "duplicate" results.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-12-29 12:19:31 +00:00
bors[bot]
7b246a6a14
Merge #7076
7076: Properly parse path separators in format-like postfix r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-29 12:12:19 +00:00
Lukas Wirth
ddc25d87ca Properly parse path separators in format-like postfix 2020-12-29 13:10:35 +01:00
bors[bot]
bd18093740
Merge #7075
7075: format-postfix completion takes format instead of fmt r=lnicola a=Veykril

See https://github.com/rust-analyzer/rust-analyzer/issues/6843
this brings it back in line with the documentation

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-29 11:45:00 +00:00
Lukas Wirth
20bd4ddd4e format-postfix completion takes format instead of fmt 2020-12-29 12:28:46 +01:00
Kirill Bulatov
77b4a1c5ef Tweak the fuzzy search limits 2020-12-28 16:37:51 +02:00
Kirill Bulatov
eecbb51cb3 Better display methods in expect tests 2020-12-28 16:13:37 +02:00
Kirill Bulatov
8600cf807e Add tests 2020-12-28 15:22:03 +02:00
Kirill Bulatov
e4c3f753d2 Add docs and optimisations 2020-12-28 15:09:39 +02:00
Kirill Bulatov
c4995cfbd5 Better query api and fuzzy search 2020-12-28 15:06:10 +02:00
Kirill Bulatov
0e48cd0c3c Draft the module exclusion in modules 2020-12-28 15:06:10 +02:00
bors[bot]
77ad203a71
Merge #7060
7060: Fix mbe fail to pass expr with attr r=edwin0cheng a=edwin0cheng

bors r+

Fixes #5896

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-12-28 12:34:19 +00:00
bors[bot]
99ec2f623d
Merge #7059
7059: Special case $_ in meta var instead of treat it as ident in mbe  r=lnicola a=edwin0cheng

In #6929, we treat '_' as an ident but rustc is only allow it in some special places (e.g. meta var in mbe , type, pat etc). 

This PR rollback that and we only make '$_' works in meta var matching. 

Fixes #7056 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-12-28 12:26:55 +00:00
Edwin Cheng
877c251bef Fixed old failed test due to new fixes 2020-12-28 20:08:50 +08:00
Edwin Cheng
710407b11d Fix mbe fail to pass expr with attr 2020-12-28 19:53:00 +08:00
Edwin Cheng
b5c29af02a Special case underscore in mbe meta op 2020-12-28 18:51:43 +08:00
Edwin Cheng
b33453f844 Rollback 6929 2020-12-28 18:47:00 +08:00
bors[bot]
86f947c1fb
Merge #7058
7058: Improve commit message style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-28 10:44:38 +00:00
Aleksey Kladov
9c0c5f8e37 Improve commit message style 2020-12-28 13:43:07 +03:00
bors[bot]
1d530756ed
Merge #7050
7050: Ignore third punct when matching for 2-composite punct in mbe r=jonas-schievink a=edwin0cheng

Fixes #6692



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-12-27 16:42:01 +00:00
Edwin Cheng
26e1f7696a Ignore third punct in 2-composite punct 2020-12-27 23:51:00 +08:00
bors[bot]
8f2622199e
Merge #6820
6820: Pass the crate environment to proc macros r=jonas-schievink a=jonas-schievink

In theory, fixes https://github.com/rust-analyzer/rust-analyzer/issues/6696.

This seems to result in these obscure crashes for some reason:

```
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/scoped_cell.rs:75:51
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
   2: core::panicking::panic
             at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:50
   3: core::option::Option<T>::unwrap
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:383
   4: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/scoped_cell.rs:75
   5: proc_macro::bridge::client::BridgeState::with::{{closure}}
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:291
   6: std:🧵:local::LocalKey<T>::try_with
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272
   7: std:🧵:local::LocalKey<T>::with
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248
   8: proc_macro::bridge::client::BridgeState::with
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:290
   9: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::with
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:329
  10: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:375
  11: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/scoped_cell.rs:80
  12: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/scoped_cell.rs:75
  13: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/scoped_cell.rs:80
  14: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:325
  15: std:🧵:local::LocalKey<T>::try_with
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:272
  16: std:🧵:local::LocalKey<T>::with
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:248
  17: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:325
  18: proc_macro::bridge::client::run_client::{{closure}}
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:370
  19: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:308
  20: std::panicking::try::do_call
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:381
  21: __rust_try
  22: std::panicking::try
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:345
  23: std::panic::catch_unwind
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:382
  24: proc_macro::bridge::client::run_client
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:369
  25: proc_macro::bridge::client::Client<fn(proc_macro::TokenStream) .> proc_macro::TokenStream>::expand1::run
             at /home/jonas/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro/src/bridge/client.rs:410
  26: proc_macro_srv::proc_macro::bridge::server::run_server
  27: proc_macro_srv::dylib::Expander::expand
  28: proc_macro_srv::ProcMacroSrv::expand
  29: proc_macro_srv::cli::run
  30: rust_analyzer::main
```

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-12-27 14:39:05 +00:00
Jonas Schievink
70877428a8 Pass crate environment to proc macros 2020-12-27 15:29:47 +01:00
Jonas Schievink
798968e1e3 Move TokenExpander to base_db and rename it
It's only used to break the dependency to proc_macro_api
2020-12-27 15:29:47 +01:00
bors[bot]
0fd75c98ac
Merge #7047
7047: Add force_show_panics flag for proc-macro bridge r=jonas-schievink a=edwin0cheng

https://github.com/rust-lang/rust/pull/75082 and https://github.com/rust-lang/rust/pull/76292 added a new flag in `proc_macro::Bridge` such that the ABI was changed. These ABI changing are the reason of some weird panics which caused #6880 and maybe related to the panic mentioned in #6820.

These changes are landed on rust stable 1.48 so I think it is okay to apply it now.

fixes #6880

r @jonas-schievink 


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-12-27 13:30:06 +00:00
Edwin Cheng
da92f46cc8 Add force_show_panics flag 2020-12-27 18:00:59 +08:00
bors[bot]
1d874a2a65
Merge #7043
7043: Simplify assists resolution API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-26 11:14:19 +00:00
Aleksey Kladov
2f22675537 Simplify assists resolution API
Assist vs UnresolvedAssist split doesn't really pull its weight. This
is especially bad if we want to include `Assist` as a field of
diagnostics, where we'd have to make the thing generic.
2020-12-26 14:11:42 +03:00
bors[bot]
44893bbcc5
Merge #7038
7038: Fix type typo in add_missing_impl_members doc r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-25 17:17:14 +00:00
Lukas Wirth
e7dd73ea9e Fix type typo in add_missing_impl_members doc 2020-12-25 18:15:31 +01:00
bors[bot]
14ee9f539c
Merge #7036
7036: Don't split path separators apart in doctest runnables r=Veykril a=Veykril

Fixes #7035

bors r+ 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-25 10:25:58 +00:00
Lukas Wirth
3ab4f3adbd Don't split path separators apart in doctest runnables 2020-12-25 11:22:11 +01:00
bors[bot]
e8f5626e44
Merge #7032
7032: Simplify more r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-24 16:38:10 +00:00
Aleksey Kladov
5d914834a9 Simplify more 2020-12-24 19:37:46 +03:00
bors[bot]
f43182e621
Merge #7031
7031: Simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-24 15:06:38 +00:00
Aleksey Kladov
29ed2e0e73 Simplify 2020-12-24 17:54:44 +03:00
bors[bot]
581419fd78
Merge #7030
7030: Support labels in reference search r=matklad a=Veykril

Implements general navigation for labels, goto def, rename and gives labels their own semantic highlighting class.

Fixes #6966

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-24 14:46:41 +00:00
Lukas Wirth
42e3f97c30 Support labels in reference search 2020-12-24 15:40:18 +01:00
bors[bot]
a31ee54afa
Merge #7029
7029: Flush stdout when clearing the progress bar r=lnicola a=lnicola

To prevent this from happening:

```
Database loaded 496.24ms, 288mi
Crates in this dir: 1
Total modules found: 14
Total declarations: 159
Total functions: 122
Item Collection: 6.02s, 61846mi
122/122 100% processing: archive::sizeTotal expressions: 6592       
Expressions of unknown type: 4 (0%)
Expressions of partially unknown type: 104 (1%)
Type mismatches: 3
Inference: 1.03s, 8622mi
Total: 7.05s, 70468mi
```

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-24 13:40:29 +00:00
Laurențiu Nicola
b21a79364a Flush stdout when clearing the progress bar 2020-12-24 15:38:45 +02:00
bors[bot]
aebf7ee2b6
Merge #7028
7028: pit-of-success API for unresolved code actions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-24 12:50:30 +00:00
Aleksey Kladov
33384d289e pit-of-success API for unresolved code actions 2020-12-24 15:32:29 +03:00
bors[bot]
06320015af
Merge #7021
7021: Track labels in the HIR r=matklad a=Veykril

Groundwork for #6966

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-24 12:04:28 +00:00
Lukas Wirth
262b9c3982 Track labels in the HIR 2020-12-24 12:49:40 +01:00
bors[bot]
1487f2f10e
Merge #7027
7027: Fix macro_rules not accepting brackets or parentheses r=matklad,lnicola a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-24 08:44:52 +00:00