about summary refs log tree commit diff
path: root/crates/syntax
AgeCommit message (Collapse)AuthorLines
2021-07-30SimplifyLukas Wirth-2/+2
2021-07-29Attach comma token to MATCH_ARM instead of MATCH_ARM_LISTLukas Wirth-74/+74
2021-07-29Simplify extract_function assistLukas Wirth-101/+118
2021-07-29Use more strictly typed syntax nodes for analysis in extract_function assistLukas Wirth-0/+75
2021-07-27fix: TyposAlexander Gonzalez-1/+1
2021-07-26Fix generic_arg not parsing opt_generic_arg_list properly in arg listsLukas Wirth-63/+78
2021-07-21Fix some more basic clippy lintsLukas Wirth-1/+1
2021-07-20Restrict completions inside visibility modifiersLukas Wirth-0/+8
2021-07-18Merge #9619bors[bot]-69/+110
9619: Support GATs for associated type arg parsing r=Veykril a=Veykril Fixes #9602 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-18Support GATs for associated type arg parsingLukas Wirth-69/+110
2021-07-17feat: improve parser error recovery for function parametersAleksey Kladov-15/+68
2021-07-10Merge #9557bors[bot]-4/+13
9557: fix: Respect coercions in `inline_call` r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-10Respect coercions in `inline_call`Lukas Wirth-4/+13
2021-07-10Bump rustc_lexer a littleLaurențiu Nicola-1/+1
2021-07-09fix: Adding async keyword when await is present in generate_function assistvi_mi-2/+5
2021-07-05Update `inline_call` assist doc exampleLukas Wirth-6/+8
2021-07-05Merge #9474bors[bot]-0/+21
9474: fix: Inline parameters in `inline_call` if possible r=Veykril a=Veykril Fixes #9491 Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-05Fixup emitted whitespace in most casesLukas Wirth-0/+6
2021-07-05minor: drop dummy authors fieldAleksey Kladov-2/+0
2021-07-04minor: untangle complex conditionAleksey Kladov-10/+9
2021-07-04minor: better error messageAleksey Kladov-1/+1
2021-07-03Merge #9476bors[bot]-18/+1149
9476: internal: overhaul codegen r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-03internal: overhaul code generationAleksey Kladov-18/+1149
* Keep codegen adjacent to the relevant crates. * Remove codgen deps from xtask, speeding-up from-source installation. This regresses the release process a bit, as it now needs to run the tests (and, by extension, compile the code).
2021-07-03Inline parameters in `inline_call` if possibleLukas Wirth-0/+15
2021-07-03Merge the inline function/method assists into `inline_call`Lukas Wirth-2/+1
2021-07-03feat: Implement `inline_method` assistLukas Wirth-11/+17
2021-07-02`replace_match_with_if_let` works on more binary matchesLukas Wirth-0/+4
2021-07-01Merge #9458bors[bot]-3/+10
9458: minor: Remove make::match_arm_with_guard r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-02Remove make::match_arm_with_guardLukas Wirth-3/+10
2021-07-01Merge #9455bors[bot]-0/+13
9455: feat: Handle not let if expressions in replace_if_let_with_match r=Veykril a=Veykril Transforms bare `if cond {}` into `_ if cond` guard patterns in the match as long as at least one `if let` is in the if chain, otherwise the assist wont be applicable. bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-02Handle not let if expressions in replace_if_let_with_matchLukas Wirth-0/+13
2021-06-30Merge #9437bors[bot]-0/+8
9437: fix: Don't classify paths inside attribute TokenTrees r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-30Don't classify NameRef paths inside attribute TokenTreesLukas Wirth-0/+8
2021-06-30Cargo update and pull in the new rowankjeremy-1/+1
This brings in the new hashbrown for better compile times.
2021-06-28Fix `NameRef::classify` path resolution inside attributesLukas Wirth-5/+21
2021-06-27Deduplicate ast expression walking logicLukas Wirth-1/+51
2021-06-22Merge #9367bors[bot]-0/+9
9367: Document perf characteristic of to_node r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22Document perf characteristic of to_nodeAleksey Kladov-0/+9
2021-06-21feature: massively improve performance for large filesAleksey Kladov-1/+1
This story begins in #8384, where we added a smart test for our syntax highting, which run the algorithm on synthetic files of varying length in order to guesstimate if the complexity is O(N^2) or O(N)-ish. The test turned out to be pretty effective, and flagged #9031 as a change that makes syntax highlighting accidentally quadratic. There was much rejoicing, for the time being. Then, lnicola asked an ominous question[1]: "Are we sure that the time is linear right now?" Of course it turned out that our sophisticated non-linearity detector *was* broken, and that our syntax highlighting *was* quadratic. Investigating that, many brave hearts dug deeper and deeper into the guts of rust-analyzer, only to get lost in a maze of traits delegating to traits delegating to macros. Eventually, matklad managed to peel off all layers of abstraction one by one, until almost nothing was left. In fact, the issue was discovered in the very foundation of the rust-analyzer -- in the syntax trees. Worse, it was not a new problem, but rather a well-know, well-understood and event (almost) well-fixed (!) performance bug. The problem lies within `SyntaxNodePtr` type -- a light-weight "address" of a node in a syntax tree [3]. Such pointers are used by rust-analyzer all other the place to record relationships between IR nodes and the original syntax. Internally, the pointer to a syntax node is represented by node's range. To "dereference" the pointer, you traverse the syntax tree from the root, looking for the node with the right range. The inner loop of this search is finding a node's child whose range contains the specified range. This inner loop was implemented by naive linear search over all the children. For wide trees, dereferencing a single `SyntaxNodePtr` was linear. The problem with wide trees though is that they contain a lot of nodes! And dereferencing pointers to all the nodes is quadratic in the size of the file! The solution to this problem is to speed up the children search -- rather than doing a linear lookup, we can use binary search to locate the child with the desired interval. Doing this optimization was one of the motivations (or rather, side effects) of #6857. That's why `rowan` grew the useful `child_or_token_at_range` method which does exactly this binary search. But looks like we've never actually switch to this method? Oups. Lesson learned: do not leave broken windows in the fundamental infra. Otherwise, you'll have to repeatedly re-investigate the issue, by digging from the top of the Everest down to the foundation! [1]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/.60syntax_highlighting_not_quadratic.60.20failure/near/240811501 [2]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Syntax.20highlighting.20is.20quadratic [3]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Syntax.20highlighting.20is.20quadratic/near/243412392
2021-06-18Don't insert imports outside of cfg attributed itemsLukas Wirth-1/+7
2021-06-18Allow to disable import insertion on single path glob importsLukas Wirth-0/+9
2021-06-17Fix parser tests for 1.53Lukas Wirth-198/+198
2021-06-17Create modules in correct directory for nested modules in move_module assistLukas Wirth-0/+8
2021-06-15Highlight unsafe trait refs as unsafe only in impl blocks and definitionsLukas Wirth-0/+9
2021-06-15internal: enforce no #[ignore] and no #[should_panic]Aleksey Kladov-2/+2
2021-06-13clippy::manual_str_repeatMaan2003-1/+1
2021-06-13clippy::redudant_borrowMaan2003-10/+10
2021-06-12internal: cross-crate cov-marksAleksey Kladov-1/+1
2021-06-11Update ungrammarJonas Schievink-649/+769
2021-06-08Fix edge case for ImportGranularity guessingLukas Wirth-1/+4