Commit graph

3866 commits

Author SHA1 Message Date
Aleksey Kladov
a136cc0653 introduce ra_hir_def 2019-10-30 12:27:54 +03:00
Aleksey Kladov
56bc874f1d move ty interning to ty 2019-10-30 11:18:38 +03:00
bors[bot]
8046f5b24a
Merge #2125
2125: don't add macro braces in use items r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-30 07:40:23 +00:00
Aleksey Kladov
d7a7da8261 don't add macro braces in use items 2019-10-30 10:39:12 +03:00
kjeremy
3c140050ff Profile all request handlers 2019-10-29 16:08:36 -04:00
kjeremy
4ca5d4c353 Add missing test for label 2019-10-29 15:25:31 -04:00
Florian Diebold
47cfdb4aa3 Don't add a space after the opening brace in autoimport 2019-10-29 18:14:15 +01:00
kjeremy
eb220a081b Primitive signature help for mbe 2019-10-29 12:16:55 -04:00
bors[bot]
de16f94ada
Merge #2103
2103: Expand signature help r=matklad a=kjeremy

Signature help using call syntax with tuple structs and enum variants

Fixes #2102.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-29 13:48:26 +00:00
kjeremy
b915bf2d05 SigKind -> CallableKind 2019-10-29 09:46:55 -04:00
bors[bot]
e38cdf6e56
Merge #2114
2114: Move macro expansion to a separate crate r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-29 13:19:45 +00:00
Aleksey Kladov
bca708ba4c cleanup 2019-10-29 16:19:08 +03:00
Aleksey Kladov
99b6ecfab0 switch expand to dyn Trait 2019-10-29 16:12:54 +03:00
Aleksey Kladov
3260639608 reduce visibility 2019-10-29 16:08:06 +03:00
Aleksey Kladov
1ec418c3b8 add doc comment 2019-10-29 16:03:29 +03:00
Aleksey Kladov
7de6eaa58a remove not that useful indirection 2019-10-29 16:01:14 +03:00
Aleksey Kladov
b8b7969bfb remove empty module 2019-10-29 15:53:25 +03:00
Aleksey Kladov
2a5254c106 reduce visibility 2019-10-29 15:25:46 +03:00
Aleksey Kladov
d095d9273e remove unused query 2019-10-29 15:22:20 +03:00
Aleksey Kladov
858dd48af2 less generics 2019-10-29 15:20:08 +03:00
Aleksey Kladov
6bf7faf315 flatten hir_expand 2019-10-29 15:11:42 +03:00
Aleksey Kladov
dba767802d make file id repr private again 2019-10-29 15:01:55 +03:00
Florian Diebold
632a22ae62 Upgrade Chalk, make use of TypeName::Error variant 2019-10-29 13:01:33 +01:00
Aleksey Kladov
5b803055b7 rename hir_def -> hir_expand 2019-10-29 14:59:55 +03:00
Aleksey Kladov
5413875644 move expansion-related code to a separate crate 2019-10-29 14:55:39 +03:00
Aleksey Kladov
77f90caf2d start ra_hir_def crate 2019-10-29 11:15:51 +03:00
bors[bot]
120000609a
Merge #2111
2111: Fix autoimport not choosing the deepest use tree in some situations r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-10-28 19:32:52 +00:00
Florian Diebold
6d1b4ffa2e Fix autoimport not choosing the deepest use tree in some situations 2019-10-28 19:08:56 +01:00
Aleksey Kladov
54d3e47318 weaken requirements of AstDef 2019-10-28 20:29:57 +03:00
kjeremy
01238a6fd7 Filter out non callable versions of Struct/EnumVariant 2019-10-28 10:48:40 -04:00
Jeremy Kolb
ddf25e9481 formatting 2019-10-28 08:42:17 -04:00
Aleksey Kladov
5a6db3ca29 fix parsing of for loops inside expressions
closes #2051
2019-10-28 15:41:34 +03:00
Jeremy Kolb
44f2805fee Fix syntax 2019-10-28 08:32:23 -04:00
Jeremy Kolb
49e89772f6 Preliminary enum variant support 2019-10-28 08:32:22 -04:00
Jeremy Kolb
55d4b06a53 Add disciminant 2019-10-28 08:32:22 -04:00
Jeremy Kolb
5a59bc9fcb WIP: Expand signature help
This is hacky but works for tuple structs. Proof of concept.
2019-10-28 08:32:22 -04:00
bors[bot]
02828520a7
Merge #2097
2097: Be more precise with function signatures r=matklad a=kjeremy

