Commit Graph

538 Commits

Author SHA1 Message Date
Florian Diebold
6787f124b5 Clean up RPIT a bit 2020-02-07 18:28:10 +01:00
Aleksey Kladov
d00add1f1f Introduce assists utils 2020-02-07 17:28:02 +01:00
Aleksey Kladov
561b4b11ff Name assist handlers 2020-02-07 17:28:02 +01:00
Aleksey Kladov
aa64a84b49 Cleanups 2020-02-07 15:12:51 +01:00
Aleksey Kladov
ce44547cfb Cleanup imports 2020-02-07 15:10:19 +01:00
Aleksey Kladov
6ac9c4ad6a Cleanup 2020-02-07 15:04:50 +01:00
Aleksey Kladov
2d95047f7c Cleanup 2020-02-07 14:55:47 +01:00
Aleksey Kladov
b831b17b3d Simplify 2020-02-07 14:53:50 +01:00
Aleksey Kladov
36ee9ecb67 Cleanup early return assist 2020-02-07 12:30:39 +01:00
Aleksey Kladov
aa1234e02b Generalize invert_if to just always work 2020-02-07 12:14:33 +01:00
Aleksey Kladov
56e3fbe588 A tiny bit more consistent API 2020-02-06 23:59:27 +01:00
Aleksey Kladov
7e73b7a5f8 Minor rename 2020-02-06 18:47:26 +01:00
Kirill Bulatov
f4a4fcf275 Remove the leftovers after ImportLocator removal 2020-02-06 19:27:48 +02:00
Aleksey Kladov
755077e372 Doctest autoimport 2020-02-06 18:14:44 +01:00
Aleksey Kladov
d1e8b8d134 Fix tests 2020-02-06 17:42:17 +01:00
Aleksey Kladov
ad204f7562 Mostly remove ImoportLocator infra 2020-02-06 17:17:51 +01:00
Aleksey Kladov
cf812c12d1 Assists are not generic 2020-02-06 17:12:02 +01:00
Aleksey Kladov
f8965ffafd Remove assists TestDB 2020-02-06 16:56:42 +01:00
Aleksey Kladov
2c922ef549 Start switching assists to a root database 2020-02-06 16:56:42 +01:00
Aleksey Kladov
a173e31890 Make assists use ImportsLocator directly 2020-02-06 16:40:28 +01:00
Aleksey Kladov
ec6fb8da7c Add profiling around add_impl_members
This intention is pretty slow for `impl Interator`, because it has a
ton of default methods which need to be substituted.

