Commit graph

13141 commits

Author SHA1 Message Date
Igor Aleksanov
2c787676c9 Add tests for traits functions in ide_db 2020-10-24 11:29:16 +03:00
Igor Aleksanov
b6ea56ea09 Make call_info a part of ide_db 2020-10-24 11:07:10 +03:00
Igor Aleksanov
8d3d509af7 Remove dependency on 'assists' from 'completion' crate 2020-10-24 10:47:23 +03:00
bors[bot]
4105378dc7
Merge #6330
6330: Textmate grammar: raw IDs, underscore fixes (closes #6293, #6340) r=dustypomerleau a=dustypomerleau

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6293.

I've included the possibility of the `r#` prefix in:

- function definitions
- function/method calls
- variables/parameters

This way the raw ID will simply get whatever the intended scope was, instead of a unique scope that might be inappropriately themed for its purpose.

Will wait a bit for feedback, in case there are other places you might use raw IDs.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-10-24 03:31:17 +00:00
Dusty Pomerleau
f352b98f7e fix: underscores, raw IDs
- remove comment scope from ignored params
- underscores will automatically receive variable/param scope
- add raw ID syntax to modules, functions, and variables
2020-10-24 13:00:26 +11:00
bors[bot]
2fa942ad30
Merge #6251 #6310
6251: Semantic Highlight: Add Callable modifier for variables r=matklad a=GrayJack

This PR added the `HighlightModifier::Callable` variant and assigned it to variables and parameters that are fn pointers, closures and implements FnOnce trait.

This allows to colorize these variables/parameters when used in call expression.



6310: Rewrite algo::diff to support insertion and deletion r=matklad a=Veykril

This in turn also makes `algo::diff` generate finer diffs(maybe even minimal diffs?) as insertions and deletions aren't always represented as as replacements of parent nodes now.

Required for #6287 to go on.

Co-authored-by: GrayJack <gr41.j4ck@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-23 22:12:15 +00:00
bors[bot]
c483212f27
Merge #6339
6339: Diagnose #[cfg]s in bodies r=matklad a=jonas-schievink

This PR threads diagnostics through body lowering using the `BodySourceMap`, and emits `InactiveCode` diagnostics for expressions, statements, and match arms that are `#[cfg]`d out.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-10-23 22:05:25 +00:00
bors[bot]
ea25ae614b
Merge #6336
6336: Improve Chalk debugging r=matklad a=flodiebold

 - add panic context for the trait goal if CHALK_DEBUG is set
 - print the Chalk program even if we're panicking
 - log goal/solution while TLS is still set

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-10-23 21:54:45 +00:00
bors[bot]
0c6f10ce42
Merge #6341
6341: Complete variants when only enun name is typed r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-23 21:42:53 +00:00
Aleksey Kladov
f9b81369e2 Complete variants when only enun name is typed
This allows the client to filter `Foo::Bar` when *either* `Foo` or
`Bar` is typed.
2020-10-23 23:41:47 +02:00
Jonas Schievink
5350c15e27 Fix name of InactiveCode diagnostic 2020-10-23 19:31:11 +02:00
Jonas Schievink
93dc6f511b Diagnose #[cfg]s in bodies 2020-10-23 19:27:04 +02:00
Florian Diebold
baeb16e83f Improve Chalk debugging
- add panic context for the trait goal if CHALK_DEBUG is set
 - print the Chalk program even if we're panicking
 - log goal/solution while TLS is still set
2020-10-23 15:28:02 +02:00
bors[bot]
dd8a75b2cf
Merge #6335
6335: Fix panic context r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-23 13:19:09 +00:00
Aleksey Kladov
1a74f25f90 Fix panic context 2020-10-23 15:18:33 +02:00
bors[bot]
81609960fa
Merge #6324
6324: Improve #[cfg] diagnostics r=jonas-schievink a=jonas-schievink

Unfortunately I ran into https://github.com/rust-analyzer/rust-analyzer/issues/4058 while testing this on https://github.com/nrf-rs/nrf-hal/, so I didn't see much of it in action yet, but it does seem to work.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-23 10:38:30 +00:00
Jonas Schievink
a246d4f599 cfg: move tests to separate file
that way we don't have to re-check the entire project when a test is
changed
2020-10-23 12:14:58 +02:00
Jonas Schievink
dab8870f5c Reorder items 2020-10-23 12:12:03 +02:00
Jonas Schievink
bfe1efca26 Use format_to
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-23 12:12:03 +02:00
bors[bot]
8b3c851dd3
Merge #6098
6098: Insert ref for completions r=adamrk a=adamrk

Follow up to https://github.com/rust-analyzer/rust-analyzer/pull/5846. When we have a local in scope which needs a ref or mutable ref to match the name and type of the active in the completion context then a new completion item with `&` or `&mut ` is inserted. E.g.
```rust
fn foo(arg: &i32){};
fn main() {
    let arg = 1_i32;
    foo(a<|>)
}
```
now offers `&arg` as a completion option with the highest score.

Co-authored-by: adamrk <ark.email@gmail.com>
2020-10-22 20:46:24 +00:00
adamrk
3dbbcfca67 Insert ref for completions 2020-10-22 22:45:14 +02:00
bors[bot]
edf46a13a6
Merge #6325 #6327
6325: Add generated diagnostic docs to the manual r=matklad a=flodiebold

It seemed that we're not actually including the generated diagnostic docs anywhere yet? So I added something to the manual. This is completely untested though.

6327: Update debugging.md r=matklad a=stanciuadrian

`on_task` is no longer there.
I have used `on_request` instead.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Adrian Stanciu <stanciu.adrian@gmail.com>
2020-10-22 18:15:48 +00:00
bors[bot]
3d349597fd
Merge #6326
6326: hide paramater inlay hints for cloned vars if applicable r=SomeoneToIgnore a=Veykril

This causes `foo.clone()` parameters to be handled as if they were just `foo` parameters for inlay hint logic.

Fixes #6315 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-22 18:09:43 +00:00
Jonas Schievink
dbd6266bc9
Update crates/cfg/src/cfg_expr.rs
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-22 20:08:27 +02:00
Adrian Stanciu
5f5b1ffdd1
Update debugging.md 2020-10-22 21:04:09 +03:00
Lukas Wirth
78c3e4a23c Hide paramater inlay hints for cloned vars if applicable 2020-10-22 19:44:52 +02:00
Florian Diebold
b59a0dbf6a Add generated diagnostic docs to the manual 2020-10-22 19:42:01 +02:00
Jonas Schievink
3421b645e6 Emit better #[cfg] diagnostics 2020-10-22 19:19:18 +02:00
Jonas Schievink
978cc93649 Fix typo 2020-10-22 19:19:05 +02:00
Jonas Schievink
68b17986c7 Implement DNF-based #[cfg] introspection 2020-10-22 17:57:00 +02:00
bors[bot]
31db677a94
Merge #6319
6319: Properly identify camel cased acronyms as UpperCamelCase r=popzxc a=ArifRoktim

This closes #6305.

Co-authored-by: Arif Roktim <arifrroktim@gmail.com>
2020-10-22 14:24:10 +00:00
Lukas Wirth
0059188e77 algo::diff tests 2020-10-22 14:48:24 +02:00
bors[bot]
ab53bb8718
Merge #6320 #6321
6320: Textmate grammar: prevent line comments from breaking block comments (closes #6281) r=matklad a=dustypomerleau

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6281.

Previously, line comments were able to break block comments by essentially commenting out the closing `*/`, resulting in a never-ending comment. This PR splits block comments into a separate repository group to fix this problem.

Since the comment scopes also include ignored parameters and inferred types, I've added the change proposed by @bnjjj in https://github.com/rust-analyzer/rust-analyzer/pull/6317, in order to close https://github.com/rust-analyzer/rust-analyzer/issues/6311 as well.

6321: Fix opening module documentation opening parent documentation instead r=matklad a=zacps

The whole path/URL joining code is kind of ugly which is what led to
this, but at the same time I don't really want to rewrite it right
now...

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6286

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
Co-authored-by: Zac Pullar-Strecker <zacmps@gmail.com>
2020-10-22 12:04:50 +00:00
bors[bot]
af75a08116
Merge #6314
6314: generate assist respect cfg attributes  r=matklad a=bnjjj

close #6312

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-22 11:58:11 +00:00
Lukas Wirth
d86863aeb4 Rewrite algo::diff to support insertion and deletion 2020-10-22 09:51:11 +02:00
Benjamin Coenen
f1fda43485 generate_impl assist respect cfg attributes #6312
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-10-22 09:48:48 +02:00
Zac Pullar-Strecker
68c67efa68 Fix opening module documentation opening parent documentation instead
The whole path/URL joining code is kind of ugly which is what led to
this, but at the same time I don't really want to rewrite it right
now...
2020-10-22 17:33:52 +13:00
Dusty Pomerleau
26b4b1e2fb fix: prevent line comments inside block comments
- prevent line comments inside block comments
- prevent underscore-prefixed functions and macros from receiving comment scope
2020-10-22 13:33:06 +11:00
Arif Roktim
854b133181 Properly identify camel cased acronyms as UpperCamelCase 2020-10-21 17:10:22 -04:00
bors[bot]
9eb6cbb80b
Merge #6307
6307: Add whitelist of safe intrinsics r=frazar a=frazar

This PR should fix #5996, where intrinsic operations where all marked as unsafe.

I'm rather new to this codebase, so I might be doing something *very* wrong. Please forgive me!

In particular, I'm not sure how to "check that we are in extern `rust-intrinsics`" as mentioned [in this comment](https://github.com/rust-analyzer/rust-analyzer/issues/5996#issuecomment-709234802). 

Co-authored-by: Francesco Zardi <frazar@users.noreply.github.com>
2020-10-21 20:09:11 +00:00
Francesco Zardi
aff04d81ba Refactor is_intrinsic_fn_unsafe() and make it private 2020-10-21 21:53:37 +02:00
Francesco Zardi
0be21b05d6 Move safe intrinsic tests 2020-10-21 21:53:05 +02:00
Francesco Zardi
f3aa44b01d Fix typo in comment 2020-10-21 21:51:53 +02:00
Jonas Schievink
2bc4c1ff31 Simplify cfg representation 2020-10-21 13:57:12 +02:00
bors[bot]
cc63f153f0
Merge #6302
6302: Textmate grammar: fix raw string highlighting r=matklad a=dustypomerleau

1. Fixes the raw string highlighting issue noted by @matklad in https://github.com/rust-analyzer/rust-analyzer/pull/6275.
2. Improves raw string highlighting by requiring the number of surrounding `#` to match.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-10-21 08:39:03 +00:00
Francesco Zardi
a9d996a7c5 Add whitelist of safe intrinsics 2020-10-21 09:06:05 +02:00
GrayJack
a35ff6edf4
Add tests for callable modifier 2020-10-21 01:54:51 -03:00
Dusty Pomerleau
93eeafc79f fix: require matching hash quantities for raw strings 2020-10-21 10:38:31 +11:00
bors[bot]
729a832a76
Merge #6270
6270: Update crates r=matklad a=kjeremy

This brings in a number of new dependencies though.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-10-20 22:26:31 +00:00
Jeremy Kolb
f64f569483 Update crates
This brings in a number of new dependencies though.
2020-10-20 17:36:02 -04:00