Finds the closest call expr.

Fixes #2093

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-10-28 11:53:16 +00:00
Jeremy Kolb
1438f38eb6 Preserve whitespace at the end of doc comments
Whitespace can have special meaning in markdown. For instance
ending a line with three spaces will render a new line.
Note that this behavior diverges from RLS.

Fixes #1997
2019-10-27 16:56:25 -04: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
Jeremy Kolb
a0d55edc38 Be more precise with function signatures
Fixes #2093
2019-10-27 12:26:44 -04: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
Alexander Elís Ebenesersson
3e7e3fdf16 extend selection in trait bound extends to plus
When multiple traits bounds are present, expanded selection
from a single trait bound will include the nearest plus sign
(and whitespace after) before including the whole trait bound.
2019-10-27 21:29:06 +09:00
Aleksey Kladov
8464c45086 remove relative_path_buf workaround
The upstream problem was fixed with the change to 1.0
2019-10-27 12:36:40 +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
431e4ff4ef avoid TextEditorBuilder for simple edits 2019-10-26 20:09:56 +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
Florian Diebold
b342ee5616 Upgrade Chalk (without using its dyn/impl Trait support) 2019-10-26 15:11:39 +02:00
Aleksey Kladov
d385438bcc generate more assists docs 2019-10-25 23:38:15 +03:00
bors[bot]
c48b467eff
Merge #2069
2069: auto-generate assists docs and tests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-25 11:50:06 +00:00
Aleksey Kladov
0dd35ff2b2 auto-generate assists docs and tests 2019-10-25 14:47:48 +03:00
bors[bot]
5f779f6c46
Merge #2066
2066: insert space after `->` r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-25 11:24:43 +00:00
Laurențiu Nicola
27a0cb3025 Specify working chalk revisions in manifest 2019-10-25 13:33:14 +03:00
Aleksey Kladov
d5cd8b5be2 disable the new typing handler for ->
It doesn't actually work with LSP
2019-10-25 13:03:57 +03:00
Aleksey Kladov
53e3bee0cf insert space after -> 2019-10-25 12:41:34 +03:00
Aleksey Kladov
ea948e9fbb refactor typing_handlers 2019-10-25 12:04:17 +03:00
Aleksey Kladov
6f00bb1cb0 introduce SingleFileChange 2019-10-25 11:49:38 +03:00
Aleksey Kladov
b112430ca7 move source change to a dedicated file 2019-10-25 11:30:50 +03:00
Aleksey Kladov
8d2fd59cfb make typing infra slightly more extensible 2019-10-25 11:30:46 +03:00
Aleksey Kladov
dc65219ae1 document feature flags 2019-10-25 09:00:30 +03:00
kjeremy
64c1dd10b8 bump insta 2019-10-24 10:35:22 -04:00
bors[bot]
95cf5c86fa
Merge #2059
2059: for highlighting, search only the current file r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-24 11:17:03 +00:00
Aleksey Kladov
4529da906d for highlighting, search only the current file 2019-10-24 14:16:36 +03:00
Aleksey Kladov
6d186ec3be add search scope stuct 2019-10-24 13:41:25 +03:00
Aleksey Kladov
5750ee69ff add --with-deps option to analysis-stats 2019-10-24 12:32:19 +03:00
Aleksey Kladov
ac1b7b07e7 add some profiling calls 2019-10-24 10:37:20 +03:00
Aleksey Kladov
418fbc8662 don't die if a sync task panics 2019-10-24 09:56:30 +03:00
Aleksey Kladov
baa968e71c show unaccounted for time in profiling 2019-10-24 09:14:33 +03:00
Aleksey Kladov
b5f13d8d51 xtask: move codegen to a module 2019-10-23 18:57:18 +03:00
bors[bot]
edf4d8e555
Merge #2049
2049: add couple of profiling calls r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-23 15:44:40 +00:00
Aleksey Kladov
f5bf7f29b5 add couple of profiling calls 2019-10-23 18:26:43 +03:00
Aleksey Kladov
afc6ee251d minor cleanup 2019-10-23 17:41:15 +03:00
Aleksey Kladov
68ea9bd1bf restore assert 2019-10-23 11:31:16 +03:00
Ekaterina Babshukova
decfd28bd1 some fixes, add docs 2019-10-23 00:35:06 +03:00
Ekaterina Babshukova
b5a3ee93e2 support items that visible to the parent module 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
55e1910d00 classify module from declaration 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
93c179531b fix highlighting 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
328be5721a remove SearchScope 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
88ff88d318 use Lazy, some fixes 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
19fbf2c16b remove unreachable!() 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
835173d065 replace trait by a bunch of functions 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
d26d0ada50 restructure a bit 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
0dd08b8023 classify definition of a function right 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
79e6b3b0d1 make handle_references accept refs from other files 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
df8441b24e some fixes, add tests 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
5b03773fbe implement search of references 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
01853e8d6c find scope for Declaration item 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
121aa35f12 return Declaration from classify_name_ref 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
83f780eabf return Declaration from classify_name 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
0b5d0a41fd replace a chain of if let by macro 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
d6ae1b5f0f refactor name_ref_kind.rs 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
11577288c2 initial classify_name 2019-10-22 23:47:31 +03:00
bors[bot]
c15ee97fff
Merge #2046
2046: Bump crates r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-22 17:22:09 +00:00
bors[bot]
ba95de936d
Merge #1933
1933: Adds "replace with guarded return" assist r=matklad a=mikhail-m1