The proper fix here is to not compute the actual edit until the user
triggers the action, but that's awkward to do in the LSP right now, so
let's just put a profiling code for now.
2020-02-06 14:55:10 +01:00
Aleksey Kladov
a4c6e8c4e2 Refactor if-let -> match assist to use ast::make 2020-02-05 14:08:16 +01:00
Aleksey Kladov
f756d5da06 Better cursor placement when merging arms 2020-02-05 13:41:43 +01:00
Aleksey Kladov
28acd01c63 Merge match arms works with many arms 2020-02-05 12:26:43 +01:00
Aleksey Kladov
45dd90b0e8 Cleanup 2020-02-05 11:46:05 +01:00
bors[bot]
c9e1aab880
Merge #2948
2948: Allow add_explicit_type to replace a placeholder type r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-04 16:12:05 +00:00
Kirill Bulatov
bfbc5e2d37 Use proper import name in the label 2020-02-03 15:44:28 +02:00
Kirill Bulatov
4f27155d5c Simplify paths searches 2020-02-03 13:56:03 +02:00
Laurențiu Nicola
e0c7ce8417 Allow add_explicit_type to replace a placeholder type 2020-02-03 13:09:38 +02:00
Kirill Bulatov
01d59f4a32 Use name only when searching for an import candidate 2020-02-02 23:27:20 +02:00
bors[bot]
e24829909a
Merge #2982
2982: Merge imports when auto importing r=flodiebold a=SomeoneToIgnore



Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-02 13:06:14 +00:00
Kirill Bulatov
2ee94e3e24
Remove obsolete rustdoc 2020-02-02 14:59:07 +02:00
Kirill Bulatov
6dae5cbb11 Require ModPath for importing 2020-02-02 14:06:51 +02:00
Kirill Bulatov
a9669a5505 Merge imports when auto importing 2020-02-02 10:28:16 +02:00
Kirill Bulatov
d3188769e4 Auto import functions 2020-02-01 22:13:02 +02:00
Laurențiu Nicola
0fdca457df Improve auto import message 2020-01-31 22:12:18 +02:00
Kirill Bulatov
6d219c9a10 Properly select a target for auto importing 2020-01-29 16:23:18 +02:00
Kirill Bulatov
9be1ab7ff9 Code review fixes 2020-01-27 14:42:45 +02:00
Kirill Bulatov
9a6b5c6183 Enforce alphabetical import sorting 2020-01-27 01:53:59 +02:00
Kirill Bulatov
1a78991df6 Adjust the tests 2020-01-27 00:57:24 +02:00
Kirill Bulatov
d0a782ef1c Have a better trait interface 2020-01-27 00:17:10 +02:00
Kirill Bulatov
f57239729c Remove unnecessary lifetime parameter 2020-01-27 00:16:29 +02:00
Kirill Bulatov
316795e074 Initial auto import action implementation 2020-01-27 00:16:29 +02:00
Tomáš
ec6a7f0710 fixed inline_local_variable bug 2020-01-25 21:07:21 +01:00
TomasKralCZ
f67ee69777 added eq_token() method to LetStmt 2020-01-19 18:55:56 +01:00
TomasKralCZ
c3b9a19eb7 fix 'add_explicit_type' assist range 2020-01-19 17:40:53 +01:00
TomasKralCZ
8dc94a452c fix typo in 'inline_local_variable' 2020-01-19 17:39:53 +01:00
Aleksey Kladov
a3d6ddbe69 More natural trait setup 2020-01-16 16:27:21 +01:00
Aleksey Kladov
81a45ca1b3 Make FromSource private 2020-01-16 16:08:46 +01:00
Kirill Bulatov
79b77403b6 Reduce visibility 2020-01-15 20:21:05 +02:00
Kirill Bulatov
d51cf7794d itertools::Either -> either::Either 2020-01-15 20:20:20 +02:00
Kirill Bulatov
78a21253b4 Apply the api design suggestions 2020-01-15 20:17:17 +02:00
Kirill Bulatov
73dc8b6f06 Another attempt to add multiple edits 2020-01-15 20:16:27 +02:00
Aleksey Kladov
ef1326ee19 More orthogonal path editing 2020-01-15 18:48:28 +01:00
kjeremy
e89ade3809 Cleanup assert 2020-01-14 13:55:32 -05:00
Jeremy Kolb
864434137a unwrap 2020-01-14 13:15:41 -05:00
Jeremy Kolb
9042bb7892 Assert that first letter is capitalized 2020-01-14 12:32:46 -05:00
Jeremy Kolb
e04661e495 Fix casing 2020-01-14 12:32:26 -05:00
Jeremy Kolb
4cb82c334d More UI friendly labels 2020-01-14 11:49:14 -05:00
Jeremy Kolb
325912f01e Tweak add_custom_impl 2020-01-14 09:08:45 -05:00
kjeremy
a82c679c97 Some clippy lints 2020-01-13 11:27:06 -05:00
Florian Diebold
2c11a9b42d Qualify paths in 'fill match arms' assist 2020-01-12 11:34:52 +01:00
Florian Diebold
ccb75f7c97 Use FxHashMap 2020-01-11 23:33:04 +01:00
Florian Diebold
4496e2a06a Apply review suggestions 2020-01-11 23:33:04 +01:00
Florian Diebold
15fc643e05 Fix ordering problem between qualifying paths and substituting params 2020-01-11 23:33:04 +01:00
Florian Diebold
12905e5b58 Some more refactoring 2020-01-11 23:33:04 +01:00
Florian Diebold
def124e932 Fix file ID when qualifying paths; add another failing test 2020-01-11 23:33:04 +01:00
Florian Diebold
4545f289a9 Handle type args 2020-01-11 23:33:04 +01:00
Florian Diebold
5cb1f71322 More failing tests 2020-01-11 23:33:04 +01:00
Florian Diebold
4d75430e91 Qualify some paths in 'add missing impl members' 2020-01-11 23:33:04 +01:00
Florian Diebold
877fda04c5 Add test 2020-01-11 23:33:04 +01:00
Jeremy Kolb
5afb22e2b3 BinOp helper to detect assignment 2020-01-04 15:54:31 -05:00
bors[bot]
523b4cbc60
Merge #2650
2650: Add macro call support for SourceAnalyzer::type_of r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-29 15:02:27 +00:00
Florian Diebold
c39352fa43 Fill in type params in 'add missing impl members' assist 2019-12-24 17:29:27 +01:00
Edwin Cheng
16156d766d Add macro call support for type_of 2019-12-23 13:19:01 +08:00
kjeremy
0d5d63a80e Clippy lints 2019-12-20 15:14:30 -05:00
Aleksey Kladov
04715cbe1c Forbid <T>::foo syntax in mod paths 2019-12-18 17:41:33 +01:00
Aleksey Kladov
aca022f1d4 Refactor PathKind 2019-12-17 15:38:28 +01:00
Aleksey Kladov
2619950b3b Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
kjeremy
03fe6b38b8 Remove some unwraps in add_new 2019-12-13 18:28:01 -05:00
Aleksey Kladov
a1639d0d1e Remove more dead code 2019-12-08 17:45:14 +01:00
Florian Diebold
de08d30b80 Get rid of unwraps in add_new
Probably fixes #2464.
2019-12-07 11:54:26 +01:00
bors[bot]
3376c08052
Merge #2018
2018: assists: add assist for custom implementation for derived trait r=matklad a=paulolieuthier

