Commit Graph

266 Commits

Author SHA1 Message Date
bors[bot]
523b4cbc60
Merge #2650
2650: Add macro call support for SourceAnalyzer::type_of r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-29 15:02:27 +00:00
Florian Diebold
c39352fa43 Fill in type params in 'add missing impl members' assist 2019-12-24 17:29:27 +01:00
Edwin Cheng
16156d766d Add macro call support for type_of 2019-12-23 13:19:01 +08:00
kjeremy
0d5d63a80e Clippy lints 2019-12-20 15:14:30 -05:00
Aleksey Kladov
04715cbe1c Forbid <T>::foo syntax in mod paths 2019-12-18 17:41:33 +01:00
Aleksey Kladov
aca022f1d4 Refactor PathKind 2019-12-17 15:38:28 +01:00
Aleksey Kladov
2619950b3b Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
kjeremy
03fe6b38b8 Remove some unwraps in add_new 2019-12-13 18:28:01 -05:00
Aleksey Kladov
a1639d0d1e Remove more dead code 2019-12-08 17:45:14 +01:00
Florian Diebold
de08d30b80 Get rid of unwraps in add_new
Probably fixes #2464.
2019-12-07 11:54:26 +01:00
bors[bot]
3376c08052
Merge #2018
2018: assists: add assist for custom implementation for derived trait r=matklad a=paulolieuthier

Please, tell me if something could be more idiomatic or efficient.

Fixes #1256.

Co-authored-by: Paulo Lieuthier <paulolieuthier@gmail.com>
2019-12-02 15:52:11 +00:00
Paulo Lieuthier
5b2d52c8df docs: describe new feature 'add custom impl for derived trait' 2019-11-28 17:36:40 -03:00
Paulo Lieuthier
439080f027 assists: add assist for custom implementation for derived trait 2019-11-28 16:56:06 -03:00
Aleksey Kladov
ccd1b0800a Rename Source -> InFile 2019-11-28 12:50:26 +03:00
Aleksey Kladov
e5eadb3390 Introduce hir::Type
It should provide a convenient API over more low-level Ty
2019-11-26 14:02:57 +03:00
Aleksey Kladov
131c2da6bf ⬆️ salsa 2019-11-26 11:29:20 +03:00
Aleksey Kladov
5fd68b5929 Fix hir for ast::UnionDef 2019-11-25 17:50:49 +03:00
bors[bot]
7b6aa7c34e
Merge #2343
2343: implement assist invert_if r=matklad a=bravomikekilo

