Commit graph

673 commits

Author SHA1 Message Date
bors[bot]
4567ae575e
Merge #5554
5554: Fix remove_dbg r=matklad a=petr-tik

Closes #5129 

Addresses two issues:
- keep the parens from dbg!() in case the call is chained or there is
semantic difference if parens are excluded
- Exclude the semicolon after the dbg!(); by checking if it was
accidentally included in the macro_call

investigated, but decided against:
fix ast::MacroCall extraction to never include semicolons at the end -
this logic lives in rowan.

Defensively shorten the macro_range if there is a semicolon token.
Deleted unneccessary temp variable macro_args

Renamed macro_content to "paste_instead_of_dbg", because it isn't a
simple extraction of text inside dbg!() anymore

Co-authored-by: petr-tik <petr-tik@users.noreply.github.com>
2020-07-29 21:59:03 +00:00
petr-tik
6ea393a8d1 Addressed code review
replaced match with let-if variable assignment
removed the unnecessary semicolon_on_end variable
converted all code and expected test variables to raw strings
and inlined them in asserts
2020-07-29 22:12:53 +01:00
Aleksey Kladov
76202a2c73 Rename NomialDef -> AdtDef 2020-07-29 19:22:15 +02:00
petr-tik
6ea28c3779 Fixed #5129
Addresses two issues:
- keep the parens from dbg!() in case the call is chained or there is
semantic difference if parens are excluded
- Exclude the semicolon after the dbg!(); by checking if it was
accidentally included in the macro_call

investigated, but decided against:
fix ast::MacroCall extraction to never include semicolons at the end -
this logic lives in rowan.

Defensively shorten the macro_range if there is a semicolon token.
Deleted unneccessary temp variable macro_args

Renamed macro_content to "paste_instead_of_dbg", because it isn't a
simple extraction of text inside dbg!() anymore
2020-07-27 22:17:15 +01:00
petr-tik
01bdeaad71 Make all test fn names consistent in remove_dbg 2020-07-27 21:28:41 +01:00
petr-tik
63751d1c6b Added failing tests 2020-07-27 21:28:07 +01:00
Matthias Krüger
29d3d04227 assists: change_return_type_to_result: clarify assist description
I had a -> Option<PathBuf> fn, which I wanted to change to Result<PathBuf, _>, but despite advertising to do so, the assist did not
change the result type to Result<PathBuf, _> but instead just wrapped it in a Result: <Result<Option<PathBuf>, _>.

I changed the assist description to "Wrap return type in Result" to clarify that the assist only wraps the preexisting type and does
not do any deep Option-to-Result refactoring.
2020-07-22 22:44:31 +02:00
Timo Freiberg
3d9c123104 Replace existing visibility modifier in fix_visibility 2020-07-21 18:58:00 +02:00
Aleksey Kladov
be8a7048df Cleanup extact variable 2020-07-21 18:10:03 +02:00
Aleksey Kladov
3bb1b3070a minor 2020-07-21 17:50:19 +02:00
Jeremy Kolb
17f4d27f12 Minor perf tweaks per clippy 2020-07-19 14:26:24 -04:00
Aleksey Kladov
a28aa175d4 Add turbo-fish works after () 2020-07-18 14:48:28 +02:00
Aleksey Kladov
7c082dcf0f More precise ranges in remove hashes assist 2020-07-17 16:39:03 +02:00
bors[bot]
b63e23e98e
Merge #5350
5350: Filter assists r=matklad a=kjeremy

Uses the `CodeActionContext::only` field to compute only those assists the client cares about.

It works but I don't really like the implementation.

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-15 17:58:46 +00:00
Jeremy Kolb
21c1504ca9 Move allow list into AssistConfig 2020-07-15 09:45:30 -04:00
Jonas Schievink
85f5cbc9dc Move remove_bounds to edit.rs 2020-07-14 13:33:37 +02:00
Jonas Schievink
0f654b06ab missing impl members: remove assoc. type bounds 2020-07-14 13:12:16 +02:00
Yuki Okushi
6f423466d1
Add a license field to all the crates 2020-07-14 10:57:26 +09:00
kjeremy
aa598ecb75 Filter assists 2020-07-13 17:41:47 -04:00
Aleksey Kladov
d9fd7ca6a5 change vis works on statics 2020-07-12 01:49:51 +02:00
Aleksey Kladov
a482eb0cd8 Better caret placement when filling match arms 2020-07-10 18:22:04 +02:00
Aleksey Kladov
68706b59c9 Don't mess with cursor position when adding hashes 2020-07-09 19:21:41 +02:00
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