aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * Node-ify lifetimesLukas Wirth2020-12-164-33/+47
| |
* | 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-154-24/+42
|/
* 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-072-1/+2
|\ | | | | | | | | | | | | | | 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-042-1/+2
| |
* | 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
| |
* | Profile completions betterKirill Bulatov2020-11-271-0/+13
| |
* | Avoid allocation in ast::String::value if the string needs no unescapingLukas Wirth2020-11-271-9/+18
|/
* 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]>
| * format string highlighting: handle hex + debug type specifierRoland Ruckerbauer2020-11-151-0/+22
| |
* | Use shorthand record syntax when renaming struct initializer fieldLukas Wirth2020-11-142-9/+13
|/
* Fix attachment of inner doc commentsAleksey Kladov2020-11-122-16/+30
|
* Simplify codeAleksey Kladov2020-11-121-28/+23
|
* Merge #6512bors[bot]2020-11-091-36/+89
|\ | | | | | | | | | | | | | | | | | | | | 6512: Don't replace parent node when inserting as first child in algo::diff r=SomeoneToIgnore a=Veykril This makes the diff a bit more detailed. See https://github.com/rust-analyzer/rust-analyzer/pull/6287#issuecomment-723889267 for context cc @SomeoneToIgnore Co-authored-by: Lukas Wirth <[email protected]>
| * Don't replace parent node when inserting as first child in algo::diffLukas Wirth2020-11-091-36/+89
| |
* | Fix debug for SyntaxRewriterAleksey Kladov2020-11-091-1/+4
| |
* | Merge #6476bors[bot]2020-11-071-0/+4
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6476: Add missing AssocItems in add_custom_impl assist r=matklad a=Veykril ```rust use std::fmt; #[derive(Debu<|>g)] struct Foo { bar: String, } ``` -> ```rust use std::fmt; struct Foo { bar: String, } impl fmt::Debug for Foo { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ${0:todo!()} } } ``` Co-authored-by: Lukas Wirth <[email protected]>
| * Add missing AssocItems in add_custom_impl assistLukas Wirth2020-11-051-0/+4
| |
* | Cleanup APIAleksey Kladov2020-11-063-85/+68
| |
* | SimplifyAleksey Kladov2020-11-062-34/+22
| |
* | Kill RAW_ literalsAleksey Kladov2020-11-067-65/+61
| | | | | | | | | | Syntactically, they are indistinguishable from non-raw versions, so it doesn't make sense to separate then *at the syntax* level.
* | Minor, cleanup styleAleksey Kladov2020-11-061-50/+64
| |
* | More orthogonal APIAleksey Kladov2020-11-061-33/+30
| |
* | Move int parsing to IntNumber tokenAleksey Kladov2020-11-063-76/+91
| |
* | Better importsAleksey Kladov2020-11-061-11/+11
| |
* | Generate token for ints and floatsAleksey Kladov2020-11-061-0/+42
|/
* Merge #6456bors[bot]2020-11-041-2/+25
|\ | | | | | | | | | | | | | | | | | | | | | | 6456: Support record variants in extract_struct_from_enum_variant r=matklad a=Veykril As requested :) This also prevents the assist from being disabled if a definition in the value namespace exists with the same name as our new struct since that won't cause a collision #4468 Co-authored-by: Lukas Wirth <[email protected]>
| * Support struct variants in extract_struct_from_enum_variantLukas Wirth2020-11-031-2/+25
| |
* | Merge #6454bors[bot]2020-11-032-1/+66
|\ \ | |/ |/| | | | | | | | | | | | | 6454: Fix overflow panic in convert_interger_literal assist r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Fix overflow panic in convert_interger_literal assistAleksey Kladov2020-11-032-1/+66
| | | | | | | | | | | | | | | | | | This also seizes the opportunity to move integer literal parsing to the syntax crate, were it logically belongs. Note though that this is still done in an ad hoc manner -- we probably should split kitchen sink ast::Literal into a separate APIs for strings, ints, etc
* | Make insert_use return a SyntaxRewriterLukas Wirth2020-11-021-0/+37
|/
* Merge #6365bors[bot]2020-11-021-40/+120
|\ | | | | | | | | | | | | | | | | | | | | | | 6365: Do insertion lookahead in algo::diff r=matklad a=Veykril This is the last blocker for #6287 after this I can update that PR to properly fix things through using `SyntaxRewriter`. This PR also shuffles tests around a bit and adds some more. Ideally this is just a hack until we implement a "proper" diff algorithm that approximates a minimal diff. Maybe something like [gumtree](https://github.com/GumTreeDiff/gumtree)? Co-authored-by: Lukas Wirth <[email protected]>
| * Do insertion lookahead in algo::diffLukas Wirth2020-10-261-40/+120
| |
* | Deny unreachable-pubAleksey Kladov2020-11-026-16/+15
|/ | | | | | | | It's very useful when `pub` is equivalent to "this is crate's public API", let's enforce this! Ideally, we should enforce it for local `cargo test`, and only during CI, but that needs https://github.com/rust-lang/cargo/issues/5034.
* Merge #6347bors[bot]2020-10-261-24/+141
|\ | | | | | | | | | | | | | | 6347: Support insertion in SyntaxRewriter r=Veykril a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
| * Remove InsertPos::Before variant in Syntax RewriterLukas Wirth2020-10-241-13/+20
| |
| * Support insertion in SyntaxRewriterLukas Wirth2020-10-241-24/+134
| |
* | Merge #6331 #6342bors[bot]2020-10-241-3/+11
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6331: correct hover text for items with doc attribute with raw strings r=matklad a=JoshMcguigan Fixes #6300 by improving the handling of raw string literals in attribute style doc comments. This still has a bug where it could consume too many `"` at the start or end of the comment text, just as the original code had. Not sure if we want to fix that as part of this PR or not? If so, I think I'd prefer to add a unit test for either the `as_simple_key_value` function (I'm not exactly sure where this would belong / how to set this up) or create a `fn(&SmolStr) -> &SmolStr` to unit test by factoring out the `trim` operations from `as_simple_key_value`. Thoughts on this? 6342: Shorter dependency chain r=matklad a=popzxc Continuing implementing suggestions from the `Completion refactoring` zulip thread. This PR does the following: - Removes dependency of `completions` on `assists` by moving required functionality into `ide_db`. - Moves completely `call_info` crate into `ide_db` as it looks like it fits perfect there. - Adds a bunch of new tests and docs. - Adds the re-export of `base_db` to the `ide_db` and removes direct dependency on `base_db` from other crates. The last point is controversial, I guess, but I noticed that in places where `ide_db` is used, `base_db` is also *always* used. Thus I think the dependency on the `base_db` is implied by the fact of `ide_db` interfaces, and thus it makes sense to just provide `base_db` out of the box. Co-authored-by: Josh Mcguigan <[email protected]> Co-authored-by: Igor Aleksanov <[email protected]>