aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/make.rs
Commit message (Collapse)AuthorAgeFilesLines
* Change missing impl assist to use todo!() instead of unimplemented()Chris Hopman2020-04-101-0/+3
| | | | | | | | | | | | todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html) Rust documentation provides further clarification: > The difference between unimplemented! and todo! is that while todo! > conveys an intent of implementing the functionality later and the > message is "not yet implemented", unimplemented! makes no such claims. todo!() seems more appropriate for assists that insert missing impls.
* Merge #3746bors[bot]2020-04-031-0/+25
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3746: Add create_function assist r=flodiebold a=TimoFreiberg The function part of #3639, creating methods will come later - [X] Function arguments - [X] Function call arguments - [x] Method call arguments - [x] Literal arguments - [x] Variable reference arguments - [X] Migrate to `ast::make` API Done, but there are some ugly spots. Issues to handle in another PR: - function reference arguments: Their type isn't printed properly right now. The "insert explicit type" assist has the same issue and this is probably a relatively rare usecase. - generating proper names for all kinds of argument expressions (if, loop, ...?) Without this, it's totally possible for the assist to generate invalid argument names. I think the assist it's already helpful enough to be shipped as it is, at least for me the main usecase involves passing in named references. Besides, the Rust tooling ecosystem is immature enough that some janky behaviour in a new assist probably won't scare anyone off. - select the generated placeholder body so it's a bit easier to overwrite it - create method (`self.foo<|>(..)` or `some_foo.foo<|>(..)`) instead of create_function. The main difference would be finding (or creating) the impl block and inserting the `self` argument correctly - more specific default arg names for literals. So far, every generated argument whose name can't be taken from the call site is called `arg` (with a number suffix if necessary). - creating functions in another module of the same crate. E.g. when typing `some_mod::foo<|>(...)` when in `lib.rs`, I'd want to have `foo` generated in `some_mod.rs` and jump there. Issues: the mod could exist in `some_mod.rs`, in `lib.rs` as `mod some_mod`, or inside another mod but be imported via `use other_mod::some_mod`. - refer to arguments of the generated function with a qualified path if the types aren't imported yet (alternative: run autoimport. i think starting with a qualified path is cleaner and there's already an assist to replace a qualified path with an import and an unqualified path) - add type arguments of the arguments to the generated function - Autocomplete functions with information from unresolved calls (see https://github.com/rust-analyzer/rust-analyzer/pull/3746#issuecomment-605281323) Issues: see https://github.com/rust-analyzer/rust-analyzer/pull/3746#issuecomment-605282542. The unresolved call could be anywhere. But just offering this autocompletion for unresolved calls in the same module would already be cool. Co-authored-by: Timo Freiberg <[email protected]>
| * Use ast::make API in add_function assistTimo Freiberg2020-04-011-0/+25
| |
* | Add impl From for enum variant assistMatthew Hall2020-04-011-1/+2
|/ | | | | | Basically adds a From impl for tuple enum variants with one field. Added to cover the fairly common case of implementing your own Error that can be created from another one, although other use cases exist.
* Nice string formattingAleksey Kladov2020-03-281-7/+8
|
* Fix merge-imports assist for wildcard importsPiotr Szpetkowski2020-03-271-0/+5
|
* Merge #3742bors[bot]2020-03-271-2/+3
|\ | | | | | | | | | | | | | | | | | | | | 3742: Replace if with if-let r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Replace if with if-letAleksey Kladov2020-03-271-2/+3
| |
* | Merge #3741bors[bot]2020-03-271-1/+10
|\| | | | | | | | | | | | | | | | | | | | | 3741: More general ctor for ifs r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * More general ctor for ifsAleksey Kladov2020-03-271-1/+10
| |
* | Merge #3740bors[bot]2020-03-271-29/+28
|\| | | | | | | | | | | | | | | | | | | | | 3740: Simplify r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * SimplifyAleksey Kladov2020-03-271-29/+28
| |
* | Assist: replace unwrap with matchUnreal Hoang2020-03-261-0/+4
|/
* fill match arms with empty block rather than unit tupleJosh Mcguigan2020-03-241-0/+3
|
* review commentsJosh Mcguigan2020-03-231-1/+6
|
* implement fill match arm assist for tuple of enumsJosh Mcguigan2020-03-231-0/+9
|
* Swtches to rust SSR query checkMikhail Modin2020-03-151-1/+15
|
* Add parse_to_token_treeEdwin Cheng2020-03-081-0/+6
|
* make::use_itemAleksey Kladov2020-03-061-0/+4
|
* Simplify creation of `T[,]`Aleksey Kladov2020-03-061-11/+2
|
* Rerail split_import API onto ASTAleksey Kladov2020-03-061-0/+21
| | | | | The code is more verbose and less efficient now, but should be reusable in add_import context as well
* Implement concat macroEdwin Cheng2020-03-031-1/+7
|
* Fix typoAleksey Kladov2020-02-291-1/+1
|
* More orthogonal API for building pathsAleksey Kladov2020-02-291-4/+7
|
* Run cargo +nightly fix --clippy -Z unstable-optionsKirill Bulatov2020-02-181-1/+1
|
* Init implementation of structural search replaceMikhail Modin2020-02-141-1/+1
|
* Cleanup early return assistAleksey Kladov2020-02-071-8/+21
|
* Generalize invert_if to just always workAleksey Kladov2020-02-071-1/+5
|
* A tiny bit more consistent APIAleksey Kladov2020-02-061-1/+1
|
* Refactor if-let -> match assist to use ast::makeAleksey Kladov2020-02-051-3/+10
|
* Make sure that newly created nodes are the root of the treeAleksey Kladov2020-02-041-2/+11
|
* More orthogonal path editingAleksey Kladov2020-01-151-16/+2
|
* Slightly more fluent APIAleksey Kladov2020-01-151-13/+13
|
* Qualify paths in 'fill match arms' assistFlorian Diebold2020-01-121-2/+3
|
* Fix ordering problem between qualifying paths and substituting paramsFlorian Diebold2020-01-111-2/+9
|
* Handle type argsFlorian Diebold2020-01-111-0/+7
|
* Clippy lintskjeremy2019-12-201-2/+1
|
* do refact and fix some issuebravomikekilo2019-11-241-2/+13
|
* Make make:: builders slightly more convenientAleksey Kladov2019-11-131-8/+11
|
* Use strongly-typed ast building for early-return assistAleksey Kladov2019-11-131-21/+31
|
* Support paths other than "Some".krk2019-11-011-2/+3
|
* Handle IfLet in convert_to_guarded_return.krk2019-10-311-0/+16
|
* Some clippy fixeskjeremy2019-10-301-2/+2
|
* use correct spacing for enum patternAleksey Kladov2019-10-261-1/+1
|
* Adds "replace with guarded return" assistMikhail Modin2019-10-201-0/+8
|
* add syntax-tree based indentsAleksey Kladov2019-10-121-0/+6
|
* Start simplifying editing APIAleksey Kladov2019-09-261-0/+48
|
* keep ast creation API simpleAleksey Kladov2019-09-261-0/+135