aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge #6587bors[bot]2021-01-0430-0/+227
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6587: SSR: Support statement matching and replacing r=davidlattimore a=MarijnS95 For #3186 Hi! This is a smaller initial patchset that came up while working on support for statement lists (and my first time working on RA :grin:). It has me stuck on trailing semicolons for which I hope to receive some feedback. Matching (and replacing) `let` bindings with a trailing semicolon works fine, but trying to omit these (to make patterns more ergonomic) turns out more complex than expected. The "optional trailing semicolon solution" implemented in this PR is ugly because `Matcher::attempt_match_token` should only consume a trailing `;` when parsing `let` bindings to prevent other code from breaking. That at the same time has a nasty side-effect of `;` ending up in the matched code: any replacements on that should include the trailing semicolon as well even if it was not in the pattern. A better example is in the tests: https://github.com/rust-analyzer/rust-analyzer/blob/3ae1649c24a689473b874c331f5f176e5839978e/crates/ssr/src/tests.rs#L178-L184 The end result to achieve is (I guess) allowing replacement of let bindings without trailing semicolon like `let x = $a ==>> let x = 1` (but including them on both sides is still fine), and should make replacement in a macro call (where `foo!(let a = 2;)` for a `$x:stmt` is invalid syntax) possible as well. That should allow to enable/fix these tests: https://github.com/rust-analyzer/rust-analyzer/blob/3ae1649c24a689473b874c331f5f176e5839978e/crates/ssr/src/tests.rs#L201-L214 A possible MVP of this PR might be to drop this optional `;' handling entirely and only allow an SSR pattern/template with semicolons on either side. Co-authored-by: Marijn Suijten <[email protected]>
| * parser,syntax: Add separate parser for stmt with optional semicolonMarijn Suijten2021-01-0313-5/+66
| | | | | | | | | | Adjusting `grammar::fragments::stmt` to Optional or Yes will break original functionality and tests.
| * syntax,ssr: Implement statement parsingMarijn Suijten2021-01-0330-0/+166
| |
* | Upgrade expect-test to 1.1Jesse Bakker2021-01-031-1/+1
|/
* Fix warnings on rust-nightlycynecx2021-01-021-2/+2
|
* Update crateskjeremy2020-12-301-1/+1
|
* indentationAdnoC2020-12-301-3/+3
|
* Smarter bracketed use diagnosticAdnoC2020-12-301-0/+8
|
* Merge #7027bors[bot]2020-12-242-0/+59
|\ | | | | | | | | | | | | | | 7027: Fix macro_rules not accepting brackets or parentheses r=matklad,lnicola a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
| * Fix macro_rules not accepting brackets or parenthesesLukas Wirth2020-12-242-0/+59
| |
* | Merge #7020bors[bot]2020-12-231-0/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | 7020: Implement const pat and expr inference r=flodiebold a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
| * | Implement const block inferenceLukas Wirth2020-12-231-0/+4
| |/
* | Merge #7016bors[bot]2020-12-231-1/+1
|\ \ | |/ |/| | | | | | | | | | | 7016: Bump deps r=flodiebold a=lnicola Co-authored-by: Laurențiu Nicola <[email protected]>
| * Bump rustc_lexerLaurențiu Nicola2020-12-231-1/+1
| |
* | Merge #7010bors[bot]2020-12-235-1/+136
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7010: Update ungrammar for const block patterns r=matklad a=Veykril Fixes #6848 Adds const blocks and const block patterns to the AST and parses them. Blocked on https://github.com/rust-analyzer/ungrammar/pull/17/, will merge that PR there once this one gets the OK so I can remove the local ungrammar dependency path and fix the Cargo.lock. Co-authored-by: Lukas Wirth <[email protected]>
| * | Parse const effect blockLukas Wirth2020-12-232-0/+24
| | |
| * | Parse ConstBlockPatLukas Wirth2020-12-232-0/+80
| | |
| * | Update ungrammar for const block patternsLukas Wirth2020-12-231-1/+32
| |/
* / Document `make` module designAleksey Kladov2020-12-231-1/+7
|/
* Merge #6965bors[bot]2020-12-215-135/+186
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6965: Properly attach attributes to Param instead of parent ParamList r=matklad a=Veykril Fixes #2783, fixes #2781 The problem with `let _a = [0,#[cfg(feature = "L")]0];` has already been fixed some time ago it seems: <details> <summary>Syntax Tree for the const item</summary> ``` [email protected] [email protected] "let" [email protected] " " [email protected] [email protected] [email protected] "_a" [email protected] " " [email protected] "=" [email protected] " " [email protected] [email protected] "[" [email protected] [email protected] "0" [email protected] "," [email protected] [email protected] [email protected] "#" [email protected] "[" [email protected] [email protected] [email protected] [email protected] "cfg" [email protected] [email protected] "(" [email protected] "feature" [email protected] " " [email protected] "=" [email protected] " " [email protected] "\"L\"" [email protected] ")" [email protected] "]" [email protected] "0" [email protected] "]" [email protected] ";" ``` </details> Co-authored-by: Lukas Wirth <[email protected]>
| * Parse attributes in tuple expressionsLukas Wirth2020-12-202-0/+51
| |
| * Properly attach attributes to Param instead of parent ParamListLukas Wirth2020-12-203-135/+135
| |
* | Properly parse legacy trait objects with leading ForTypeLukas Wirth2020-12-202-0/+44
|/
* Merge #6934bors[bot]2020-12-181-0/+7
|\ | | | | | | | | | | | | | | 6934: Implement `cfg_attr` handling r=jonas-schievink a=jonas-schievink Part of https://github.com/rust-analyzer/rust-analyzer/issues/5548 Co-authored-by: Jonas Schievink <[email protected]>
| * Implement `RawAttr::filter`Jonas Schievink2020-12-181-0/+7
| |
* | Minor, cleanup APIAleksey Kladov2020-12-181-0/+3
|/
* Merge #6896bors[bot]2020-12-1637-174/+316
|\ | | | | | | | | | | | | | | | | | | | | | | 6896: Node-ify lifetimes r=jonas-schievink a=Veykril Let's see if this passes the tests 🤞 Depends on https://github.com/rust-analyzer/ungrammar/pull/15 Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Lukas Wirth <[email protected]>
| * Node-ify lifetimesLukas Wirth2020-12-1637-174/+316
| |
* | Merge #6897bors[bot]2020-12-164-6/+106
|\| | | | | | | | | | | | | | | | | | | | | | | | | 6897: Basic support for macros 2.0 r=jonas-schievink a=jonas-schievink This adds support for (built-in-only) macros 2.0, and removes some hacks used for builtin derives, which are declared via macros 2.0 in libcore. First steps for https://github.com/rust-analyzer/rust-analyzer/issues/2248. Blocked on https://github.com/rust-analyzer/ungrammar/pull/16. Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Jonas Schievink <[email protected]>
| * Basic support for decl macros 2.0Jonas Schievink2020-12-154-6/+106
| |
* | Merge #6894bors[bot]2020-12-161-0/+3
|\ \ | |/ |/| | | | | | | | | | | 6894: Parenthesize composite if condition before inverting in invert-if assist r=matklad a=Jesse-Bakker Fixes #6867 Co-authored-by: Jesse Bakker <[email protected]>
| * Parenthesize composite if condition before inverting in invert-if assistJesse Bakker2020-12-151-0/+3
| |
* | Reject visibilities on `macro_rules!`Jonas Schievink2020-12-151-1/+13
| |
* | Move to upstream `macro_rules!` modelJonas Schievink2020-12-159-69/+80
|/
* Remove some redundant allocationsJeremy Kolb2020-12-122-2/+2
|
* Fix accidently quadratic syntax rewriterAleksey Kladov2020-12-101-8/+14
| | | | | | Switching from SyntaxNode to GreenNode is a costly operation (b/c dereferencing a synax ptr in `with_green` is linear), so we should avoid that.
* Properly fetch inner and outer docs on hir-levelLukas Wirth2020-12-091-0/+8
|
* Simplify ast::Comment api surfaceLukas Wirth2020-12-081-10/+15
|
* Keep doc attribute orderLukas Wirth2020-12-072-41/+35
|
* Merge #6719bors[bot]2020-12-074-16/+17
|\ | | | | | | | | | | | | | | 6719: Use items can also have doc comments r=matklad a=Veykril Prior to this change modules show more docs than they have cause they inherit the docs from documented use items inside of them. Co-authored-by: Lukas Wirth <[email protected]>
| * Use items can also have doc commentsLukas Wirth2020-12-044-16/+17
| |
* | Add replace_match_with_if_let assistLukas Wirth2020-12-051-2/+11
|/
* Merge #6649bors[bot]2020-12-021-22/+55
|\ | | | | | | | | | | | | | | 6649: Accept more than just the standard rust literal suffixes in *Number::suffix r=matklad a=Veykril I am not entirely sure whether to keep or remove the `SUFFIXES` but I figured we can always bring them back once they are needed. Co-authored-by: Lukas Wirth <[email protected]>
| * Add ast::*Number::suffix tests unit testsLukas Wirth2020-11-281-0/+37
| |
| * Accept more than just the standard rust literal suffixes in *Number::suffixLukas Wirth2020-11-261-22/+18
| |
* | bump lexerkjeremy2020-11-301-1/+1
| |
* | Profile completions betterKirill Bulatov2020-11-272-0/+14
| |
* | Avoid allocation in ast::String::value if the string needs no unescapingLukas Wirth2020-11-271-9/+18
|/
* Parse unsafe extern blockDavid Tolnay2020-11-232-2/+16
|
* Merge #6558bors[bot]2020-11-161-0/+22
|\ | | | | | | | | | | | | | | | | 6558: format string highlighting: handle hex + debug type specifier r=matklad a=ruabmbua Should fix https://github.com/rust-analyzer/rust-analyzer/issues/6427 Co-authored-by: Roland Ruckerbauer <[email protected]>