fix [issue 2219 invert if condition](https://github.com/rust-analyzer/rust-analyzer/issues/2219)
I put the assist cursor range to `if` of the if expression, because both condition and body will be replaced. Is there any way to replace them without cover the cursor position?
@matklad 

Co-authored-by: bravomikekilo <bmk1221@126.com>
2019-11-24 08:32:07 +00:00
bravomikekilo
adac4fc2f2 do refact and fix some issue 2019-11-24 13:14:57 +08:00
Aleksey Kladov
fc1e543f7a Get rid of DefDatabase2 2019-11-23 14:49:45 +03:00
Aleksey Kladov
958862093e Move docs to hir_def 2019-11-23 14:43:38 +03:00
Aleksey Kladov
d8caf56dfc Uniformalize naming 2019-11-22 21:52:06 +03:00
bravomikekilo
1ebfa908d5 fix tidy test 2019-11-22 03:18:22 +08:00
bravomikekilo
8a8be06219 initial invert_if 2019-11-22 02:51:40 +08:00
Felix Kohlgrüber
bcb2ea912b fix 2190; add test for "replace if let with match" 2019-11-20 19:01:06 +01:00
Aleksey Kladov
36e3fc9d54 Rename Source::ast -> Source::value 2019-11-20 09:42:30 +03:00
Aleksey Kladov
7e2f4b30db Disable doctests 2019-11-17 18:35:05 +03:00
Aleksey Kladov
5b54a93fe7 Add ast for plain and raw string literals 2019-11-16 22:50:41 +03:00
Aleksey Kladov
d898ecb8f2 Force passing Source when creating a SourceAnalyzer 2019-11-16 02:12:35 +03:00
Aleksey Kladov
f36ac059f3 Reduce some duplication 2019-11-16 01:14:56 +03:00
Aleksey Kladov
20186cdf89 Fix add-new assist 2019-11-15 22:57:19 +03:00
bors[bot]
3ad11973ac
Merge #2165
2165: ra_assists: Add add_new assist r=matklad a=rep-nop

Adds a new assist to autogenerate a new fn based on the selected struct, excluding tuple structs and unions. The fn will inherit the same visibility as the struct and the assist will attempt to reuse any existing impl blocks that exist at the same level of struct.

Not marking this as closing #1644 since there's a part 2 of adding autocompletion for when someone starts typing `[pub ]fn new(...`

Co-authored-by: Wesley Norris <repnop@outlook.com>
2019-11-15 07:01:19 +00:00
Aleksey Kladov
e177c65e36 Use strongly-typed ast building for early-return assist 2019-11-13 11:54:21 +03:00
Aleksey Kladov
2a69d584d6 Add a bit of types 2019-11-13 10:54:50 +03:00
Aleksey Kladov
018255efe3 Minor cleanup 2019-11-13 10:32:53 +03:00
Wesley Norris
cbc6f94573 Add add_new assist
Adds a new assist to autogenerate a new fn based on the selected struct,
excluding tuple structs and unions. The fn will inherit the same
visibility as the struct and the assist will attempt to reuse any
existing impl blocks that exist at the same level of struct.
2019-11-09 10:56:36 -05:00
Aleksey Kladov
50364bd478 Appease the linter by dummy doc comments 2019-11-04 22:33:21 +03:00
Aleksey Kladov
42370610ce Restore assists tests 2019-11-04 22:28:47 +03:00
Aleksey Kladov
74d827bb80 Rename MockDatabase -> TestDB
Actually working rename is sooo useful!
2019-11-04 22:21:15 +03:00
Aleksey Kladov
24894aca31 Remove more duplication in test fixtures 2019-11-04 22:12:49 +03:00
krk
bc14f500a0 Extract common parts of match arms in convert_to_guarded_return assist. 2019-11-01 18:34:42 +01:00
krk
91ab3f8760 Support paths other than "Some". 2019-11-01 18:18:58 +01:00
krk
1841a39f86 Remove variable pat. 2019-11-01 16:58:09 +01:00
krk
4a4d9f7a90 Handle IfLet in convert_to_guarded_return. 2019-10-31 21:10:58 +01:00
kjeremy
b441b4e8ef Some clippy fixes 2019-10-30 13:36:37 -04:00
Florian Diebold
47cfdb4aa3 Don't add a space after the opening brace in autoimport 2019-10-29 18:14:15 +01:00
Florian Diebold
6d1b4ffa2e Fix autoimport not choosing the deepest use tree in some situations 2019-10-28 19:08:56 +01:00
bors[bot]
46b63c462d
Merge #2099
2099: Fix panic on raw string assist r=matklad a=aee11

Strings that do not contain two quotation marks would cause a slice indexing panic because `find_usual_string_range` would return a range that only contained a single quotation mark.
Panic example:
```
fn main() {
    let s = "<|>
}
```

I noticed a lot of panics from the `make_raw_string` assist while working on another issue today.

Co-authored-by: Alexander Elís Ebenesersson <alex2789@gmail.com>
2019-10-27 19:20:01 +00:00
Alexander Elís Ebenesersson
17bd3e59f8 Fix panic on raw string assist
Strings that do not contain two quotation marks
would cause a slice indexing panic because code
was assuming `find_usual_string_range` would return
a string with two quotes, but it would incorrectly
also return text ranges containing only a single quote.
2019-10-28 03:00:28 +09:00
Aleksey Kladov
ad3fe316c6 further simplify assists 2019-10-27 18:22:14 +03:00