Commit Graph

651 Commits

Author SHA1 Message Date
Christoph Herzog
3360118040 Refactor AssistBuilder to manage a SourceChange
`AssistBuilder`` now managaes a full `SourceChange` instead of a
Vec<SourceFileEdit>.

This prepares AssistBuilder to handle creation of new files.
2020-07-07 12:10:18 +02:00
Aleksey Kladov
d09f692300 Add AssistKind::Generate 2020-07-03 19:32:18 +02:00
Aleksey Kladov
66b6a433c6 Unify naming of generating assists 2020-07-03 19:32:18 +02:00
kjeremy
4c9347ecc3 Don't categorize things we don't care about 2020-07-02 18:01:22 -04:00
kjeremy
36cc81ac71 Move AssistKind into AssistId 2020-07-02 17:48:35 -04:00
kjeremy
1d58e16824 Recategorize a few 2020-07-02 17:14:15 -04:00
Jeremy Kolb
b98c16a034 Categorize assists 2020-07-02 17:13:02 -04:00
Jonas Schievink
31f5b48817 Record and suggest trait items via ImportMap 2020-07-02 12:43:52 +02:00
Laurențiu Nicola
9710ad8c48 Reuse Semantics instances 2020-07-01 15:27:01 +03:00
Laurențiu Nicola
c1139a5a44 Use the existing Semantics in auto_import 2020-07-01 11:48:15 +03:00
Laurențiu Nicola
331e6d8f16 Remove db from AssistsContext 2020-07-01 10:25:59 +03:00
Laurențiu Nicola
5953cbd7ae Make SemanticsScope non-generic 2020-07-01 09:34:45 +03:00
Laurențiu Nicola
95d67ec401 Use more of FxHash* 2020-06-29 18:07:52 +03:00
Veetaha
36128c170d Get rid of unused imports 2020-06-29 01:23:39 +03:00
Veetaha
503f9498cd Follow matklad suggestions
- Move vis_offset() to utils.rs
- Shorten explicit ra_syntax::ast -> ast
- Undo refactoring exhaustive pattern to non-exhaustive
2020-06-29 01:18:50 +03:00
Veetaha
e75e2ae5b6 Simlify with matches!() 2020-06-28 04:03:59 +03:00
Aleksey Kladov
f5584668db introduce_variable -> extract_variable 2020-06-27 01:21:43 +02:00
bors[bot]
e628c66359
Merge #4945
4945: do not suggest assist for return type to result in bad case  r=matklad a=bnjjj

close #4826

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-26 16:59:59 +00:00
Aleksey Kladov
dd5841556c Smarter introduce variable
Use field init shorthand
2020-06-26 00:51:34 +02:00
Aleksey Kladov
d016cb4867 Use only one code-path for parsing fixtures
This removes leading newlines everywhere, shifting all ranges in tests
by one
2020-06-24 00:48:38 +02:00
Aleksey Kladov
e5101ae150 Centralize fixture parsing for assists 2020-06-24 00:30:34 +02:00
Aleksey Kladov
aa69757a01 More principled indentation trimming in fixtures 2020-06-23 23:33:41 +02:00
Aleksey Kladov
dad1333b48 New VFS 2020-06-23 17:51:06 +02:00
Laurențiu Nicola
76ddface08 Fix panic in split and merge import assists 2020-06-23 16:51:07 +03:00
Aleksey Kladov
6a6098d4c3 Remove RelativePathBuf from fixture
The paths in fixture are not really relative (the default one is
`/main.rs`), so it doesn't make sense to use `RelativePathBuf` here.
2020-06-23 00:14:44 +02:00
Benjamin Coenen
9342574097 do not suggest assist for return type to result in bad case #4826
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-21 18:47:27 +02:00
Benjamin Coenen
4c89d32f7a do not suggest assist for return type to result in bad case #4826
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-06-18 22:16:39 +02:00
bors[bot]
83a16e825d
Merge #4878
4878: Make "Replace qualified name with use" replace *all* mentions of the path r=matklad a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/4836

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-06-16 05:29:05 +00:00
Jonas Schievink
4295a004ed Operate only on AST paths instead of HIR 2020-06-16 00:49:59 +02:00
Jonas Schievink
aaaa68b56c Simplify 2020-06-15 22:59:49 +02:00
Jonas Schievink
71c002e589 It's fookin' raw 2020-06-15 22:39:26 +02:00
bors[bot]
db6100dbaa
Merge #4889
4889: Deprecate hir::Path::from_ast r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-15 09:02:53 +00:00
Aleksey Kladov
52a220cece Deprecate hir::Path::from_ast 2020-06-15 10:55:48 +02:00
Toby Dimmick
41f5471f3e fill_match_arms bind pattern implementation 2020-06-14 22:44:51 +01:00
Toby Dimmick
34db4edb80 fill_match_arms bind pattern test 2020-06-14 22:43:16 +01:00
Jonas Schievink
5d66bfe163 Shorten *all* qualified paths when adding use 2020-06-13 19:12:05 +02:00
Jonas Schievink
b65c0a5893 Expose find_insert_use_container 2020-06-13 19:05:46 +02:00
Jonas Schievink
7e83ed99a8 Respect casing when searching for imports 2020-06-10 16:04:55 +02:00
Jonas Schievink
781b514e58 Add test for macro generated items 2020-06-10 12:38:58 +02:00
Jonas Schievink
a70a0ca73c ImportsLocator: use ImportMap for non-local crates 2020-06-10 12:38:58 +02:00
Aleksey Kladov
8cad7d1a2b Use correct indent when replacing with match 2020-06-09 12:38:47 +02:00
Aleksey Kladov
53cc2c16e7 Unwrap block works with match arms 2020-06-09 11:52:45 +02:00
Aleksey Kladov
5233766ce5 Simplify unwrapping of blocks 2020-06-09 11:33:28 +02:00
Aleksey Kladov
38fa4d17fb Simplify API 2020-06-09 00:01:53 +02:00
bors[bot]
3a7c218fd4
Merge #4576
4576: Add implementation of extract struct from enum variant r=matklad a=mcrakhman

Hi guys! I implemented the extraction functionality including modifying multiple files. The only thing I didn't change the cursor position. I've done it with a previous API, but now snippets have been introduced and I need to figure out how to do it.

Please bear in mind that I am a newcomer in the rust-analyzer (and also Rust) world, so I tried to implement the feature to the best of my knowledge, but the API is very new to me, so I am very welcome to introducing changes etc. 

Co-authored-by: Mikhail Rakhmanov <rakhmanov.m@gmail.com>
2020-06-08 16:28:48 +00:00
Florian Diebold
a4a4a1854e Fix type parameter defaults
They should not be applied in expression or pattern contexts, unless there are
other explicitly given type args.
2020-06-05 20:09:13 +02:00
Mikhail Rakhmanov
5dda995538 Fix review comments 2020-06-05 13:17:17 +02:00
Mikhail Rakhmanov
74c3e7a1ad Remove unnecessary return 2020-06-05 11:45:41 +02:00
Jess Balint
921306757b introduce_named_lifetime assist wasn't applicable when type parameter
followed anonymous lifetime token

(fixes #4684)
2020-06-04 17:31:21 -05:00
Mikhail Rakhmanov
b0c8a2be7b Remove AsName import 2020-06-04 10:03:44 +02:00