Aleksey Kladov
59e1207dac
Better folder structure
2020-02-18 11:56:18 +01:00
Veetaha
053ccf4121
ra_syntax: fix reparsing merging errors, also now reparse_token() reports errors
2020-02-18 02:11:16 +02:00
Kirill Bulatov
e29dbdb139
Simplify the command execution
2020-02-18 00:38:01 +02:00
Kirill Bulatov
67d30312d0
Simplify the code further
2020-02-18 00:18:26 +02:00
Kirill Bulatov
addb61df36
Idempotent location and installation of rust src
2020-02-18 00:07:15 +02:00
Kirill Bulatov
5cea8a37b7
Install rust-src when it is not found
2020-02-17 23:40:34 +02:00
Veetaha
fc5e7b8807
ra_syntax: migrate test data to 0-length text-range of SyntaxError when constructed from TextUnit
2020-02-17 23:14:31 +02:00
Veetaha
cd8e56c580
ra_syntax: remove message() method and use only Display trait in SyntaxError as per matklad
2020-02-17 23:13:38 +02:00
Veetaha
e05eb631d4
ra_syntax: change module-level documentation for syntax_error to "see X" as per matklad
2020-02-17 22:50:58 +02:00
Veetaha
b510e77fbe
ra_syntax: followup fix for making SyntaxError::range() to return by value
2020-02-17 22:24:38 +02:00
Veetaha
e00922d113
ra_syntax: SyntaxError::range() now returns by value
2020-02-17 22:24:38 +02:00
Veetaha
acdab6f0f2
ra_syntax: moved reexport declaration after imports as per matklad
2020-02-17 22:24:38 +02:00
Veetaha
6ae4850c89
ra_syntax: Apply Aleksei Kladov suggestion about TextRange of TextUnit
...
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-17 22:24:33 +02:00
Veetaha
c58276673a
Change semmantical analyzis to tree validation as per @matklad
...
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-17 22:24:33 +02:00
Veetaha
9fdf984958
ra_syntax: reshape SyntaxError for the sake of removing redundancy
2020-02-17 22:24:33 +02:00
Laurențiu Nicola
b6b8fd9525
Replace ra_cli mentions
2020-02-17 22:07:24 +02:00
Aleksey Kladov
2c9b91ad32
Merge ra_vfs_glob and ra_lsp_server
2020-02-17 19:07:30 +01:00
Aleksey Kladov
659b0e73cf
Merge cli and ra_lsp_server
2020-02-17 19:03:03 +01:00
Aleksey Kladov
2d1b3da5fb
Use anyhow
2020-02-17 18:19:25 +01:00
Aleksey Kladov
8e86d12771
Cleanup
2020-02-17 18:15:19 +01:00
Aleksey Kladov
06e37b273e
Better name
2020-02-17 18:10:15 +01:00
Aleksey Kladov
3ef916061b
More precise types
2020-02-17 18:09:07 +01:00
Aleksey Kladov
c818f5c65e
Unify verbosity handling
2020-02-17 18:05:45 +01:00
Aleksey Kladov
fa482a9fee
Move interesting stuff to main
2020-02-17 18:03:48 +01:00
Aleksey Kladov
a51b2603f9
Stronger Types
2020-02-17 18:02:59 +01:00
Aleksey Kladov
017f0e4e53
Refactor arg parsing
2020-02-17 18:02:10 +01:00
Aleksey Kladov
90e61ac75d
Sort deps
2020-02-17 17:41:53 +01:00
Aleksey Kladov
d7be1da8df
Inline ra_batch
2020-02-17 17:32:17 +01:00
Aleksey Kladov
559c5f37f6
Cleanup imports
2020-02-17 17:19:55 +01:00
Aleksey Kladov
d5371b5dec
Inline help
2020-02-17 17:18:45 +01:00
Aleksey Kladov
0353e1c6f4
Use Arguments::from_os
2020-02-17 17:12:37 +01:00
Aleksey Kladov
57140f1730
Drop proptest tests
...
It takes waaay to long to compile.
We should add quickcheck tests when we touch the relevant code next
time.
2020-02-17 16:57:06 +01:00
bors[bot]
fcf15cc05a
Merge #3169
...
3169: Show record field names in Enum completion r=flodiebold a=adamrk
Adresses https://github.com/rust-analyzer/rust-analyzer/issues/2947 .
Previously the details shown when autocompleting an Enum variant would look like the variant was a tuple even if it was a record:
![2020-02-16-15:59:32_crop](https://user-images.githubusercontent.com/16367467/74607233-64f21980-50d7-11ea-99db-e973e29c71d7.png )
This change will show the names of the fields for a record and use curly braces instead of parentheses:
![2020-02-16-15:33:00_crop](https://user-images.githubusercontent.com/16367467/74607251-8ce17d00-50d7-11ea-9d4d-38d198a4aec0.png )
This required exposing the type `adt::StructKind` from `ra_hir` and adding a function
```
kind(self, db: &impl HirDatabase) -> StructKind
```
in the `impl` of `EnumVariant`.
There was also a previously existing function `is_unit(self, db: &impl HirDatabase) -> bool` for `EnumVariant` which I removed because it seemed redundant after adding `kind`.
Co-authored-by: adamrk <ark.email@gmail.com>
2020-02-17 10:54:32 +00:00
adamrk
0e260aa6b1
use 'if let' instead of match on kind in lower.rs
2020-02-17 11:53:12 +01:00
bors[bot]
93d28fb50c
Merge #3099
...
3099: Init implementation of structural search replace r=matklad a=mikhail-m1
next steps:
* ignore space and other minor difference
* add support to ra_cli
* call rust parser to check pattern
* documentation
original issue #2267
Co-authored-by: Mikhail Modin <mikhailm1@gmail.com>
2020-02-17 10:02:54 +00:00
bors[bot]
8d8d542dfa
Merge #3108
...
3108: Magic Completion for `impl Trait for` Associated Items r=matklad a=kdelorey
# Summary
This PR adds a set of magic completions to auto complete associated trait items (functions/consts/types).
![Associated Trait Impl](https://user-images.githubusercontent.com/2295721/74493144-d8f1af00-4e96-11ea-93a4-82725bf89646.gif )
## Notes
Since the assist and completion share the same logic when figuring out the associated items that are missing, a shared utility was created in the `ra_assists::utils` module.
Resolves #1046
As this is my first PR to the rust-analyzer project, I'm new to the codebase, feedback welcomed!
Co-authored-by: Kevin DeLorey <2295721+kdelorey@users.noreply.github.com>
2020-02-17 09:34:08 +00:00
bors[bot]
953dbe3e02
Merge #3181
...
3181: Add ability to pass additional arguments to rustfmt. r=matklad a=Leonqn
relates to #2848
Co-authored-by: Ilya Titkov <ilya@titkov.me>
2020-02-17 09:05:01 +00:00
bors[bot]
c9989a524c
Merge #3153
...
3153: When a single test is run, do not run others with overlapping names r=matklad a=SomeoneToIgnore
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-17 08:52:45 +00:00
Ilya Titkov
a2b0bdcc24
Add arguments to rustfmt
2020-02-17 11:44:58 +03:00
bors[bot]
daffdd8674
Merge #3179
...
3179: Introduce AsMacroCall trait r=matklad a=edwin0cheng
This PR introduce `AsMacroCall` trait to help convert `ast::MacroCall` to `MacroCallId`. The main goal here is to centralize various conversions to single place and make implementing eager macro calls without further ado.
```rust
pub trait AsMacroCall {
fn as_call_id(
&self,
db: &(impl db::DefDatabase + AstDatabase),
resolver: impl Fn(path::ModPath) -> Option<MacroDefId>,
) -> Option<MacroCallId>;
}
```
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-02-17 08:38:09 +00:00
Edwin Cheng
2d4e79e1e6
Introduce AsMacroCall trait
2020-02-17 12:57:24 +08:00
Aleksey Kladov
ca7e9ab0da
1-based columns
2020-02-16 18:30:48 +01:00
Aleksey Kladov
0f79ec76d6
Support goto def in bences
2020-02-16 18:24:06 +01:00
Aleksey Kladov
6a3ec2dfa5
Refactor arg parsing
2020-02-16 18:20:22 +01:00
Aleksey Kladov
2ba918775c
Refactor position parsing
2020-02-16 18:17:35 +01:00
Aleksey Kladov
98cc51580d
Enable profiling for bench
2020-02-16 18:04:08 +01:00
Kirill Bulatov
f0338cea5b
Fix a slow test
2020-02-16 18:55:52 +02:00
Kirill Bulatov
dabdb57067
Simplify module retrieval
2020-02-16 18:44:46 +02:00
Aleksey Kladov
28fa5edbce
Add module colors to css
2020-02-16 17:06:01 +01:00
adamrk
e88eb89132
add space before/after wrapping braces
2020-02-16 16:33:15 +01:00
adamrk
68d3743faf
replace uses of VariantData::is_unit with VariantData::kind
2020-02-16 16:10:32 +01:00
adamrk
04aff742b1
show names for record fields in enum completion
2020-02-16 16:10:23 +01:00
Florian Diebold
e14e7ffa34
Fix coercion of &T to itself
...
The autoderef coercion logic did not handle matching placeholders. This led to
some type mismatches.
2020-02-16 12:58:20 +01:00
bors[bot]
d976772716
Merge #3157
...
3157: Extend analysis-stats a bit r=matklad a=flodiebold
This adds some tools helpful when debugging nondeterminism in analysis-stats:
- a `--randomize` option that analyses everything in random order
- a `-vv` option that prints even more detail
Also add a debug log if Chalk fuel is exhausted (which would be a source of
nondeterminism, but didn't happen in my tests).
I found one source of nondeterminism (rust-lang/chalk#331 ), but there are still
other cases remaining.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-02-15 22:35:44 +00:00
Aleksey Kladov
11dda31941
Remove extra dep
2020-02-15 23:23:44 +01:00
Florian Diebold
3484d727c3
Extend analysis-stats a bit
...
This adds some tools helpful when debugging nondeterminism in analysis-stats:
- a `--randomize` option that analyses everything in random order
- a `-vv` option that prints even more detail
Also add a debug log if Chalk fuel is exhausted (which would be a source of
nondeterminism, but didn't happen in my tests).
I found one source of nondeterminism (rust-lang/chalk#331 ), but there are still
other cases remaining.
2020-02-15 18:04:01 +01:00
Kevin DeLorey
057d0bee55
Added module doc comment to explain the purpose of the completion.
2020-02-15 10:27:04 -06:00
Kevin DeLorey
ae8ae650fc
Fixed bug that allowed for completion in a nested method.
2020-02-15 09:50:07 -06:00
Kevin DeLorey
fc13b7fc9a
Reordered the use
items.
2020-02-14 18:54:00 -06:00
Kirill Bulatov
426c0f26fe
If possible, use --exact flag when running tests
2020-02-15 01:06:14 +02:00
Mikhail Modin
f8f454ab5c
Init implementation of structural search replace
2020-02-14 21:45:42 +00:00
Benjamin Brittain
843f03a3d2
Bump crate resolution limit for large projects
...
Change-Id: Ie0221e5bcfd1779cd5e241f96b4489e5bd3854c1
2020-02-14 16:15:59 -05:00
bors[bot]
b2b94cbf71
Merge #3147
...
3147: Check that impl self type matches up with expected self type in path mode r=matklad a=flodiebold
Fixes #3144 .
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-02-14 20:32:55 +00:00
bors[bot]
6fb36dfdcb
Merge #3145
...
3145: Make Self implement the trait inside trait default methods r=matklad a=flodiebold
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-02-14 20:26:08 +00:00
Florian Diebold
f47dc4de8d
Check that impl self type matches up with expected self type in path mode
...
Fixes #3144 .
2020-02-14 21:08:25 +01:00
Florian Diebold
001dd6a200
Make Self implement the trait inside trait default methods
2020-02-14 20:39:04 +01:00
Aleksey Kladov
0bfebb8b20
Make AtomicX type resolve again
2020-02-14 19:33:39 +01:00
Florian Diebold
5028b86cb8
Move hir_fmt code to display module
2020-02-14 15:01:42 +01:00
Florian Diebold
a324d066cb
Rename Ty::Param => Ty::Placeholder
...
This aligns more with Chalk.
2020-02-14 14:44:00 +01:00
Kevin DeLorey
be97cbfdb4
Adjusted the completion lookups to filter by just the name.
2020-02-13 19:10:08 -06:00
bors[bot]
1f897d1c6e
Merge #3120
...
3120: Support trait auto import r=matklad a=SomeoneToIgnore
Unfortunately, for real cases it does not work as spectacular as in the tests.
The main reason for that is type inference:
* The callee type [here](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_hir_ty/src/method_resolution.rs#L369 ) is unknown for many cases
* The trait solution [here](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_hir_ty/src/method_resolution.rs#L399 ) is also often ambiguous
That results in trait candidates being rejected, and some real cases not supported.
Example: no imports for `String::from_str("test")`
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-13 11:37:32 +00:00
Adam Bratschi-Kaye
6f2cab1368
Add error context to failures in ra_project_model
using anyhow
crate ( #3119 )
...
Add error context to failures in ra_project_model using anyhow crate
2020-02-13 11:10:50 +01:00
Quan Luu
409c1a7f06
prevent "Play" symbol in "Run Test" code lens from rendering as emoji
2020-02-13 15:09:39 +07:00
Kevin DeLorey
0bc9e62374
Completion now replaces whole fn/const/type def with snippet.
2020-02-12 21:00:47 -06:00
Kevin DeLorey
43e62a87ab
Cheese const tests as they requre an ident before becoming a CONST_DEF.
2020-02-12 20:46:55 -06:00
Kevin DeLorey
877cfbacf9
Started to refactor the trigger of the trait_impl completion.
2020-02-12 20:21:43 -06:00
Han Mertens
bed9c083de
Run cargo test
2020-02-12 23:15:48 +01:00
Han Mertens
537da096fe
Run cargo xtask codegen
2020-02-12 23:09:13 +01:00
Han Mertens
b435fe8b77
Add test for unnamed argument in function pointer
2020-02-12 22:55:37 +01:00
Kirill Bulatov
e4f4cd77a0
Do not collect all traits
2020-02-12 23:27:19 +02:00
Han Mertens
0e10e77a78
Support unnamed arguments in function pointers
...
Fixes #3089
2020-02-12 21:40:05 +01:00
Kirill Bulatov
e008b08054
Support associated consts
2020-02-12 22:38:19 +02:00
Aleksey Kladov
f2424f947c
Add couple of utility methods
2020-02-12 18:19:55 +01:00
Aleksey Kladov
6ec982d54d
Simplify
2020-02-12 18:02:00 +01:00
Kirill Bulatov
3ccf8b746a
Also consider associated constants
2020-02-12 18:52:29 +02:00
Kirill Bulatov
f65daf23df
Revert source_analyzer changes
2020-02-12 17:34:37 +02:00
Kirill Bulatov
afc1d18ff3
Fix post-rebase issues
2020-02-12 17:18:42 +02:00
Kirill Bulatov
acf5f43639
Refactor the code
2020-02-12 17:18:42 +02:00
Kirill Bulatov
07058cbf9f
Adjust the assist group name
2020-02-12 17:18:42 +02:00
Kirill Bulatov
24f7028d3f
Add profiling
2020-02-12 17:18:42 +02:00
Kirill Bulatov
d5c3808545
Support trait method call autoimports
2020-02-12 17:18:42 +02:00
Kirill Bulatov
8f959f20ee
Trait location draft
2020-02-12 17:18:42 +02:00
Kirill Bulatov
9b6db7bbd4
Refactor path for imports extraction
2020-02-12 17:18:42 +02:00
Kirill Bulatov
2b9b16cb45
Add method tests
2020-02-12 17:18:41 +02:00
Kirill Bulatov
24ab3e80ca
Resolve methods and functions better
2020-02-12 17:18:41 +02:00
bors[bot]
5bf6698609
Merge #3121
...
3121: Do not add imports before inner attributes r=matklad a=SomeoneToIgnore
Current `insert_use_statement` function adds imports before inner attributes which results in compiler errors:
<img width="1440" alt="image" src="https://user-images.githubusercontent.com/2690773/74344019-a3749500-4db4-11ea-9d88-f71e903e795a.png ">
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-02-12 15:08:34 +00:00
Kirill Bulatov
2a7d97d829
Fix the trailing whitespace test
2020-02-12 17:04:16 +02:00
Kirill Bulatov
848c576266
Introduce AttrKind
2020-02-12 16:44:52 +02:00
Aleksey Kladov
225fc353af
Add more hir APIs for associated items
2020-02-12 15:31:44 +01:00
Kirill Bulatov
1596b31698
Do not add imports before inner attributes
2020-02-12 16:21:55 +02:00