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
uHOOCCOOHu
a49ad47e5a
Support cfg attribute on impl blocks
2019-10-03 02:28:02 +08:00
uHOOCCOOHu
d2ea776b8f
Enable CfgOptions test
for workspace crates
2019-10-03 02:28:02 +08:00
uHOOCCOOHu
b1ed887d81
Introduce ra_cfg to parse and evaluate CfgExpr
2019-10-03 02:28:02 +08:00
uHOOCCOOHu
ffe179a736
Pass attributes as token tree to DefCollector
2019-10-03 02:27:11 +08:00
kjeremy
b4e6939760
Update pico-args
2019-10-02 10:58:15 -04:00
Laurențiu Nicola
f491567fb3
Handle divergence in type inference for blocks
2019-10-02 17:31:34 +03: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
a47bca636c
Change user message.
2019-09-30 13:31:28 +03:00
Alexander Andreev
506222a9b1
Drop debug strings.
2019-09-30 12:09:56 +03: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
f7e12559cb
Fixes
2019-09-30 16:17:54 +08:00
uHOOCCOOHu
5a4b4f507e
Fix API of Attr
2019-09-30 16:17:53 +08:00
uHOOCCOOHu
71efdaa636
Parse correct AttrInput
2019-09-30 16:11:40 +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
Aleksey Kladov
054c53aeb9
move remove bounds to ast/edit.rs
2019-09-30 09:56:20 +03:00
Aleksey Kladov
e010b144d5
move field list to ast/edit.rs
2019-09-30 09:27:26 +03:00
Geobert Quach
e293c34e85
feat(assists): Keep only one version of make_raw_string
2019-09-29 19:16:59 +01:00
Aleksey Kladov
0840ec038b
migrate add impl items to the new editing API
2019-09-28 20:10:53 +03:00
Aleksey Kladov
5dbbfda34a
simplify strip attrs
2019-09-28 19:50:16 +03:00
Aleksey Kladov
e60677178e
correctly reset chalk state after a panic
2019-09-28 18:49:00 +03:00
Aleksey Kladov
35f1655b0b
replace horrible hack with a slightly less horrible one
2019-09-27 20:47:36 +03:00
bors[bot]
2b69c84396
Merge #1815
...
1815: Support correct `$crate` expansion in macros r=uHOOCCOOHu a=uHOOCCOOHu
This PR makes normal use cases of `$crate` from macros work as expected.
It makes more macros from `std` work. Type inference works well with `panic`, `unimplemented`, `format`, and maybe more.
Sadly that `vec![1, 2, 3]` still not works, but it is not longer an issue about macro.
Screenshot:
![Screenshot_20190927_022136](https://user-images.githubusercontent.com/14816024/65714465-b4568f80-e0cd-11e9-8043-dd44c2ae8040.png )
Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com>
2019-09-27 02:58:26 +00:00
uHOOCCOOHu
edadeb95be
Fix
2019-09-27 10:55:25 +08:00
Florian Diebold
daaf46177e
Add SubstsBuilder
...
+ further refactoring.
2019-09-26 23:03:39 +02:00
Geobert Quach
281e107155
feat(assists): Make raw string unescaped
2019-09-26 20:31:45 +01:00
Aleksey Kladov
d847d53e36
Start simplifying editing API
2019-09-26 22:22:08 +03:00
uHOOCCOOHu
2ecb126f5c
Support $crate
in item and expr place.
2019-09-27 02:05:06 +08:00
uHOOCCOOHu
8cd23a4fb8
Store crate info in MacroDefId
2019-09-27 02:05:06 +08:00
uHOOCCOOHu
128dc5355b
Refactor Name
ready for hygienic macro
2019-09-27 02:04:47 +08:00
Aleksey Kladov
1a4b424005
move diff to ra_syntax
2019-09-26 15:56:52 +03:00
Aleksey Kladov
183a38fb50
keep ast creation API simple
2019-09-26 15:29:28 +03:00
bors[bot]
d6bbdfefa7
Merge #1917
...
1917: disable periodic GC r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-09-26 09:33:18 +00:00
Aleksey Kladov
fabb32693f
disable periodic GC
...
There's hypothesis that it doesn't do anything useful now that we have
LRU...
2019-09-26 12:31:16 +03:00