aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge #4065bors[bot]2020-04-232-7/+217
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4065: Complete unqualified enum names in patterns and expressions r=matklad a=nathanwhit This PR implements the completion described in #4014. The result looks like so for patterns: <img width="542" alt="Screen Shot 2020-04-20 at 3 53 55 PM" src="https://user-images.githubusercontent.com/17734409/79794010-8f529400-831f-11ea-9673-f838aa9bc962.png"> and for `expr`s: <img width="620" alt="Screen Shot 2020-04-21 at 3 51 24 PM" src="https://user-images.githubusercontent.com/17734409/79908784-d73ded80-83e9-11ea-991d-921f0cb27e6f.png"> I'm not confident that the completion text itself is very robust, as it will unconditionally add completions for enum variants with the form `Enum::Variant`. This means (I believe) it would still suggest `Enum::Variant` even if the local name is changed i.e. `use Enum as Foo` or the variants are brought into scope such as through `use Enum::*`. Co-authored-by: nathanwhit <[email protected]>
| * | | | | Update tests to reflect new completionsnathanwhit2020-04-221-1/+1
| | | | | |
| * | | | | Add tests for enum completionnathanwhit2020-04-221-0/+178
| | | | | | | | | | | | | | | | | | | | | | | | Adds tests for completion of enum variants in match arms, if-let statements, and basic expressions.
| * | | | | Complete unqualified enum variants when possiblenathanwhit2020-04-221-5/+26
| | | | | |
| * | | | | Add utility fn for expected type of a nodenathanwhit2020-04-221-1/+12
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | Adds `expected_type_of` to `CompletionContext` to return the expected type of a node, if it is known.
* / | | | Ignore proc-macro in completionEdwin Cheng2020-04-181-0/+6
|/ / / /
* | | | Don\t suggest import itself as a completion for importAleksey Kladov2020-04-171-1/+39
| | | |
* | | | Better snippet when completing trait methodAleksey Kladov2020-04-171-9/+10
| |_|/ |/| |
* | | Align grammar for record patterns and literalsAleksey Kladov2020-04-114-5/+22
| |/ |/| | | | | | | | | The grammar now looks like this [name_ref :] pat
* | Make records grammar more orthogonalAleksey Kladov2020-04-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | We used name [: expr] grammar before, now it is [name :] expr which makes things simpler
* | Rename some tokensAleksey Kladov2020-04-101-2/+2
| |
* | Simpler acessors for keywordsAleksey Kladov2020-04-091-2/+2
| |
* | Drop needless traitAleksey Kladov2020-04-091-14/+16
| |
* | Be consistent about token accesorsAleksey Kladov2020-04-091-1/+4
|/
* Move computation of missing fields into hirAleksey Kladov2020-04-071-50/+9
|
* Add functional update testAleksey Kladov2020-04-071-0/+33
|
* Fix names of test modulesAleksey Kladov2020-04-071-2/+2
|
* A more precise panic macroAleksey Kladov2020-04-071-1/+1
|
* Don't insert !() if there's already someAleksey Kladov2020-04-072-3/+44
|
* Reorder importsAleksey Kladov2020-04-071-3/+6
|
* Better naming for scope completionAleksey Kladov2020-04-072-2/+2
|
* Better naming for path completionAleksey Kladov2020-04-072-0/+0
|
* Fix unnecessary braces warningsLaurențiu Nicola2020-04-062-5/+5
|
* Add parens for enumsAleksey Kladov2020-04-034-46/+175
|
* Generalize call parenthesis insertionAleksey Kladov2020-04-031-27/+46
|
* Remove the second code-path for completing names in patternsAleksey Kladov2020-04-033-70/+28
|
* Unite record completion logic into a single moduleKirill Bulatov2020-04-013-386/+411
|
* Split draftKirill Bulatov2020-04-012-59/+25
|
* Complete only missing fields in patsKirill Bulatov2020-04-011-1/+62
|
* Better names for config structsAleksey Kladov2020-03-314-14/+14
|
* Start stdxAleksey Kladov2020-03-281-24/+21
| | | | This crate will hold everything to small to be worth publishing
* Align namingAleksey Kladov2020-03-241-1/+1
|
* Merge #3694bors[bot]2020-03-241-1/+61
|\ | | | | | | | | | | | | | | 3694: Complete only missing fields r=matklad a=SomeoneToIgnore Co-authored-by: Kirill Bulatov <[email protected]>
| * Code review fixesKirill Bulatov2020-03-241-3/+4
| | | | | | | | Co-Authored-By: Aleksey Kladov <[email protected]>
| * Complete only missing fieldsKirill Bulatov2020-03-231-1/+60
| |
* | Consider references when applying postfix completionsKirill Bulatov2020-03-231-17/+123
|/
* Remove constSteffen Lyngbaek2020-03-193-6/+48
| | | | | - Add test for @ matching - Address comments
* Fixes to more accurately give complete_scope completionsSteffen Lyngbaek2020-03-193-15/+38
| | | | | | | - Exclude const, static, functions form is_pat_binding_and_path (there might be more?) - Add a check to filter out Record Fields - Fix tests
* - Exclude Local Scope for BindPatsSteffen Lyngbaek2020-03-192-58/+16
| | | | | - Exclude BindPats with @ or ref - Remove outdated test and add one testing for ref
* Completition for type name? #3418Steffen Lyngbaek2020-03-192-3/+120
| | | | | | | | Iterate through TupleStructPat's until a MatchArm if one exists. Store in a new is_pat_bind_and_path bool and allow the `complete_scope` to find matches. Added some tests to ensure it works in simple and nested cases.
* Add test, remove printlnsFlorian Diebold2020-03-161-0/+53
|
* Get tests workingFlorian Diebold2020-03-162-2/+13
|
* wipFlorian Diebold2020-03-162-4/+13
|
* Attempt to implement ranking of rules when none matches perfectly (wip)Florian Diebold2020-03-161-1/+38
|
* Make MBE expansion more resilient (WIP)Florian Diebold2020-03-161-0/+37
|
* Fix completion of trait itemsFlorian Diebold2020-03-141-0/+32
| | | | Trait items should be public by default.
* Don't use generic DB where a concrete one will doAleksey Kladov2020-03-131-3/+6
|
* Fix completion of HashMap::newFlorian Diebold2020-03-132-2/+36
| | | | | | | | | | | | | | | The `ty` function in code_model returned the type with placeholders for type parameters. That's nice for printing, but not good for completion, because placeholders won't unify with anything else: So the type we got for `HashMap` was `HashMap<K, V, T>`, which doesn't unify with `HashMap<?, ?, RandomState>`, so the `new` method wasn't shown. Now we instead return `HashMap<{unknown}, {unknown}, {unknown}>`, which does unify with the impl type. Maybe we should just expose this properly as variables though, i.e. we'd return something like `exists<type, type, type> HashMap<?0, ?1, ?2>` (in Chalk notation). It'll make the API more complicated, but harder to misuse. (And it would handle cases like `type TypeAlias<T> = HashMap<T, T>` more correctly.)
* Restore cargo-fmt gatingAleksey Kladov2020-03-131-1/+0
|
* Merge #3553bors[bot]2020-03-131-0/+39
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 3553: Completions do not show for function with same name as mod r=matklad a=JoshMcguigan fixes #3444 I've added a test case in `crates/ra_ide/src/completion/complete_path.rs` which verifies the described behavior in #3444. Digging in, I found that [the module scope iterator](https://github.com/JoshMcguigan/rust-analyzer/blob/ba62d8bd1ce8a68b8d21aaf89ae1ea6787f18366/crates/ra_ide/src/completion/complete_path.rs#L22) only provides the module `z`, and does not provide the function `z` (although if I name the function something else then it does show up here). I thought perhaps the name wasn't being properly resolved, but I added a test in `crates/ra_hir_def/src/nameres/tests.rs` which seems to suggest that it is? I've tried to figure out how to bridge the gap between these two tests (one passing, one failing) to see where the function `z` is being dropped, but to this point I haven't been able to track it down. Any pointers on where I might look for this? Co-authored-by: Josh Mcguigan <[email protected]>