What happens here is that we lower `: ` to a missing expression, and
then correctly record that the corresponding field expression resolves
to a specific field. Where we fail is in the mapping of syntax to this
missing expression. Doing it via `ast_field.expr()` fails, as that
expression is `None`. Instead, we go in the opposite direcition and ask
each lowered field about its source.
This works, but has wrong complexity `O(N)` and, really, the
implementation is just too complex. We need some better management of
data here.
8021: Enable searching for builtin types r=matklad a=Veykril
Not too sure how useful this is for reference search overall, but for completeness sake it should be there
![image](https://user-images.githubusercontent.com/3757771/111132711-f69db600-8579-11eb-8c90-22fd6862d11f.png)
Also enables document highlighting for them.
8022: some clippy::performance fixes r=matklad a=matthiaskrgr
use vec![] instead of Vec::new() + push()
avoid redundant clones
use chars instead of &str for single char patterns in ends_with() and starts_with()
allocate some Vecs with capacity to avoid unnecessary resizing
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
use vec![] instead of Vec::new() + push()
avoid redundant clones
use chars instead of &str for single char patterns in ends_with() and starts_with()
allocate some Vecs with capacity to avoid unneccessary resizing
7966: Diagnose files that aren't in the module tree r=jonas-schievink a=jonas-schievink
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6377
I'm not sure if this is the best way to do this. It will cause false positives for all `include!`d files (though I'm not sure how much IDE functionality we have for these).
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
8014: increase completion relevance for items in local scope r=matklad a=JoshMcguigan
This PR provides a small completion relevance score bonus for items in local scope. The changes here are relatively minimal, since `coc` by default pre-sorts by position in file. But as we move toward fully server side sorting #7935 I think we'll want some relevance score bump for items in local scope.
### Before
Note `let~` and `syntax` are both ahead of locals. Ultimately we may decide that `let~` is a high relevance completion given my cursor position here, but that should be done with some explicit scoring on the server side, rather than being caused by (I think) `coc` preferring shorter completions.
![pre-local-score](https://user-images.githubusercontent.com/22216761/111073414-c97ad600-849b-11eb-84e7-fcee130536f0.png)
### After
![post-local-score](https://user-images.githubusercontent.com/22216761/111073422-d0094d80-849b-11eb-92ec-7ae5ec3b190d.png)
Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
8016: More Chalk adaptations r=flodiebold a=flodiebold
- rename a bunch of fields
- use `chalk_ir::FnSig`
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
8012: xtask: replace "lint" command by a simply cargo alias r=matklad a=matthiaskrgr
This strips the run_clippy implementation out of xtask and replaces it by
a simple "cargo lint" alias which runs clippy with the corresponding flags.
Unfortunately I could not name the alias "clippy" because that would lead to infinite recursion. 😅
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
This strips the run_clippy implementation out of xtask and replaces it by
a simple "cargo lint" alias which runs clippy with the corresponding flags.
Unfortunately I could not name the alias "clippy" because that would lead to infinite recursion.
8011: Add no-sysroot flag for analysis-stats r=edwin0cheng a=edwin0cheng
Add `no-sysroot` flag for `rust-analyzer analysis-stats`. It is very useful for debugging propose.
bors r+
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>