aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/make.rs
Commit message (Collapse)AuthorAgeFilesLines
* Add quickfix to add a struct fieldTimo Freiberg2020-06-121-0/+4
|
*-. Merge #4521 #4522bors[bot]2020-05-201-19/+17
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4521: Use snippets in add_function r=matklad a=matklad bors r+ 🤖 4522: Explain the purpose of `ast::make` module more clearly r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| | * Explain the purpose of `ast::make` module more clearlyAleksey Kladov2020-05-201-4/+7
| |/ |/|
| * Moderate cleanup of add_functionAleksey Kladov2020-05-201-15/+10
|/
* Change type_arg to type_ref funcFedor Sakharov2020-05-141-2/+2
|
* Correctly fill default type parametersFedor Sakharov2020-05-131-0/+4
|
* Improve panic message for ast_from_textEdwin Cheng2020-05-091-1/+6
|
* Add missing members generates indented blocksAleksey Kladov2020-05-021-8/+0
|
* Introduce EffectExprAleksey Kladov2020-05-021-2/+2
|
* More principled approach for finding From traitAleksey Kladov2020-04-291-2/+1
|
* Add `pub(crate)` to functions generated in other moduleTimo Freiberg2020-04-211-0/+4
|
* Make add_function generate functions in other modules via qualified pathTimo Freiberg2020-04-211-1/+6
|
* 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
|