about summary refs log tree commit diff
path: root/crates/syntax/src
AgeCommit message (Collapse)AuthorLines
2020-11-03Merge #6454bors[bot]-1/+66
6454: Fix overflow panic in convert_interger_literal assist r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-03Fix overflow panic in convert_interger_literal assistAleksey Kladov-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
2020-11-02Make insert_use return a SyntaxRewriterLukas Wirth-0/+37
2020-11-02Merge #6365bors[bot]-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 <lukastw97@gmail.com>
2020-11-02Deny unreachable-pubAleksey Kladov-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.
2020-10-26Do insertion lookahead in algo::diffLukas Wirth-40/+120
2020-10-26Merge #6347bors[bot]-24/+141
6347: Support insertion in SyntaxRewriter r=Veykril a=Veykril Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-24Remove InsertPos::Before variant in Syntax RewriterLukas Wirth-13/+20
2020-10-24Merge #6331 #6342bors[bot]-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 <joshmcg88@gmail.com> Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-10-24Support insertion in SyntaxRewriterLukas Wirth-24/+134
2020-10-23correct hover for items with doc attribute with raw stringsJosh Mcguigan-3/+11
2020-10-22algo::diff testsLukas Wirth-2/+326
2020-10-22Rewrite algo::diff to support insertion and deletionLukas Wirth-23/+64
2020-10-20Merge #6172bors[bot]-0/+3
6172: Add qualify path assist r=matklad a=Veykril This implements a `qualify_path` assist which works quite similar to the `auto_import` assist but instead of adding imports to the file it well, qualifies the path. This PR also moves out the `AutoImportAssets` struct and functions from `auto_import` into a utils submodule as most of this is now shared between `auto_import` and `qualify_path`. Changes made to `AutoImportAssets` are solely in its `search_for_imports` function which now takes a prefixed parameter to discern between using `find_use_path_prefixed` and `find_use_path` as the former is the required behavior by `auto_import` and the latter by this assist. For missing imported traits instead of importing this will qualify the path with a trait cast as in: ```rust test_mod::TestStruct::TEST_CONST<|> ``` becomes ```rust <test_mod::TestStruct as test_mod::TestTrait>::TEST_CONST ``` and for trait methods ideally it would do the following: ```rust let test_struct = test_mod::TestStruct {}; test_struct.test_meth<|>od() ``` becomes ```rust let test_struct = test_mod::TestStruct {}; test_mod::TestTrait::test_method(&test_struct) ``` Fixes #4124. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-18Extract call_info and completion into separate cratesIgor Aleksanov-0/+84
2020-10-15Properly qualify trait methods in qualify_path assistLukas Wirth-0/+3
2020-10-08when generating new function, focus on return type instead of bodyBenjamin Coenen-1/+11
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-07CleanupAleksey Kladov-10/+13
2020-10-07Merge #6160bors[bot]-1/+44
6160: Add validation check for ambiguous trait objects r=matklad a=Veykril Fixes #285. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-06Add validation check for ambiguous trait objectsLukas Wirth-1/+44
2020-10-06Document privacy invariant of SyntaxPtrAleksey Kladov-0/+2
2020-10-02Merge #6104bors[bot]-1/+1
6104: Minor clippy performance suggestions r=matklad a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-10-01Up rustc-ap-rustc_lexer to 681kjeremy-4/+4
cargo update as well
2020-09-30Minor clippy performance suggestionskjeremy-1/+1
2020-09-29Merge #6019bors[bot]-5/+28
6019: Remove make::path_from_text r=matklad a=Veykril This removes the `make::path_from_text` function, which according to a note should've been private. I removed it since it didn't really serve a purpose as it was simply wrapping `make::ast_from_text`. Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-09-21Rename impl edit method to be more explicitMatt Hooper-1/+1
2020-09-21Add make utility for empty associated item listsMatt Hooper-0/+4
2020-09-21Add edit utility for adding an associated item list to a impl defMatt Hooper-0/+16
2020-09-16Remove make::path_from_textLukas Wirth-5/+28
2020-09-16Add make::glob_use_tree function to create star-only UseTreeLukas Wirth-0/+4
2020-09-12Reimplement import merging by making it recursive properly nesting all levelsLukas Wirth-0/+1
2020-09-04Merge #5940bors[bot]-1/+84
5940: Implement "Replace `impl Trait` function argument with the named generic" assist. r=matklad a=alekseysidorov Fixes #5085 Co-authored-by: Aleksei Sidorov <gorthauer87@yandex.ru>
2020-09-04Remove unnecessary commaAleksei Sidorov-1/+0
2020-09-04Fix testsAleksei Sidorov-1/+1
2020-09-04Fix nitpicksAleksei Sidorov-17/+2
2020-09-03Impl make::blank_lineLukas Wirth-1/+11
2020-09-03Resolve most of corner casesAleksei Sidorov-4/+22
2020-09-03Initial implementation of the #5085 issueAleksei Sidorov-0/+81
2020-09-03Unify namingAleksey Kladov-4/+4
2020-08-31Reduce path_from_text usageAleksey Kladov-0/+1
2020-08-31Remove dead codeAleksey Kladov-14/+0
2020-08-27:arrow_up: cratesAleksey Kladov-1/+1
2020-08-25Cleanup invert-ifAleksey Kladov-6/+3
* stick to trivial factory functions in make * compress the logic for inverting Option/Result
2020-08-24Support extern typesJonas Schievink-1/+7
2020-08-24Merge #5845bors[bot]-1/+1
5845: Omit lenses for not runnable doctests r=matklad a=SomeoneToIgnore Ideally, we should properly parse the doctest attributes before, but since I need it for the code lens only, this way should suffice for now Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-08-23Invert if should be smart about is_some, is_none, is_ok, is_errdragfire-1/+7
2020-08-22Omit lenses for not runnable doctestsKirill Bulatov-1/+1
2020-08-21:arrow_up: ungrammarAleksey Kladov-1/+2
2020-08-21Switch to expect_test from crates.ioAleksey Kladov-1/+1
2020-08-17formatjDomantas-13/+9