diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-17 11:31:37 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-17 11:31:37 +0100 |
commit | b1315be010f0d9f67ee4794cb57f7d1baa88a30d (patch) | |
tree | b4259ce1810c3cd6c2bea62bae499415b764728d /crates/hir_ty/src/diagnostics | |
parent | 59483c217662fc5d89ef9da1cb93760e14a48418 (diff) | |
parent | 99c435939c941fe5216c39bc136769098abbbfea (diff) |
Merge #6262
6262: Do not spawn redundant hints r=SomeoneToIgnore a=popzxc
Closes #5206
This is a second part of the fix (first was #5997).
This PR adds a new method to the `CompletionContext`: `no_completion_required`. If this method returns `true`, it essentially means that user is unlikely to expect any hints from the IDE at this cursor position.
Currently, checks for the following cases were added:
- Previous item is `fn`: user creates a new function, names of existing functions won't be helpful. Exception for this case is `impl Foo for Bar` -- we must suggest trait function names.
- User entered `for _ i<|>`: it's obviously going to be `in` keyword, any hints here will be confusing.
More checks may be added there later, but currently I've only figured two cases.
![no_redundant_hints](https://user-images.githubusercontent.com/12111581/96332088-da4d2a00-106a-11eb-89a1-1159ece18f9d.png)
Co-authored-by: Igor Aleksanov <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/diagnostics')
0 files changed, 0 insertions, 0 deletions