first draft for #1782. I'm pretty sure I missed something.

Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2019-10-22 17:10:17 +00:00
kjeremy
e9bab85b65 Bump crates 2019-10-22 13:01:26 -04:00
bors[bot]
8f4480d180
Merge #2044
2044: Fixup folding ranges for clients with lineFoldingOnly=true r=matklad a=ztlpn

Fixes #2033 

Co-authored-by: Alex Zatelepin <mvzp10@gmail.com>
2019-10-22 07:57:37 +00:00
Alex Zatelepin
6d105ccd93 add test #2033 2019-10-21 22:34:44 +03:00
Alex Zatelepin
9d5e932626 fixup folding ranges for "lineFoldingOnly" clients #2033 2019-10-21 21:35:42 +03:00
oxalica
24d50ebcd1
Guess macro braces from docs 2019-10-21 02:16:01 +08:00
Mikhail Modin
fb215dc192 Adds "replace with guarded return" assist 2019-10-20 19:14:32 +01:00
Aleksey Kladov
5376c769f0 rename tools -> xtask 2019-10-17 23:14:05 +03:00
Aleksey Kladov
7b15c4f7ae WIP: move to xtasks 2019-10-17 22:54:38 +03:00
kjeremy
c3045c68a9 relative-path 1.0 2019-10-17 13:08:33 -04:00
Laurențiu Nicola
a6b980d6d4 Bump deps 2019-10-17 18:08:11 +03:00
bors[bot]
762fce5bdd
Merge #2012
2012: #1435 postfix completion for integer literals r=matklad a=pasa

Fix for #1435 Incorrect postfix completion for integer literals

Co-authored-by: Sergey Parilin <parilinsa@gmail.com>
2019-10-17 11:21:00 +00:00
bors[bot]
84d9fd1864
Merge #1998
1998: No need to make config pub r=matklad a=kjeremy

Just a drive by

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-17 11:10:25 +00:00
Aleksey Kladov
260ae2dbc9 minor cleanup 2019-10-16 13:26:02 +03:00
Sergey Parilin
bec47e221f #1435 postfix completion for integer literals 2019-10-14 18:39:40 +03:00
bors[bot]
8e3864fd58
Merge #2008
2008: Prepare SourceDatabase API for lazy file loading r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-14 13:26:42 +00:00
Aleksey Kladov
abf2179c0b Prepare SourceDatabase API for lazy file loading 2019-10-14 16:23:55 +03:00
bors[bot]
e182825170
Merge #2006
2006: Improvements around `Arc<[T]>` r=matklad a=sinkuu

First commit tries to avoid cloning `Arc<[T]>` to a temporary `Vec` for mutating it, if there are no other strong references. Second commit utilizes [`FromIterator for Arc<[T]>`](https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-FromIterator%3CT%3E) instead of `.collect::<Vec<_>>().into()` to avoid allocation in `From<Vec<T>> for Arc<[T]>`.

Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-10-14 13:14:18 +00:00
bors[bot]
1f4fbc0035
Merge #2007
2007: remove one more dependency on source roots r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-14 12:22:54 +00:00
Aleksey Kladov
1555a1aa0d remove one more dependency on source roots 2019-10-14 15:15:47 +03: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
Shotaro Yamada
e4ffa79b3e Enable serde feature in ra_syntax/Cargo.toml 2019-10-14 19:56:29 +09:00
Shotaro Yamada
3a55b5bf01 make_mut_slice 2019-10-14 19:50:12 +09: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
bors[bot]
85361e8d50
Merge #2000
2000: Use correct db type r=matklad a=kjeremy

