Commit graph

631 commits

Author SHA1 Message Date
krk
4a4d9f7a90 Handle IfLet in convert_to_guarded_return. 2019-10-31 21:10:58 +01:00
kjeremy
7ad55e976c Document match_ast! 2019-10-30 14:38:45 -04:00
kjeremy
b441b4e8ef Some clippy fixes 2019-10-30 13:36:37 -04:00
Aleksey Kladov
5a6db3ca29 fix parsing of for loops inside expressions
closes #2051
2019-10-28 15:41:34 +03: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
5376c769f0 rename tools -> xtask 2019-10-17 23:14:05 +03:00
Laurențiu Nicola
a6b980d6d4 Bump deps 2019-10-17 18:08:11 +03:00
bors[bot]
bc7de5d47a
Merge #2002
2002:  Remove unused dependencies r=matklad a=sinkuu



Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-10-14 11:10:20 +00:00
Shotaro Yamada
e4ffa79b3e Enable serde feature in ra_syntax/Cargo.toml 2019-10-14 19:56:29 +09:00
Aleksey Kladov
c00f298fd2 add syntax-tree based indents 2019-10-12 22:07:47 +03:00
Shotaro Yamada
8c72c00abd Remove smol_str dependency from ra_syntax 2019-10-12 07:48:23 +09:00
bors[bot]
d9338dfa98
Merge #1951
1951: Lower the precedence of the `as` operator. r=matklad a=goffrie

Previously, the `as` operator was being parsed like a postfix expression, and
therefore being given the highest possible precedence. That caused it to bind
more tightly than prefix operators, which it should not. Instead, parse it
somewhat like a normal binary expression with some special-casing.

Fixes #1851.

Co-authored-by: Geoffry Song <goffrie@gmail.com>
2019-10-08 08:44:26 +00:00
Geoffry Song
b4fe06bc17 Move tests around 2019-10-05 16:33:05 -07:00
bors[bot]
d3872964f8
Merge #1960
1960: Replace AST visitors with macro r=viorina a=viorina

Fixes #1672.

Co-authored-by: Ekaterina Babshukova <ekaterina.babshukova@yandex.ru>
2019-10-05 14:54:25 +00:00
Ekaterina Babshukova
311dbb8545 remove visitor module 2019-10-05 17:48:31 +03:00
bors[bot]
ae6305b90c
Merge #1928
1928: Support `#[cfg(..)]` r=matklad a=oxalica

This PR implement `#[cfg(..)]` conditional compilation. It read default cfg options from `rustc --print cfg` with also hard-coded `test` and `debug_assertion` enabled.
Front-end settings are **not** included in this PR.

There is also a known issue that inner control attributes are totally ignored. I think it is **not** a part of `cfg` and create a separated issue for it. #1949

Fixes #1920 

Related: #1073 


Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com>
Co-authored-by: oxalica <oxalicc@pm.me>
2019-10-05 14:25:59 +00:00
Ekaterina Babshukova
2fc2290173 replace AST visitors with macro 2019-10-05 17:03:03 +03:00
Geoffry Song
9638adaa40 Fix parsing of block expressions in "forbid_structs" contexts.
Forbidding block expressions entirely is too strict; instead, we should only
forbid them in contexts where we are parsing an optional RHS (i.e. the RHS of a
range expression).
2019-10-03 00:39:52 -07:00
Geoffry Song
b63f260bbc Lower the precedence of the as operator.
Previously, the `as` operator was being parsed like a postfix expression, and
therefore being given the highest possible precedence. That caused it to bind
more tightly than prefix operators, which it should not. Instead, parse it
somewhat like a normal binary expression with some special-casing.
2019-10-03 00:27:09 -07: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
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
Aleksey Kladov
b7422bd1ab fewer monomorphisations 2019-09-25 17:19:16 +03:00
Aleksey Kladov
66101e931c simplify 2019-09-24 09:28:16 +03:00
kjeremy
fef7fcf5a9 Support loop as argument 2019-09-20 16:35:29 -04:00
bors[bot]
3575f7c4a2
Merge #1884
1884: Add indexing to record_field_pat r=matklad a=kjeremy

Fixes #1870 

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-09-20 15:54:01 +00:00
kjeremy
5a65d4d9fb Add indexing to record_field_pat 2019-09-20 11:43:34 -04:00
Aleksey Kladov
d57b993ade fix infinite loop in the parser
closes #1866
2019-09-20 16:57:31 +03:00
Aleksey Kladov
0f70290b6e don't confuse macro with !=
closes #1871
2019-09-20 16:23:24 +03:00
uHOOCCOOHu
4926bed426
Support path starting with a type 2019-09-15 19:40:32 +08:00
bors[bot]
2d79a1ad83
Merge #1848
1848: Parse `..` as a full pattern r=matklad a=ecstatic-morse

Resolves #1479.

This PR implements [RFC 2707](https://github.com/rust-lang/rfcs/pull/2707) in the parser. It introduces a new `DotDotPat` AST node modeled on `PlaceholderPat` and changes the parsing of tuple and slice patterns to conform to the RFC.

Notably, this PR does *not* change the resulting AST when `..` appears in a struct pattern (e.g. `Struct { a, b: c, .. }`). I *think* this is the behavior mandated by RFC 2707, but someone should confirm this.

Co-authored-by: Dylan MacKenzie <ecstaticmorse@gmail.com>
2019-09-15 07:10:16 +00:00
Dylan MacKenzie
0956323bb7 Generate dot_dot_test 2019-09-14 17:08:22 -07:00
Dylan MacKenzie
da3815122d Bless old tests containing a .. pattern 2019-09-14 17:08:22 -07:00