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