I think this is more correct. No test fallouts.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-14 09:34:29 +00:00
Shotaro Yamada
b462eb96b8 import make_mut_arc_slice 2019-10-14 17:21:38 +09:00
Shotaro Yamada
965ca0d271 .collect() directly into Arc<[T]> 2019-10-14 14:25:05 +09:00
Shotaro Yamada
f8d4cdc170 Avoid cloning Arc<[T]> into a vec if possible 2019-10-14 14:25:05 +09:00
Aleksey Kladov
c00f298fd2 add syntax-tree based indents 2019-10-12 22:07:47 +03:00
Florian Diebold
2955fbc7e1 Split up infer.rs further
- coercion logic goes to `coerce.rs`
 - expression inference goes to `expr.rs`
 - pattern inference goes to `pat.rs`
2019-10-12 18:41:11 +02:00
Shotaro Yamada
5ca6281164 Remove unused dependencies 2019-10-12 08:00:54 +09:00
Shotaro Yamada
8c72c00abd Remove smol_str dependency from ra_syntax 2019-10-12 07:48:23 +09:00
kjeremy
a1d631da4f Use correct db type 2019-10-11 15:56:17 -04:00
kjeremy
53d1673edc use any() 2019-10-11 15:55:45 -04:00
kjeremy
04963fa14d No need to make config pub 2019-10-11 15:13:15 -04:00
bors[bot]
0896ca04c4
Merge #1989
1989: Chalk update to simplified IR r=flodiebold a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-11 11:12:27 +00:00
Aleksey Kladov
ebca677180 reduce visibility 2019-10-11 11:37:54 +03:00
bors[bot]
f70c54ccfb
Merge #1994
1994: remove last traces of source roots from hir r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-11 07:49:39 +00:00
Aleksey Kladov
e44c7ce200 remove last traces of source roots from hir 2019-10-11 10:48:46 +03:00
Shotaro Yamada
0d0a444d43 Remove as_original_file 2019-10-11 06:53:43 +09:00
Shotaro Yamada
04741ae2bc Use original_file instead of as_original_file 2019-10-11 06:50:53 +09:00
kjeremy
4ba2c5b2de Chalk update to simplified IR 2019-10-10 14:51:50 -04:00
bors[bot]
da190278e9
Merge #1981
1981: tweak fn labels in completion r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-10 15:15:46 +00:00
Aleksey Kladov
8d3d5cbdb0 tweak fn labels in completion 2019-10-10 18:09:14 +03:00
Aleksey Kladov
29e83988be don't special case macro_use 2019-10-10 17:48:30 +03:00
Aleksey Kladov
89826a50fc don't special case path attr 2019-10-10 17:42:29 +03:00
Aleksey Kladov
b36b8970cc simplify a bit 2019-10-10 17:23:01 +03:00
Aleksey Kladov
5140283277 simplify some tests 2019-10-10 14:51:35 +03:00
Aleksey Kladov
ce0d4a3b1d Refactor and fix some more edge cases around name resolution 2019-10-10 14:46:14 +03:00
Aleksey Kladov
31561b118f if completion does auto-insertion, indicate this in the label 2019-10-10 13:18:42 +03:00
Ekaterina Babshukova
aa2f58550a add module methods 2019-10-09 14:59:47 +03:00
bors[bot]
afc871199d
Merge #1973
1973: add <> for type aliases as well r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-09 08:54:00 +00:00
Aleksey Kladov
d9f83d9b16 add <> for type aliases as well 2019-10-09 11:53:32 +03:00
Aleksey Kladov
048be5d9a3 smal cleanup 2019-10-09 11:26:41 +03:00
bors[bot]
b976772566
Merge #1972
1972: extend selection correctly handles commas in tuples r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-09 08:26:31 +00:00
Aleksey Kladov
8d65530843 extend selection correctly handles commas in tuples 2019-10-09 11:26:09 +03:00
Aleksey Kladov
e0b1c17dcb add <> when completing generic types 2019-10-08 21:14:52 +03:00
Aleksey Kladov
f4fa98b1bf simplify 2019-10-08 20:34:30 +03:00
Aleksey Kladov
5144f3b22f refactor 2019-10-08 20:33:43 +03:00
Aleksey Kladov
2f85a640a2 refactor 2019-10-08 20:32:19 +03:00
bors[bot]
06a8deae4a
Merge #1969
1969: restore coloring of attributes r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-08 11:55:27 +00:00
Aleksey Kladov
6503add6e3 restore coloring of attributes 2019-10-08 14:52:03 +03:00
bors[bot]
92cf0eba93
Merge #1924
1924: Support inferring&completing `Self` type in enum/struct/union definitions r=ice1000 a=ice1000

Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>