Please, tell me if something could be more idiomatic or efficient.

Fixes #1256.

Co-authored-by: Paulo Lieuthier <paulolieuthier@gmail.com>
2019-12-02 15:52:11 +00:00
Paulo Lieuthier
5b2d52c8df docs: describe new feature 'add custom impl for derived trait' 2019-11-28 17:36:40 -03:00
Paulo Lieuthier
439080f027 assists: add assist for custom implementation for derived trait 2019-11-28 16:56:06 -03:00
Aleksey Kladov
ccd1b0800a Rename Source -> InFile 2019-11-28 12:50:26 +03:00
Aleksey Kladov
e5eadb3390 Introduce hir::Type
It should provide a convenient API over more low-level Ty
2019-11-26 14:02:57 +03:00
Aleksey Kladov
131c2da6bf ⬆️ salsa 2019-11-26 11:29:20 +03:00
Aleksey Kladov
5fd68b5929 Fix hir for ast::UnionDef 2019-11-25 17:50:49 +03:00
bors[bot]
7b6aa7c34e
Merge #2343
2343: implement assist invert_if r=matklad a=bravomikekilo

fix [issue 2219 invert if condition](https://github.com/rust-analyzer/rust-analyzer/issues/2219)
I put the assist cursor range to `if` of the if expression, because both condition and body will be replaced. Is there any way to replace them without cover the cursor position?
@matklad 

Co-authored-by: bravomikekilo <bmk1221@126.com>
2019-11-24 08:32:07 +00:00
bravomikekilo
adac4fc2f2 do refact and fix some issue 2019-11-24 13:14:57 +08:00
Aleksey Kladov
fc1e543f7a Get rid of DefDatabase2 2019-11-23 14:49:45 +03:00
Aleksey Kladov
958862093e Move docs to hir_def 2019-11-23 14:43:38 +03:00
Aleksey Kladov
d8caf56dfc Uniformalize naming 2019-11-22 21:52:06 +03:00
bravomikekilo
1ebfa908d5 fix tidy test 2019-11-22 03:18:22 +08:00
bravomikekilo
8a8be06219 initial invert_if 2019-11-22 02:51:40 +08:00
Felix Kohlgrüber
bcb2ea912b fix 2190; add test for "replace if let with match" 2019-11-20 19:01:06 +01:00
Aleksey Kladov
36e3fc9d54 Rename Source::ast -> Source::value 2019-11-20 09:42:30 +03:00
Aleksey Kladov
7e2f4b30db Disable doctests 2019-11-17 18:35:05 +03:00
Aleksey Kladov
5b54a93fe7 Add ast for plain and raw string literals 2019-11-16 22:50:41 +03:00
Aleksey Kladov
d898ecb8f2 Force passing Source when creating a SourceAnalyzer 2019-11-16 02:12:35 +03:00
Aleksey Kladov
f36ac059f3 Reduce some duplication 2019-11-16 01:14:56 +03:00
Aleksey Kladov
20186cdf89 Fix add-new assist 2019-11-15 22:57:19 +03:00
bors[bot]
3ad11973ac
Merge #2165
2165: ra_assists: Add add_new assist r=matklad a=rep-nop

Adds a new assist to autogenerate a new fn based on the selected struct, excluding tuple structs and unions. The fn will inherit the same visibility as the struct and the assist will attempt to reuse any existing impl blocks that exist at the same level of struct.

Not marking this as closing #1644 since there's a part 2 of adding autocompletion for when someone starts typing `[pub ]fn new(...`

Co-authored-by: Wesley Norris <repnop@outlook.com>
2019-11-15 07:01:19 +00:00
Aleksey Kladov
e177c65e36 Use strongly-typed ast building for early-return assist 2019-11-13 11:54:21 +03:00
Aleksey Kladov
2a69d584d6 Add a bit of types 2019-11-13 10:54:50 +03:00
Aleksey Kladov
018255efe3 Minor cleanup 2019-11-13 10:32:53 +03:00
Wesley Norris
cbc6f94573 Add add_new assist
Adds a new assist to autogenerate a new fn based on the selected struct,
excluding tuple structs and unions. The fn will inherit the same
visibility as the struct and the assist will attempt to reuse any
existing impl blocks that exist at the same level of struct.
2019-11-09 10:56:36 -05:00
Aleksey Kladov
50364bd478 Appease the linter by dummy doc comments 2019-11-04 22:33:21 +03:00
Aleksey Kladov
42370610ce Restore assists tests 2019-11-04 22:28:47 +03:00
Aleksey Kladov
74d827bb80 Rename MockDatabase -> TestDB
Actually working rename is sooo useful!
2019-11-04 22:21:15 +03:00
Aleksey Kladov
24894aca31 Remove more duplication in test fixtures 2019-11-04 22:12:49 +03:00
krk
bc14f500a0 Extract common parts of match arms in convert_to_guarded_return assist. 2019-11-01 18:34:42 +01:00
krk
91ab3f8760 Support paths other than "Some". 2019-11-01 18:18:58 +01:00
krk
1841a39f86 Remove variable pat. 2019-11-01 16:58:09 +01:00
krk
4a4d9f7a90 Handle IfLet in convert_to_guarded_return. 2019-10-31 21:10:58 +01:00
kjeremy
b441b4e8ef Some clippy fixes 2019-10-30 13:36:37 -04:00
Florian Diebold
47cfdb4aa3 Don't add a space after the opening brace in autoimport 2019-10-29 18:14:15 +01:00
Florian Diebold
6d1b4ffa2e Fix autoimport not choosing the deepest use tree in some situations 2019-10-28 19:08:56 +01:00
bors[bot]
46b63c462d
Merge #2099
2099: Fix panic on raw string assist r=matklad a=aee11

Strings that do not contain two quotation marks would cause a slice indexing panic because `find_usual_string_range` would return a range that only contained a single quotation mark.
Panic example:
```
fn main() {
    let s = "<|>
}
```

I noticed a lot of panics from the `make_raw_string` assist while working on another issue today.

Co-authored-by: Alexander Elís Ebenesersson <alex2789@gmail.com>
2019-10-27 19:20:01 +00:00
Alexander Elís Ebenesersson
17bd3e59f8 Fix panic on raw string assist
Strings that do not contain two quotation marks
would cause a slice indexing panic because code
was assuming `find_usual_string_range` would return
a string with two quotes, but it would incorrectly
also return text ranges containing only a single quote.
2019-10-28 03:00:28 +09:00
Aleksey Kladov
ad3fe316c6 further simplify assists 2019-10-27 18:22:14 +03:00
Aleksey Kladov
b6fcacd96d move all assists to use generated docs 2019-10-27 17:49:39 +03:00
Aleksey Kladov
cda6355de2 simplify AssistCtx API
We never actually use ability to create multiple actions out of a
single context
2019-10-27 17:35:37 +03:00
Aleksey Kladov
9e638c9f3e simplify 2019-10-27 17:27:05 +03:00
bors[bot]
ad950830d0
Merge #2090
2090: move public stuff to top r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-27 14:13:09 +00:00
Aleksey Kladov
85c64ec7be use new api for flip_trait_bound assist 2019-10-27 17:02:43 +03:00
Wesley Norris
fc2fc8528b Add tests for the trait bound flip assist.
Co-authored-by: vlthr <vlthr@users.noreply.github.com>
2019-10-27 16:52:33 +03:00
Wesley Norris
3a64a85a52 Fixes #2054.
This adds the `flip_trait_bound` assist which allows for the swapping of two trait bounds in a trait list that are next to each other.
2019-10-27 16:52:33 +03:00
Aleksey Kladov
be0f48f7cf move public stuff to top 2019-10-27 16:48:20 +03:00
Aleksey Kladov
73532e900e rename auto_import -> add_import
We are long way from auto imports at the moment
2019-10-27 16:46:49 +03:00
Aleksey Kladov
da5528824a document almost all assists 2019-10-27 12:23:22 +03:00
Aleksey Kladov
860bbd56ef lightly document assist_ctx module 2019-10-27 12:04:06 +03:00
Aleksey Kladov
8118dc1bb9 use more consistent naming
I think this is the first time I use global rename for rust-analyzer
itself :-)
2019-10-27 11:53:09 +03:00
Aleksey Kladov
61349a3d18 extract assist helper for getting a specific token 2019-10-27 11:53:01 +03:00
Aleksey Kladov
3840324429 raw string assists work in macros 2019-10-27 11:49:13 +03:00
Aleksey Kladov
a490ba06fa document some more assists 2019-10-27 11:26:46 +03:00
Aleksey Kladov
cf4720ffd5 use unicode bar for drawing the cursor 2019-10-26 21:22:40 +03:00
Aleksey Kladov
4a83aae098 support range selection in assist docs 2019-10-26 20:57:23 +03:00
Aleksey Kladov
a5cbd8d5e8 check style for assist docs 2019-10-26 19:08:13 +03:00
Aleksey Kladov
4ef9b8d17a use correct spacing for enum pattern 2019-10-26 18:03:55 +03:00
Aleksey Kladov
3126152a84 document a couple of assists 2019-10-26 17:37:55 +03:00
Aleksey Kladov
394e474479 add blank lines for readability 2019-10-26 17:27:47 +03:00
Aleksey Kladov
d385438bcc generate more assists docs 2019-10-25 23:38:15 +03:00
Aleksey Kladov
0dd35ff2b2 auto-generate assists docs and tests 2019-10-25 14:47:48 +03:00
Aleksey Kladov
b5f13d8d51 xtask: move codegen to a module 2019-10-23 18:57:18 +03:00
Aleksey Kladov
afc6ee251d minor cleanup 2019-10-23 17:41:15 +03:00
Mikhail Modin
fb215dc192 Adds "replace with guarded return" assist 2019-10-20 19:14:32 +01:00
bors[bot]
bc7de5d47a
Merge #2002
2002:  Remove unused dependencies r=matklad a=sinkuu



Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-10-14 11:10:20 +00:00
bors[bot]
691bc27686
Merge #1999
1999: Simplify find().is_some() to any() r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-14 09:44:04 +00:00
Aleksey Kladov
c00f298fd2 add syntax-tree based indents 2019-10-12 22:07:47 +03:00
Shotaro Yamada
5ca6281164 Remove unused dependencies 2019-10-12 08:00:54 +09:00
kjeremy
53d1673edc use any() 2019-10-11 15:55:45 -04:00
bors[bot]
93199002af
Merge #1922
1922: feat(assists): Make raw string unescaped r=matklad a=Geobert

