Commit graph

26 commits

Author SHA1 Message Date
Andrea Pretto
e8f3c1650a auto_import: fix bug when the common path was shorter than both the current use and target path.
Shorter test names.
2019-02-14 21:58:36 +01:00
Andrea Pretto
6518fb2bf8 auto_import: import in enclosing module instead of file 2019-02-12 21:18:55 +01:00
Andrea Pretto
468e1d4c5e auto_import: more tests and some refactorings 2019-02-12 21:18:42 +01:00
Pascal Hertleif
4fd3613434 Fix some typos 2019-02-12 15:02:57 +01:00
Andrea Pretto
5c9c0d3ae2 ra_assists: assist "providers" can produce multiple assists 2019-02-11 18:07:21 +01:00
Ville Penttinen
710975ecd8 Fix typo in Cargo.toml authors
Fixes typo introduced in #782
2019-02-11 10:20:04 +02:00
Ville Penttinen
ab3d231b1d Update authors field in Cargo.tomls to "rust-analyzer developers"
This closes #777
2019-02-11 08:55:35 +02:00
bors[bot]
b952c270ee Merge #762
762: "Dumb" auto import assist r=matklad a=eulerdisk

This adds a new assist to "add xxx::yyy to the current file" when the cursor is on a PATH. It manages correctly nested imports,`self` keyword and creates new nested imports if necessary. [See the tests]
It doesn't use name resolution so in that sense is 'dumb', but I have plans to do that. That in the future will be useful to auto import trait names in autocompletion for example.

It can easily be extended to provide multiple actions to select in which scope to import. That's another thing I plan to do.

@matklad I copied some indentation code from `ide_light`, I don't know at the moment if/how you want to refactor that code. This assist was meant to be in `ide_light`.

Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
2019-02-10 19:00:36 +00:00
Ville Penttinen
7b9aefc29d Fix introduce var duplicating newlines
This fixes #713.

If the block before the statement we want to use introduce var on, had empty
lines these empty lines would also be added between the let-statement and
the current line where the new variable is used.

This fixes that by trimming excess newlines from the start of the indent chunk
and simply adding a single newline (when the chunk had newlines) between the
let-statement and the current statement. If there were no newlines this
matches the previous behaviour.
2019-02-09 13:52:01 +02:00
Andrea Pretto
1a4faaffd7 auto_import: use ra_fmt 2019-02-09 11:47:23 +01:00
Andrea Pretto
ee9b0c89e6 auto_import: struct variants for ImportAction 2019-02-09 11:30:09 +01:00
Andrea Pretto
1866fb2dda auto_import: remove PathSegmentsMatch 2019-02-09 11:30:09 +01:00
Andrea Pretto
6d8832359e auto_import: Removed Empty in favor of Partial(0)
auto_import: Removed unecessary lifetimes
2019-02-09 11:30:09 +01:00
Andrea Pretto
5580cf239d auto_import assist 2019-02-09 11:29:59 +01:00
bors[bot]
34398a8756 Merge #766
766: Formatting code into ra_fmt r=matklad a=eulerdisk

As discussed https://github.com/rust-analyzer/rust-analyzer/pull/762#discussion_r254905885

I did only move the code without other improvements.

Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
2019-02-09 09:56:54 +00:00
robojumper
4fdeb54bb5 Improve sorting delegate 2019-02-09 01:57:08 +01:00
robojumper
a70589712a Remove unused import 2019-02-09 00:54:07 +01:00
robojumper
3be98f2ac9 Add tests for action target ranges 2019-02-09 00:34:26 +01:00
robojumper
a3622eb629 Add some assist ranges 2019-02-08 22:43:13 +01:00
Andrea Pretto
02dd0cfd8c Refactor formatting code out of ra_ida_api_light into ra_fmt. 2019-02-08 18:58:27 +01:00
Aleksey Kladov
12e3b4c70b reformat the world 2019-02-08 14:49:43 +03:00
Ville Penttinen
be7c5eecc4 Remove unnecessary dbg! calls 2019-02-07 20:42:00 +02:00
Ville Penttinen
6cbf83c946 Add new assist to remove dbg!() calls
This fixes #758.

Currently we try to maintain the cursor position relative to the statement under
cursor, if the cursor is inside the dbg! macro call.

Meaning:

let foo = dbg!(some.complex<|>().expression());

Should turn into:

let foo = some.complex<|>().expression();

With the cursor staying in place.
2019-02-07 20:34:33 +02:00
kjeremy
6753051a45 Some clippy cleanups 2019-02-06 15:50:26 -05:00
kjeremy
bcbee10b89 assists: compute edit 2019-02-06 11:15:18 -05:00
Aleksey Kladov
0c5fd8f7cb move assists to a separate crate 2019-02-06 17:00:00 +03:00