rust/crates/ide
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
..
src Merge #5976 2020-09-14 10:22:20 +00:00
Cargo.toml ⬆️ expect-test 2020-08-28 14:47:14 +02:00