rust/crates
bors[bot] d134a81037
Merge #5976
5976: Complete trait impl immediately after type/const/fn r=jonas-schievink a=oxalica

Currently, we can complete type/const/fn but only if we typed an identifier.
That is, `impl .. { fn f<|> }` has completions with all trait fn including `f`, but `impl .. { fn <|> }` doesn't provide any suggestion (even if explicit trigger it).

This PR tweak the logic of completion match to make it possible.

However, we still need to explicit trigger suggestions (`Control + Space` by default) in vscode to show. Not sure if we can make it automatically triggered after typing the space after `fn`.

Another question is that I cannot figure out why `BLOCK_EXPR` need to be checked. A block expr directly inside a impl block should be invalid, and nested items will failed to locate impl block in specific offset and skip the suggestion. Now I simply removed it and no tests are broken.
4f91478e50/crates/ide/src/completion/complete_trait_impl.rs (L109)


Co-authored-by: oxalica <oxalicc@pm.me>
2020-09-14 10:22:20 +00:00
..
arena Add TBD description to arena 2020-08-24 13:29:10 +02:00
assists Make MergeBehaviour configurable 2020-09-12 12:11:16 +02:00
base_db Move most of the logic into the completion module 2020-09-10 01:42:20 +03:00
cfg Add description for crates that will be published 2020-08-24 13:07:22 +02:00
flycheck Add description for crates that will be published 2020-08-24 13:07:22 +02:00
hir Merge #5971 2020-09-13 17:28:22 +00:00
hir_def Merge #5971 2020-09-13 17:28:22 +00:00
hir_expand Move most of the logic into the completion module 2020-09-10 01:42:20 +03:00
hir_ty Merge #5971 2020-09-13 17:28:22 +00:00
ide Merge #5976 2020-09-14 10:22:20 +00:00
ide_db Rename record_field_pat to record_pat_field 2020-09-10 18:56:04 +02:00
mbe Add description for crates that will be published 2020-08-24 13:07:22 +02:00
parser Rename record_field_pat to record_pat_field 2020-09-10 18:56:04 +02:00
paths Add description for crates that will be published 2020-08-24 13:07:22 +02:00
proc_macro_api Add description for crates that will be published 2020-08-24 13:07:22 +02:00
proc_macro_srv Add description for crates that will be published 2020-08-24 13:07:22 +02:00
proc_macro_test Add description for crates that will be published 2020-08-24 13:07:22 +02:00
profile Add description for crates that will be published 2020-08-24 13:07:22 +02:00
project_model Report better errors in project.json/sysroot 2020-09-11 14:48:56 +02:00
rust-analyzer Make MergeBehaviour configurable 2020-09-12 12:11:16 +02:00
ssr ⬆️ expect-test 2020-08-28 14:47:14 +02:00
stdx Add description for crates that will be published 2020-08-24 13:07:22 +02:00
syntax Rename record_field_pat to record_pat_field 2020-09-10 18:56:04 +02:00
test_utils Add description for crates that will be published 2020-08-24 13:07:22 +02:00
text_edit Actually assert disjointness 2020-09-03 13:37:36 +02:00
toolchain Add description for crates that will be published 2020-08-24 13:07:22 +02:00
tt Add description for crates that will be published 2020-08-24 13:07:22 +02:00
vfs Rename the method to avoid false promises 2020-09-10 01:45:49 +03:00
vfs-notify Add description for crates that will be published 2020-08-24 13:07:22 +02:00