about summary refs log tree commit diff
path: root/crates/syntax/src/ast
AgeCommit message (Collapse)AuthorLines
2022-05-26fix: f32 and f64 representation during loweringfeniljain-5/+37
2022-05-24internal: Refactor our record pat/expr handling in completion contextLukas Wirth-0/+4
2022-05-23fix: When reference searching macro inputs, don't search everything that was ↵Lukas Wirth-0/+7
downmapped
2022-05-14feat: Add binding mode inlay hintsLukas Wirth-1/+1
2022-05-13Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, ↵Jonas Schievink-100/+32
r=jonas-schievink" This reverts commit cc9ae2b89e01a30e441371b9fd3376c3d03a475f, reversing changes made to 7dfd1cb572d8d4fd951237361e43ecddd9c9a852.
2022-05-05Indicate the number of float tokens in the first tokenJonas Schievink-1/+10
2022-05-05Split float literal tokens at the `.`Jonas Schievink-9/+12
2022-05-05Wrap float literals in their own nodeJonas Schievink-21/+76
2022-05-05Remove `ast::Literal::token`Jonas Schievink-6/+7
2022-05-05Lower values of char and byte literalsLaurențiu Nicola-5/+83
2022-05-04improve the default constructor mode when filling fieldsBenjamin Coenen-0/+3
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-04-23SimplifyLukas Wirth-0/+6
2022-04-17update grammer to support associated const equalityXFFXFF-0/+1
2022-04-10Parse for<'a> closure syntaxLukas Wirth-0/+2
2022-04-05Wrap macros in expr position in `MacroExpr` nodeJonas Schievink-6/+30
2022-04-03Merge #11887bors[bot]-0/+47
11887: fix: Add missing fields diagnostic fix for patterns r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-03fix: Add missing fields diagnostic fix for patternsLukas Wirth-0/+47
2022-04-02fix: `merge_imports::recursive_merge` exiting earlyiDawer-1/+1
2022-04-01fix: splitting path of a glob import wrongly adds `self`iDawer-3/+20
`ast::UseTree::split_prefix` handles globs now. Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).
2022-03-20Merge #11690bors[bot]-0/+9
11690: feat: Add an assist for inlining type aliases r=Veykril a=steven-joruk I'm working towards implementing #10881, but I'd like to get this in first with earlier feedback. Is `inline_type_alias` a good enough name? I guess the follow up assist would be called `inline_type_alias_into_all_users` based on that. ![valid_inlines](https://user-images.githubusercontent.com/1277939/158020510-fed78b5c-4c7e-46d1-9151-3044a29b9990.gif) ![invalid_inlines](https://user-images.githubusercontent.com/1277939/158020516-8a2deb6d-c6ec-4adf-a15b-c514fc97dc43.gif) Co-authored-by: Steven Joruk <steven@joruk.com>
2022-03-12fix: "Extract to function" assist preserves `break` and `continue` labelsMorgan Thomas-6/+16
Adds a label / lifetime parameter to `ide_assists::handlers::extract_function::FlowKind::{Break, Continue}`, adds support for emitting labels to `syntax::ast::make::{expr_break, expr_continue}`, and implements the required machinery to let `extract_function` make use of them. This does modify the external API of the `syntax` crate, but the changes there are simple, not used outside `ide_assists`, and, well, we should probably support emitting `break` and `continue` labels through `syntax` anyways, they're part of the language spec. Closes #11413.
2022-03-12more clippy fixes:Matthias Krüger-3/+1
clippy::search_is_some clippy::redundant_static_lifetimes clippy::match_single_binding clippy::match_ref_pats clippy::map_entry clippy::manual_map clippy::iter_overeager_cloned clippy::into_iter_on_ref clippy::extra_unused_lifetimes
2022-03-12fix clippy::redundant_closureMatthias Krüger-1/+1
2022-03-12fix clippy::single_char_patternMatthias Krüger-1/+1
2022-03-12feat: Add an assist for inlining type aliasesSteven Joruk-0/+9
This intends to lead to a more useful assist to replace all users of an alias with its definition.
2022-03-06Highlight `Self` as a keyword by defaultLukas Wirth-5/+9
2022-03-05fix: Recognize `Self` as a proper keywordLukas Wirth-4/+13
2022-03-05Merge #11598bors[bot]-1/+34
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2 Part of #11532. Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into ```rust { let (<gensym_a>, <gensym_b>) = (b, a); a = <gensym_a>; b = <gensym_b>; } ``` rustc uses hygiene to implement that, but we don't support hygiene yet. However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error. I'm still looking for the best way to do lowering, though. Fixes #11454. Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-03-04Preserve order of generic argshkalbasi-9/+19
2022-03-02Parse destructuring assignmentChayim Refael Friedman-1/+33
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
2022-02-27Fix `if` in #11561Chayim Refael Friedman-5/+61
2022-02-26Fix body selection in while loopsLaurențiu Nicola-1/+9
2022-02-25Generate AST code after rust-analyzer/ungrammar#46Chayim Refael Friedman-0/+1
2022-02-22Make replace_derive_with_manual_impl work againLukas Wirth-0/+9
2022-02-21Change `single_let()` and `is_pattern_cond()` to free functionsChayim Refael Friedman-36/+0
2022-02-21Parse `let` expressions in order to support `let` chainsChayim Refael Friedman-45/+74
We still need to reject freestanding `let` expressions: see https://github.com/rust-analyzer/rust-analyzer/issues/11320#issuecomment-1018212465.
2022-02-03Move attribute path completions into attribute completion moduleLukas Wirth-1/+1
2022-02-01Merge #11322bors[bot]-0/+25
11322: Extract function also extracts comments r=Vannevelj a=Vannevelj Fixes #9011 The difficulty I came across is that the original assist works from the concept of a `ast::StmtList`, a node, but that does not allow me to (easily) represent comments, which are tokens. To combat this, I do a whole bunch of roundtrips: from the `ast::StmtList` I retrieve the `NodeOrToken`s it encompasses. I then cast all `Node` ones back to a `Stmt` so I can apply indentation to it, after which it is again parsed as a `NodeOrToken`. Lastly, I add a new `make::` api that accepts `NodeOrToken` rather than `StmtList` so we can write the comment tokens. Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-01-30Reduce allocations in attribute collectionLukas Wirth-15/+16
2022-01-22removed printsJeroen Vannevel-1/+1
2022-01-22hacky_block_expr_with_commentsJeroen Vannevel-8/+9
2022-01-22removing unwrapsJeroen Vannevel-4/+5
2022-01-22very rough but comments get extractedJeroen Vannevel-0/+23
2022-01-15Move format specifier lexing from syntax to ide_dbLukas Wirth-293/+19
2022-01-13Slightly cleanup HasFormatSpecifier::lex_format_specifierLukas Wirth-213/+146
2022-01-08Shrink diagnostic spans for errors inside macrosJonas Schievink-1/+0
2022-01-08Allow doc comments on all `Item`sJonas Schievink-4/+9
2022-01-08Merge #11107bors[bot]-2/+10
11107: Fix generic type substitution in impl trait with assoc type r=pnevyk a=pnevyk Fixes #11045 The path transform now detects if a type parameter that is being substituted has an associated type. In that case it is necessary (or safe in general case) to fully qualify the substitution with a trait which the associated type belongs to. This PR also fixes the previous wrong behavior of the substitution that could create an invalid tree `PATH_TYPE -> PATH_TYPE -> ...`. Co-authored-by: Petr Nevyhoštěný <petr.nevyhosteny@gmail.com>
2022-01-07Merge #11230bors[bot]-0/+1
11230: fix: Fix attribute stripping ignoring doc comments r=Veykril a=Veykril Follow up to https://github.com/rust-analyzer/rust-analyzer/pull/11225#pullrequestreview-846779237 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-07fix: Fix attribute stripping ignoring doc commentsLukas Wirth-0/+1