Commit Graph

185 Commits

Author SHA1 Message Date
bors[bot]
93199002af
Merge #1922
1922: feat(assists): Make raw string unescaped r=matklad a=Geobert

Last piece of https://github.com/rust-analyzer/rust-analyzer/issues/1730

Co-authored-by: Geobert Quach <geobert@protonmail.com>
2019-10-08 09:52:22 +00:00
Ekaterina Babshukova
311dbb8545 remove visitor module 2019-10-05 17:48:31 +03:00
Geobert Quach
31663c1368 feat(assists): Address some PR comments 2019-10-04 18:32:14 +01:00
Lúcás Meier
e17243d698 [#1807] Refactor file structure
Use the more conventional way of importing the ast types, and
put the assist at the top of the file.
2019-10-04 10:51:41 +02:00
Lúcás Meier
1ed1e3d4a7 Fix formatting 2019-10-04 08:21:24 +02:00
Lúcás Meier
e769a54502 Create an assist for applying De Morgan's law
Fixes #1807

This assist can transform expressions of the form `!x || !y` into
`!(x && y)`. This also works with `&&`.

This assist will only trigger if the cursor is on the central logical
operator.

The main limitation of this current implementation is that both operands
need to be an explicit negation, either of the form `!x`, or `x != y`.
More operands could be accepted, but this would complicate the implementation
quite a bit.
2019-10-03 22:48:35 +02:00
Lúcás Meier
ad65ba4062 WIP: Add demorgan application with naive negation 2019-10-03 22:19:46 +02:00
Geobert Quach
6195096fb4 feat(assists): Even smarter with hashes
Count `"#*` streak only, extract the counting in a function, unit test this function
2019-10-01 21:36:14 +01:00
Geobert Quach
b06c5fac14 feat(assists): Be smart about hashes
Add max_hashes_streak + 1 hashes to the raw string
2019-09-30 19:50:44 +01: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
5a4b4f507e
Fix API of Attr 2019-09-30 16:17:53 +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
Geobert Quach
e293c34e85 feat(assists): Keep only one version of make_raw_string 2019-09-29 19:16:59 +01: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
Geobert Quach
281e107155 feat(assists): Make raw string unescaped 2019-09-26 20:31:45 +01:00
Aleksey Kladov
d847d53e36 Start simplifying editing API 2019-09-26 22:22:08 +03:00
uHOOCCOOHu
2ecb126f5c
Support $crate in item and expr place. 2019-09-27 02:05:06 +08:00
Aleksey Kladov
1a4b424005 move diff to ra_syntax 2019-09-26 15:56:52 +03: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
bors[bot]
a452e50e0e
Merge #1911
1911: fewer monomorphisations r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-09-25 14:19:46 +00:00
Aleksey Kladov
b7422bd1ab fewer monomorphisations 2019-09-25 17:19:16 +03:00
Aleksey Kladov
efeae82f52 clean up naming 2019-09-25 15:58:40 +03:00
Aleksey Kladov
32843ae6f7 shorten AstBuilder names 2019-09-25 15:28:26 +03:00
Aleksey Kladov
546f031e4e minor builder cleanups 2019-09-25 15:26:05 +03:00
Aleksey Kladov
25fca04753 cleaned up record field builder 2019-09-25 15:09:03 +03:00
Aleksey Kladov
69689625ce move ast builder to a separate file 2019-09-25 14:35:26 +03:00
Aleksey Kladov
f32081fa18 move assists to subdir 2019-09-25 14:29:41 +03:00
Shotaro Yamada
9c45a9e586 Remove redundant clone() 2019-09-25 10:32:01 +09:00
Jeremy Kolb
13d7fc1620
Revert Self 2019-09-23 14:38:05 -04:00
kjeremy
1808175f98 Drive by lints 2019-09-23 14:31:30 -04:00
kjeremy
6da645d858 Suspicious line endings 2019-09-20 11:55:59 -04:00
Geobert Quach
ce4d843656 feat(assists): Apply comments 2019-09-19 22:12:28 +01:00
Geobert Quach
a3ab80b332 feat(assists): Rename escape_quote to escape_double_quote 2019-09-19 22:12:28 +01:00
Geobert Quach
889f1f0a7c feature(assists): Fix regression 2019-09-19 22:12:28 +01:00
Geobert Quach
016c997243 feat(assists): manage " when removing hash and make_usual_string 2019-09-19 22:12:28 +01:00
Geobert Quach
b6d55290a1 feat(assists): raw string <-> usual string manipulation
Fixes #1730
2019-09-19 22:12:28 +01:00
uHOOCCOOHu
de9670fe45
Move store TypeRef of type based path in PathKind 2019-09-15 19:48:24 +08:00
uHOOCCOOHu
4926bed426
Support path starting with a type 2019-09-15 19:40:32 +08:00
Aleksey Kladov
114a1b878e rename AdtDef -> Adt 2019-09-13 00:34:52 +03:00
Nelson Chen
14585468e2
Minor typo fix for ra_assists code doc 2019-09-08 02:10:53 -07:00
Ekaterina Babshukova
acb89d2be1 add assist to move type bounds to where clause 2019-09-05 13:29:13 +03: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