Last piece of https://github.com/rust-analyzer/rust-analyzer/issues/1730

Co-authored-by: Geobert Quach <geobert@protonmail.com>
2019-10-08 09:52:22 +00:00
Ekaterina Babshukova
311dbb8545 remove visitor module 2019-10-05 17:48:31 +03:00
Geobert Quach
31663c1368 feat(assists): Address some PR comments 2019-10-04 18:32:14 +01:00
Lúcás Meier
e17243d698 [#1807] Refactor file structure
Use the more conventional way of importing the ast types, and
put the assist at the top of the file.
2019-10-04 10:51:41 +02:00
Lúcás Meier
1ed1e3d4a7 Fix formatting 2019-10-04 08:21:24 +02:00
Lúcás Meier
e769a54502 Create an assist for applying De Morgan's law
Fixes #1807

This assist can transform expressions of the form `!x || !y` into
`!(x && y)`. This also works with `&&`.

This assist will only trigger if the cursor is on the central logical
operator.

The main limitation of this current implementation is that both operands
need to be an explicit negation, either of the form `!x`, or `x != y`.
More operands could be accepted, but this would complicate the implementation
quite a bit.
2019-10-03 22:48:35 +02:00
Lúcás Meier
ad65ba4062 WIP: Add demorgan application with naive negation 2019-10-03 22:19:46 +02:00
Geobert Quach
6195096fb4 feat(assists): Even smarter with hashes
Count `"#*` streak only, extract the counting in a function, unit test this function
2019-10-01 21:36:14 +01:00
Geobert Quach
b06c5fac14 feat(assists): Be smart about hashes
Add max_hashes_streak + 1 hashes to the raw string
2019-09-30 19:50:44 +01:00
Alexander Andreev
81efd696cc Merge branch 'master' into feature/issue/1856
# Conflicts:
#	crates/ra_assists/src/ast_editor.rs
2019-09-30 12:07:26 +03:00
Alexander Andreev
fdbd6bb11a Added test for check doc strings in crates.
#1856
2019-09-30 11:58:53 +03:00
uHOOCCOOHu
5a4b4f507e
Fix API of Attr 2019-09-30 16:17:53 +08:00
Aleksey Kladov
4acadbdca6 cleanup editor 2019-09-30 10:08:28 +03:00
Aleksey Kladov
05ca252fb5 remove ast_editor.rs 2019-09-30 10:05:12 +03:00
Aleksey Kladov
054c53aeb9 move remove bounds to ast/edit.rs 2019-09-30 09:56:20 +03:00
Aleksey Kladov
e010b144d5 move field list to ast/edit.rs 2019-09-30 09:27:26 +03:00
Geobert Quach
e293c34e85 feat(assists): Keep only one version of make_raw_string 2019-09-29 19:16:59 +01:00
Aleksey Kladov
0840ec038b migrate add impl items to the new editing API 2019-09-28 20:10:53 +03:00
Aleksey Kladov
5dbbfda34a simplify strip attrs 2019-09-28 19:50:16 +03:00
bors[bot]
2b69c84396
Merge #1815
1815: Support correct `$crate` expansion in macros r=uHOOCCOOHu a=uHOOCCOOHu

This PR makes normal use cases of `$crate` from macros work as expected.

It makes more macros from `std` work. Type inference works well with `panic`, `unimplemented`, `format`, and maybe more.
Sadly that `vec![1, 2, 3]` still not works, but it is not longer an issue about macro.

Screenshot:
![Screenshot_20190927_022136](https://user-images.githubusercontent.com/14816024/65714465-b4568f80-e0cd-11e9-8043-dd44c2ae8040.png)




Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com>
2019-09-27 02:58:26 +00:00
Geobert Quach
281e107155 feat(assists): Make raw string unescaped 2019-09-26 20:31:45 +01:00
Aleksey Kladov
d847d53e36 Start simplifying editing API 2019-09-26 22:22:08 +03:00
uHOOCCOOHu
2ecb126f5c
Support $crate in item and expr place. 2019-09-27 02:05:06 +08:00
Aleksey Kladov
1a4b424005 move diff to ra_syntax 2019-09-26 15:56:52 +03:00
Aleksey Kladov
183a38fb50 keep ast creation API simple 2019-09-26 15:29:28 +03:00
Aleksey Kladov
a525e830a6 add new editing API, suitable for modifying several nodes at once 2019-09-25 17:57:12 +03:00
bors[bot]
a452e50e0e
Merge #1911
1911: fewer monomorphisations r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-09-25 14:19:46 +00:00
Aleksey Kladov
b7422bd1ab fewer monomorphisations 2019-09-25 17:19:16 +03:00
Aleksey Kladov
efeae82f52 clean up naming 2019-09-25 15:58:40 +03:00
Aleksey Kladov
32843ae6f7 shorten AstBuilder names 2019-09-25 15:28:26 +03:00
Aleksey Kladov
546f031e4e minor builder cleanups 2019-09-25 15:26:05 +03:00
Aleksey Kladov
25fca04753 cleaned up record field builder 2019-09-25 15:09:03 +03:00
Aleksey Kladov
69689625ce move ast builder to a separate file 2019-09-25 14:35:26 +03:00
Aleksey Kladov
f32081fa18 move assists to subdir 2019-09-25 14:29:41 +03:00
Shotaro Yamada
9c45a9e586 Remove redundant clone() 2019-09-25 10:32:01 +09:00
Jeremy Kolb
13d7fc1620
Revert Self 2019-09-23 14:38:05 -04:00
kjeremy
1808175f98 Drive by lints 2019-09-23 14:31:30 -04:00
kjeremy
6da645d858 Suspicious line endings 2019-09-20 11:55:59 -04:00
Geobert Quach
ce4d843656 feat(assists): Apply comments 2019-09-19 22:12:28 +01:00
Geobert Quach
a3ab80b332 feat(assists): Rename escape_quote to escape_double_quote 2019-09-19 22:12:28 +01:00
Geobert Quach
889f1f0a7c feature(assists): Fix regression 2019-09-19 22:12:28 +01:00
Geobert Quach
016c997243 feat(assists): manage " when removing hash and make_usual_string 2019-09-19 22:12:28 +01:00
Geobert Quach
b6d55290a1 feat(assists): raw string <-> usual string manipulation
Fixes #1730
2019-09-19 22:12:28 +01:00
uHOOCCOOHu
de9670fe45
Move store TypeRef of type based path in PathKind 2019-09-15 19:48:24 +08:00
uHOOCCOOHu
4926bed426
Support path starting with a type 2019-09-15 19:40:32 +08:00
Aleksey Kladov
114a1b878e rename AdtDef -> Adt 2019-09-13 00:34:52 +03:00
Nelson Chen
14585468e2
Minor typo fix for ra_assists code doc 2019-09-08 02:10:53 -07:00
Ekaterina Babshukova
acb89d2be1 add assist to move type bounds to where clause 2019-09-05 13:29:13 +03:00
Aleksey Kladov
e94587e315 fix assists 2019-09-02 21:52:06 +03:00
Aleksey Kladov
5e3f291195 fix hir for new block syntax 2019-09-02 21:23:19 +03:00
Aleksey Kladov
4b6bccb58c ⬆️ once_cell 2019-09-01 23:18:15 +03:00
Aleksey Kladov
5b18a4eef9 rename struct -> record, pos -> tuple 2019-08-23 16:59:50 +03:00
Aleksey Kladov
bbcca4f735 make ast object safe 2019-08-23 15:06:47 +03:00
Ekaterina Babshukova
e84f93cb5b refactor fill_match_arms assist 2019-08-23 00:43:12 +03:00
Aleksey Kladov
4753409f86 refactor TryConvWith similar to ConvWith 2019-08-20 19:53:05 +03:00
Aleksey Kladov
3bec812258 remove ast::*Kind enums from assists 2019-08-19 14:11:09 +03:00
Florian Diebold
22724f37f3 Lower fully qualified associated type paths
I.e. `<T as Trait>::Foo`.
2019-08-12 21:43:00 +02:00
Evgenii P
06c3de310e rustfmt 2019-07-30 21:02:29 +07:00
Evgenii P
e7cdbe795a Fix flip comma assist 2019-07-30 20:33:58 +07:00
Phil Ellison
e6113c0998 Add merge_match_arm assist, bump rowan to 0.6.1 2019-07-29 21:59:52 +01:00
Aleksey Kladov
61739b0c17 Document AssistBuilder
closes #1603
2019-07-29 15:43:34 +03:00
Aleksey Kladov
d52ee59a71 streamline API 2019-07-21 13:28:58 +03:00
Aleksey Kladov
c9cfd57eea switch to upstream rowan's API 2019-07-20 20:12:06 +03:00
Aleksey Kladov
f6bcc2d745 align SyntaxText API with upstream 2019-07-20 16:52:11 +03:00
Aleksey Kladov
f3bdbec1b6 rename range -> text_range 2019-07-20 12:58:27 +03:00
Aleksey Kladov
0025299370 sane indexing in text 2019-07-19 20:55:32 +03:00
Aleksey Kladov
191a6ba330 convenience api 2019-07-19 19:05:34 +03:00
Aleksey Kladov
0343c4a815 migrate ra_assists to the new AST 2019-07-19 13:16:25 +03:00
Aleksey Kladov
deab4caa7b make Parse fields private
this is in preparation for the new rowan API
2019-07-12 19:41:13 +03:00
Ekaterina Babshukova
895597d567 move whitespace manipulation inside AstEditor 2019-07-10 22:03:00 +03:00
Jeremy Kolb
98d769a799 readability 2019-07-05 10:18:01 -04:00
Jeremy Kolb
6b4ec73b7e Clippy changes 2019-07-04 23:00:00 -04:00
Jeremy Kolb
4ad9e986ad Some clippy fixes for 1.36 2019-07-04 17:43:00 -04:00
Aleksey Kladov
1834bae5b8 allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was
broken in the last rustfmt release, and syntax highlighting of imports
is more important anyway
2019-07-04 23:09:09 +03:00
Ekaterina Babshukova
e0e42095db extend add_impl_members to constants and types 2019-07-03 16:17:18 +03:00
Changyu Li
3a2a13756f Review 1 2019-06-25 13:26:12 -07:00
ironyman
888157b52e fill_match_arm works with trivial arm 2019-06-23 21:05:50 -07:00
Florian Diebold
9c5e7dd849 Implement autoderef using the Deref trait
- add support for other lang item targets, since we need the Deref lang item
2019-06-15 18:21:23 +02:00
Aleksey Kladov
c4512fadb1 remove inherent source impls 2019-06-11 18:28:51 +03:00
Aleksey Kladov
178d8e96b5 use Source for StructField 2019-06-11 18:28:51 +03:00
Aleksey Kladov
f411c2988d use Source for Trait 2019-06-11 18:28:51 +03:00
Alan Du
964edd9943 Fix clippy::while_let_loop 2019-06-04 18:05:07 -04:00
Alan Du
b28ca32db2 Fix clippy::or_fun_call 2019-06-04 18:05:07 -04:00
Alan Du
ed3d93b875 Fix clippy::single_char_pattern 2019-06-04 18:05:07 -04:00
Aleksey Kladov
61e1474ab3 fix typos in mbe tests 2019-05-28 18:46:11 +03:00
bors[bot]
67d5927b16 Merge #1281
1281: Move arm cond to match guard r=matklad a=unrealhoang

I did split the rename to another commit, yet Github UI still show entirely new file change. Please review using commits.

Co-authored-by: Unreal Hoang <unrealhoang@gmail.com>
2019-05-22 07:39:54 +00:00
Unreal Hoang
08e954f0fd
add assist to move arm condition to match guard 2019-05-21 23:31:51 +09:00
Unreal Hoang
99ad6143cd
rename 2019-05-16 12:53:52 +09:00
Sergey Parilin
993abedd77 apply T! macro where it is possible 2019-05-15 15:35:47 +03:00
Aleksey Kladov
1667b5cf52 switch to once_cell from lazy_static 2019-05-07 20:54:33 +03:00
Sergey Parilin
12f8472d28 removed duplicating fill_struct_fields assist 2019-05-06 17:26:09 +03:00
Sergey Parilin
26ed925685 fill struct fields diagnostic 2019-05-06 17:16:11 +03:00
Jeremy Kolb
293cc81bf1 Remove collect 2019-05-05 13:28:22 -04:00
Unreal Hoang
d1c21b85cf
add complex match case and documentation 2019-05-02 01:41:02 +09:00
Unreal Hoang
f83e452b1e
move guard to arm body assist. 2019-05-02 00:42:00 +09:00
bors[bot]
c416caeda2 Merge #1194
1194: Pr 1190 r=matklad a=matklad



Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-22 13:19:47 +00:00
Aleksey Kladov
e01052d1f0 move auto-imoprter into IDE
auto-import is purely an IDE concern, so it should be done outside of
HIR
2019-04-22 15:56:28 +03:00