An attempt to fix #1908.
This code works, but I believe the implementation is ugly. Please give me suggestions!

Co-authored-by: ice1000 <ice1000kotlin@foxmail.com>
2019-10-08 11:46:14 +00:00
Aleksey Kladov
857f419c9d hard-code nightly-only CFGs 2019-10-08 14:43:29 +03:00
Aleksey Kladov
972079c0e3 macro DSL for cfg in tests 2019-10-08 14:39:44 +03:00
ice1000
b043358be9 Address comments: fix docs, add completion test for Self. 2019-10-08 07:32:41 -04:00
Aleksey Kladov
355419d404 use slightly more idiomatic api for cfg 2019-10-08 14:22:49 +03: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
bors[bot]
d9338dfa98
Merge #1951
1951: Lower the precedence of the `as` operator. r=matklad a=goffrie

Previously, the `as` operator was being parsed like a postfix expression, and
therefore being given the highest possible precedence. That caused it to bind
more tightly than prefix operators, which it should not. Instead, parse it
somewhat like a normal binary expression with some special-casing.

Fixes #1851.

Co-authored-by: Geoffry Song <goffrie@gmail.com>
2019-10-08 08:44:26 +00:00
ice1000
6bad638928 Support inferring Self type in enum definitions
Signed-off-by: ice1000 <ice1000kotlin@foxmail.com>
2019-10-07 19:40:14 -04:00
Geoffry Song
b4fe06bc17 Move tests around 2019-10-05 16:33:05 -07:00
bors[bot]
d3872964f8
Merge #1960
1960: Replace AST visitors with macro r=viorina a=viorina

Fixes #1672.

Co-authored-by: Ekaterina Babshukova <ekaterina.babshukova@yandex.ru>
2019-10-05 14:54:25 +00:00
Ekaterina Babshukova
311dbb8545 remove visitor module 2019-10-05 17:48:31 +03:00
bors[bot]
ae6305b90c
Merge #1928
1928: Support `#[cfg(..)]` r=matklad a=oxalica

This PR implement `#[cfg(..)]` conditional compilation. It read default cfg options from `rustc --print cfg` with also hard-coded `test` and `debug_assertion` enabled.
Front-end settings are **not** included in this PR.

There is also a known issue that inner control attributes are totally ignored. I think it is **not** a part of `cfg` and create a separated issue for it. #1949

Fixes #1920 

Related: #1073 


Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com>
Co-authored-by: oxalica <oxalicc@pm.me>
2019-10-05 14:25:59 +00:00
Ekaterina Babshukova
2fc2290173 replace AST visitors with macro 2019-10-05 17:03:03 +03:00
oxalica
c6303d9fee
Use raw cfgs in json project and fix typo 2019-10-05 20:55:27 +08: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
Geoffry Song
9638adaa40 Fix parsing of block expressions in "forbid_structs" contexts.
Forbidding block expressions entirely is too strict; instead, we should only
forbid them in contexts where we are parsing an optional RHS (i.e. the RHS of a
range expression).
2019-10-03 00:39:52 -07:00
Geoffry Song
b63f260bbc Lower the precedence of the as operator.
Previously, the `as` operator was being parsed like a postfix expression, and
therefore being given the highest possible precedence. That caused it to bind
more tightly than prefix operators, which it should not. Instead, parse it
somewhat like a normal binary expression with some special-casing.
2019-10-03 00:27:09 -07:00
bors[bot]
e1c3675951
Merge #1945
1945: Handle divergence in type inference for blocks r=flodiebold a=lnicola

Fixes #1944.

The `infer_basics` test is failing, not sure what to do about it.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-10-02 18:57:20 +00:00
uHOOCCOOHu
b271cb18d5
Add docs 2019-10-03 02:50:22 +08:00
uHOOCCOOHu
1067a1c5f6
Read default cfgs from rustc 2019-10-03 02:28:03 +08:00
uHOOCCOOHu
e0100e63ae
Optimize 2019-10-03 02:28:03 +08:00
uHOOCCOOHu
43f09ad36c
Refactor CfgOptions inside 2019-10-03 02:28:02 +08:00