Commit Graph

199 Commits

Author SHA1 Message Date
Aleksey Kladov 4cea6bb6f1 Make make:: builders slightly more convenient 2019-11-13 11:59:18 +03:00
Aleksey Kladov e177c65e36 Use strongly-typed ast building for early-return assist 2019-11-13 11:54:21 +03:00
bors[bot] fe6ba12a77 Merge #2149
2149: Handle IfLet in convert_to_guarded_return. r=matklad a=krk

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2124

I could not move the cursor position out of `let`:
`le<|>t` vs `let<|>`.

Also, please suggest extra test cases.

Co-authored-by: krk <keremkat@gmail.com>
2019-11-04 09:06:53 +00:00
krk 91ab3f8760 Support paths other than "Some". 2019-11-01 18:18:58 +01:00
krk 4a4d9f7a90 Handle IfLet in convert_to_guarded_return. 2019-10-31 21:10:58 +01:00
kjeremy 78f93c8033 traits => match_ast! 2019-10-30 16:08:59 -04:00
kjeremy b441b4e8ef Some clippy fixes 2019-10-30 13:36:37 -04:00
Jeremy Kolb 1438f38eb6 Preserve whitespace at the end of doc comments
Whitespace can have special meaning in markdown. For instance
ending a line with three spaces will render a new line.
Note that this behavior diverges from RLS.

Fixes #1997
2019-10-27 16:56:25 -04:00
Aleksey Kladov 4ef9b8d17a use correct spacing for enum pattern 2019-10-26 18:03:55 +03:00
Mikhail Modin fb215dc192 Adds "replace with guarded return" assist 2019-10-20 19:14:32 +01:00
Aleksey Kladov c00f298fd2 add syntax-tree based indents 2019-10-12 22:07:47 +03:00
uHOOCCOOHu ffe179a736 Pass attributes as token tree to DefCollector 2019-10-03 02:27:11 +08:00
Alexander Andreev 81efd696cc Merge branch 'master' into feature/issue/1856
# Conflicts:
#	crates/ra_assists/src/ast_editor.rs
2019-09-30 12:07:26 +03:00
Alexander Andreev fdbd6bb11a Added test for check doc strings in crates.
#1856
2019-09-30 11:58:53 +03:00
uHOOCCOOHu f7e12559cb Fixes 2019-09-30 16:17:54 +08:00
uHOOCCOOHu 5a4b4f507e Fix API of Attr 2019-09-30 16:17:53 +08:00
uHOOCCOOHu 71efdaa636 Parse correct AttrInput 2019-09-30 16:11:40 +08:00
Aleksey Kladov 4acadbdca6 cleanup editor 2019-09-30 10:08:28 +03:00
Aleksey Kladov 05ca252fb5 remove ast_editor.rs 2019-09-30 10:05:12 +03:00
Aleksey Kladov 054c53aeb9 move remove bounds to ast/edit.rs 2019-09-30 09:56:20 +03:00
Aleksey Kladov e010b144d5 move field list to ast/edit.rs 2019-09-30 09:27:26 +03:00
Aleksey Kladov 0840ec038b migrate add impl items to the new editing API 2019-09-28 20:10:53 +03:00
Aleksey Kladov 5dbbfda34a simplify strip attrs 2019-09-28 19:50:16 +03:00
bors[bot] 2b69c84396 Merge #1815
1815: Support correct `$crate` expansion in macros r=uHOOCCOOHu a=uHOOCCOOHu

This PR makes normal use cases of `$crate` from macros work as expected.

It makes more macros from `std` work. Type inference works well with `panic`, `unimplemented`, `format`, and maybe more.
Sadly that `vec![1, 2, 3]` still not works, but it is not longer an issue about macro.

Screenshot:
![Screenshot_20190927_022136](https://user-images.githubusercontent.com/14816024/65714465-b4568f80-e0cd-11e9-8043-dd44c2ae8040.png)




Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com>
2019-09-27 02:58:26 +00:00
Aleksey Kladov d847d53e36 Start simplifying editing API 2019-09-26 22:22:08 +03:00
uHOOCCOOHu 128dc5355b Refactor Name ready for hygienic macro 2019-09-27 02:04:47 +08:00
Aleksey Kladov 183a38fb50 keep ast creation API simple 2019-09-26 15:29:28 +03:00
Aleksey Kladov a525e830a6 add new editing API, suitable for modifying several nodes at once 2019-09-25 17:57:12 +03:00
uHOOCCOOHu 4926bed426 Support path starting with a type 2019-09-15 19:40:32 +08:00
Dylan MacKenzie 426112c97e Add DotDotPat to AST
This is modeled on `PlaceholderPat`.
2019-09-14 17:08:22 -07:00
uHOOCCOOHu 8c078a0164 Infer box expression 2019-09-12 02:35:09 +08:00
Florian Diebold d21cdf3c99 Lower Fn(X, Y) -> Z paths 2019-09-07 15:13:05 +02:00
bors[bot] 6702f5b7b5 Merge #1743
1743: Support `#[macro_use]` on `extern crate` r=matklad a=uHOOCCOOHu

Unfortunately, #1688 is still an issue. My guess is wrong :(

Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com>
2019-09-05 09:04:02 +00:00
Aleksey Kladov e94587e315 fix assists 2019-09-02 21:52:06 +03:00
Aleksey Kladov 5e3f291195 fix hir for new block syntax 2019-09-02 21:23:19 +03:00
Aleksey Kladov dcf8e89503 fix generated AST 2019-09-02 20:15:51 +03:00
Aleksey Kladov f377b94628 remove useless trait 2019-09-02 19:45:41 +03:00
uHOOCCOOHu f5bea9051b Support resolution of #[macro_use] extern crate 2019-09-01 01:54:41 +08:00
Dylan MacKenzie e6f3790106 Add BoxPat variant 2019-08-23 15:11:34 -07:00
Aleksey Kladov 5b18a4eef9 rename struct -> record, pos -> tuple 2019-08-23 16:59:50 +03:00
Florian Diebold 4768f5e717 Improve/fix type bound lowering 2019-08-22 21:58:29 +02:00
Florian Diebold 16a7d8cc85 Add impl Trait and dyn Trait types
- refactor bounds handling in the AST a bit
 - add HIR for bounds
 - add `Ty::Dyn` and `Ty::Opaque` variants and lower `dyn Trait` / `impl Trait`
   syntax to them
2019-08-22 19:33:00 +02:00
Aleksey Kladov 9f238930f1 Don't add ? bounds as real bounds
closes #1709
2019-08-22 15:35:42 +03:00
Aleksey Kladov 39e444d701 remove ast::*Kind enums
With the new owned trees, we don't need an indirection here
2019-08-19 13:58:49 +03:00
Aleksey Kladov 39f50e7bd7 use new quote-generated ast 2019-08-18 23:36:22 +03:00
Aleksey Kladov 7e5a186c1f Introduce separate hir::BinaryOp
Unlike ast::BinOp, it has significantly more structure to it, so it's
easier to, say, handle all assignment-like operations in the same way.
2019-08-17 17:42:41 +03:00
Aleksey Kladov 8919aa8065 implement accessors for IndexExpr 2019-08-17 17:17:01 +03:00
Aleksey Kladov fd4c083e42 simplify 2019-08-17 17:14:22 +03:00
Florian Diebold 22724f37f3 Lower fully qualified associated type paths
I.e. `<T as Trait>::Foo`.
2019-08-12 21:43:00 +02:00
Evgenii P 3fb58c620c Add function parameters attributes 2019-08-07 23:42:28 +07:00