Commit graph

6893 commits

Author SHA1 Message Date
bors[bot]
560b98bc50
Merge #4822
4822: Let checkOnSafe default to some of the options of cargo r=matklad a=clemenswasser

This will fix #4631
The implementation works (as far as I have tested) but is suboptimal because I am copying the "cargo.features".

Co-authored-by: Clemens Wasser <clemens.wasser@gmail.com>
2020-06-10 07:39:44 +00:00
Clemens Wasser
fe21fc2d25 checkOnSafe.features and checkOnSafe.allFeatures now work identically. 2020-06-10 09:37:26 +02:00
Clemens Wasser
33b9058838 Most of the checkOnSafe options now default to the cargo equivalent. 2020-06-10 09:27:25 +02:00
Clemens Wasser
47ef544fa5 Added the rust-analyzer.checkOnSave.features option. 2020-06-10 08:51:11 +02:00
bors[bot]
c9fc7251ca
Merge #4824
4824: Correct "debug_assertion" to "debug_assertions" to match the cfg that the rust debug assert macros use. r=matklad a=woody77

This is for #4823.

Co-authored-by: Aaron Wood <aaronwood@google.com>
2020-06-10 05:24:18 +00:00
Aaron Wood
f4ed2da966 Correct "debug_assertion" to "debug_assertions" to match the cfg
option that the rust debug assert macros use.
2020-06-09 19:58:39 -07:00
Clemens Wasser
684b6fa1b8 flycheck now uses the configured features 2020-06-09 21:47:54 +02:00
Aleksey Kladov
e8d50578ab Correctly parse <_> paths in patterns
closes #3659
2020-06-09 13:45:18 +02:00
Aleksey Kladov
16943e533c Minor, use T! 2020-06-09 13:45:11 +02:00
bors[bot]
d4d384e4c8
Merge #4813
4813: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-09 11:22:38 +00:00
Aleksey Kladov
d8571e076c Simplify 2020-06-09 13:17:22 +02:00
bors[bot]
eb53f5a9e5
Merge #4812
4812: Use correct indent when replacing with match r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-09 11:14:30 +00:00
Aleksey Kladov
8cad7d1a2b Use correct indent when replacing with match 2020-06-09 12:38:47 +02:00
bors[bot]
382d10ea60
Merge #4811
4811: Unwrap block works with match arms r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-09 10:12:50 +00:00
Aleksey Kladov
53cc2c16e7 Unwrap block works with match arms 2020-06-09 11:52:45 +02:00
bors[bot]
4cacedd3de
Merge #4810
4810: Simplify unwrapping of blocks r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-09 09:33:56 +00:00
Aleksey Kladov
5233766ce5 Simplify unwrapping of blocks 2020-06-09 11:33:28 +02:00
bors[bot]
6f0cc91c88
Merge #4803
4803: Parse default unsafe fn r=matklad a=Avi-D-coder



Co-authored-by: Avi Dessauer <avi.the.coder@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-09 08:56:28 +00:00
Aleksey Kladov
2785362a1f
Update crates/ra_parser/src/grammar/items.rs 2020-06-09 10:50:25 +02:00
Aaron Wood
055b9b64bc Finish transition to cfgs from the separate atoms and features. 2020-06-08 16:19:39 -07:00
Aleksey Kladov
38fa4d17fb Simplify API 2020-06-09 00:01:53 +02:00
Avi Dessauer
e38685cb48 Parse default unsafe fn 2020-06-08 17:49:06 -04:00
Aleksey Kladov
2a42904680 Simplify 2020-06-08 21:48:23 +02:00
bors[bot]
3a7c218fd4
Merge #4576
4576: Add implementation of extract struct from enum variant r=matklad a=mcrakhman

Hi guys! I implemented the extraction functionality including modifying multiple files. The only thing I didn't change the cursor position. I've done it with a previous API, but now snippets have been introduced and I need to figure out how to do it.

Please bear in mind that I am a newcomer in the rust-analyzer (and also Rust) world, so I tried to implement the feature to the best of my knowledge, but the API is very new to me, so I am very welcome to introducing changes etc. 

Co-authored-by: Mikhail Rakhmanov <rakhmanov.m@gmail.com>
2020-06-08 16:28:48 +00:00
bors[bot]
38ac331f7d
Merge #4784
4784: Change management of test cfg to better support json projects r=Nashenas88 a=Nashenas88

This helps support json projects where they can decide whether to add the `test` cfg or not. One alternative is to add support for marking json project crates as a sysroot crate, and adding logic to remove the `test` cfg in those cases. In my opinion, that option gives less flexibility to json projects and leads to more functionality that needs to be maintained.

Fixes #4508 
cc @woody77 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
Co-authored-by: Paul Daniel Faria <nashenas88@users.noreply.github.com>
2020-06-08 16:20:45 +00:00
Paul Daniel Faria
dbceaf522b Use Option<&str> for target instead of Option<&String> 2020-06-08 12:10:23 -04:00
Paul Daniel Faria
9c35f135b9 Remove default_cfg_options, pass target instead so it can be used for building cargo workspaces 2020-06-08 10:23:29 -04:00
Aleksey Kladov
3b4d000250 Better unsafe highlihgting tests 2020-06-08 15:23:03 +02:00
Aleksey Kladov
c476f71bdf Highlight only the unsafe operator itself 2020-06-08 15:03:14 +02:00
bors[bot]
83fd0fb355
Merge #4775
4775: Add goto def for enum variant field r=matklad a=unexge

Closes #4764. I'm not familiar with ra codebase, there might be better ways to do that 😄 

Co-authored-by: unexge <unexge@gmail.com>
2020-06-08 12:46:12 +00:00
unexge
48b6dd0b33 Use explicit match for extracting def from classify_name 2020-06-08 15:38:10 +03:00
unexge
4edf736eb2 Swap into_definition and definition semantics for FieldShorthand variant 2020-06-08 15:37:12 +03:00
bors[bot]
db36a25839
Merge #4683
4683: Implement syntax highlighting for doctests r=ltentrup a=ltentrup

The implementation is more complicated than the previous injection logic as the doctest comments consist of multiple ranges. The implementation extracts the doctests together with an offset-mapping, applies the syntax highlighting, and updates the text ranges.

<img width="478" alt="Bildschirmfoto 2020-06-01 um 15 45 25" src="https://user-images.githubusercontent.com/201808/83415249-1f0b5800-a41f-11ea-8fa6-c282434d6ff7.png">

Part of #4170.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-06-08 12:26:33 +00:00
Leander Tentrup
4a2efb2f42 Implement syntax highlighting for doctests 2020-06-08 14:18:16 +02:00
unexge
c5d5d21858 Add FieldShorthand variant to NameClass 2020-06-08 14:46:58 +03:00
bors[bot]
6e4fca5882
Merge #4773
4773: Run|Debug hover actions. r=matklad a=vsrs

![hover_actions_run](https://user-images.githubusercontent.com/62505555/83335644-dfc1f780-a2b6-11ea-820b-ccaa82290e7d.gif)

This hover actions work exactly like corresponding lenses.

Co-authored-by: vsrs <vit@conrlab.com>
2020-06-08 11:29:35 +00:00
vsrs
b7db9f058a Apply suggestions from code review 2020-06-08 14:19:40 +03:00
bors[bot]
d8552d114c
Merge #4781
4781: Remove redundancy in syntax highlighting tests r=matklad a=ltentrup

Follow up from #4683. Improves syntax highlighting testing by introducing a function that contains the boilerplate comparison code. Keeps the `ra_fixture` argument in the first position, thus, the editor syntax highlighting injection still works.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
2020-06-08 09:48:38 +00:00
bors[bot]
bb0d4600ff
Merge #4770
4770: Clean up handling of int/float literal types r=matklad a=flodiebold

'Unknown' int/float types actually never exist as such, they get replaced by type variables immediately. So the whole `Uncertain<IntTy>` thing was unnecessary and just led to a bunch of match branches that were never hit.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-06-08 09:37:37 +00:00
Leander Tentrup
3aaaf924cb Fix bug in lexer for format specifier where the type and width were not correctly distinguished 2020-06-07 22:57:24 +02:00
Paul Daniel Faria
3937b225e7 Change management of test cfg to better support json projects 2020-06-07 10:29:03 -04:00
Leander Tentrup
65943c0585 Remove redundancy in syntax highlighting tests 2020-06-07 14:50:02 +02:00
unexge
73684a4ae2 Add goto def for enum variant field 2020-06-06 22:16:59 +03:00
vsrs
9b4256dc4d Add lib target filtering. 2020-06-06 22:11:17 +03:00
vsrs
46084f8a96 Disable runnables lookup in macro-generated code. 2020-06-06 20:10:36 +03:00
Florian Diebold
d66daee849 Clean up handling of int/float literal types
'Unknown' int/float types actually never exist as such, they get replaced by
type variables immediately. So the whole `Uncertain<IntTy>` thing was
unnecessary and just led to a bunch of match branches that were never hit.
2020-06-06 17:52:00 +02:00
vsrs
3434f1dd2c Add Run|Debug hover actions 2020-06-06 18:17:52 +03:00
vsrs
de74c0dcab Preliminary runnables refactoring 2020-06-06 18:17:52 +03:00
Florian Diebold
a4a4a1854e Fix type parameter defaults
They should not be applied in expression or pattern contexts, unless there are
other explicitly given type args.
2020-06-05 20:09:13 +02:00
bors[bot]
02f7b5d7ab
Merge #4761
4761: Upgrade Chalk to published version r=matklad a=flodiebold

CC @pksunkara 

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-05 16:05:06 +00:00
bors[bot]
2a3ab7f3b4
Merge #4689
4689: Implement return position impl trait / opaque type support r=matklad a=flodiebold

This is working, but I'm not that happy with how the lowering works. We might need an additional representation between `TypeRef` and `Ty` where names are resolved and `impl Trait` bounds are separated out, but things like inference variables don't exist and `impl Trait` is always represented the same way.

Also note that this doesn't implement correct handling of RPIT *inside* the function (which involves turning the `impl Trait`s into variables and creating obligations for them). That intermediate representation might help there as well.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-06-05 15:46:28 +00:00
Florian Diebold
0d2328f3ea Review fixes 2020-06-05 17:41:58 +02:00
bors[bot]
f133159ec0
Merge #4760
4760: Minimize FileLoader interface r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-05 15:23:22 +00:00
Aleksey Kladov
bbb40d7463 Minimize FileLoader interface 2020-06-05 17:22:56 +02:00
bors[bot]
4029628f15
Merge #4729 #4748
4729: Hover actions r=matklad a=vsrs

This PR adds a `hoverActions` LSP extension and a `Go to Implementations` action as an example:
![hover_actions_impl](https://user-images.githubusercontent.com/62505555/83335732-6d9de280-a2b7-11ea-8cc3-75253d062fe0.gif)



4748: Add an `ImportMap` and use it to resolve item paths in `find_path` r=matklad a=jonas-schievink

Removes the "go faster" queries I added in https://github.com/rust-analyzer/rust-analyzer/pull/4501 and https://github.com/rust-analyzer/rust-analyzer/pull/4506. I've checked this PR on the rustc code base and the assists are still fast.

This should fix https://github.com/rust-analyzer/rust-analyzer/issues/4515.

Note that this does introduce a change in behavior: We now always refer to items defined in external crates using paths through the external crate. Previously we could also use a local path (if for example the extern crate was reexported locally), as seen in the changed test. If that is undesired I can fix that, but the test didn't say why the previous behavior would be preferable.

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-05 15:14:35 +00:00
Florian Diebold
02962b374e Implement return position impl trait / opaque type support
This is working, but I'm not that happy with how the lowering works. We might
need an additional representation between `TypeRef` and `Ty` where names are
resolved and `impl Trait` bounds are separated out, but things like inference
variables don't exist and `impl Trait` is always represented the same
way.

Also note that this doesn't implement correct handling of RPIT *inside* the
function (which involves turning the `impl Trait`s into variables and creating
obligations for them). That intermediate representation might help there as
well.
2020-06-05 17:08:27 +02:00
Florian Diebold
69854f7795 Upgrade Chalk to published version 2020-06-05 17:06:07 +02:00
Aleksey Kladov
c9a41bd92d Actually test include!(concant!(env!()));
It triggered index-based goto definition before :-(
2020-06-05 15:49:12 +02:00
Aleksey Kladov
cb9d9040f7 Cleanup test 2020-06-05 15:14:47 +02:00
Aleksey Kladov
bba374bab2 More direct signature for resolve_path 2020-06-05 15:07:30 +02:00
Aleksey Kladov
e63c00f100 Rename resolve_relative_path -> resolve_path
For things like `concant!(env!("OUT_DIR"))`, we need to support abs paths
2020-06-05 14:58:30 +02:00
vsrs
bd9d7b6ad8 Remove hover actions heavy tests. 2020-06-05 15:26:46 +03:00
vsrs
78c9223b7b Remove hover contents marking as trusted.
Hover contents might be extracted from raw
doc comments and need some validation.
2020-06-05 15:25:01 +03:00
Jonas Schievink
bc2d172995 Clarify when we visit modules multiple times 2020-06-05 14:24:51 +02:00
vsrs
0fe43a124b Add capabilities tests. 2020-06-05 15:00:31 +03:00
vsrs
e35418ceb9 Apply suggestions from @kjeremy review 2020-06-05 15:00:31 +03:00
vsrs
92cfc0f2a1 Add enum hover action test. 2020-06-05 15:00:31 +03:00
vsrs
5d0c1aa162 Rebase on the latest master. 2020-06-05 15:00:30 +03:00
vsrs
b147e6eb95 Code formatting 2020-06-05 15:00:30 +03:00
vsrs
7d0dd17b09 Add hover actions as LSP extension 2020-06-05 14:59:26 +03:00
Aleksey Kladov
522d24a607 Inlay Hints: more directly account for self param 2020-06-05 13:58:52 +02:00
Jonas Schievink
2fb3d87bf7 impl Debug for ImportMap 2020-06-05 13:36:19 +02:00
Mikhail Rakhmanov
5dda995538 Fix review comments 2020-06-05 13:17:17 +02:00
Jonas Schievink
8395396782 Reorder imports 2020-06-05 13:15:16 +02:00
Jonas Schievink
5f23f8ca44 Make find_path_inner private again 2020-06-05 13:11:53 +02:00
Jonas Schievink
f085e592fe Measure memory usage of ImportMap 2020-06-05 13:10:43 +02:00
Jonas Schievink
86fbd8cc2b defining_crate -> krate 2020-06-05 13:05:19 +02:00
Jonas Schievink
e0e9c6d1a4 Fix wrong comment 2020-06-05 13:04:35 +02:00
Mikhail Rakhmanov
74c3e7a1ad Remove unnecessary return 2020-06-05 11:45:41 +02:00
bors[bot]
913a623281
Merge #4750
4750: introduce_named_lifetime assist wasn't applicable when type parameter r=matklad a=jbalint

followed anonymous lifetime token

(fixes #4684)

Co-authored-by: Jess Balint <jbalint@gmail.com>
2020-06-05 07:56:11 +00:00
Jess Balint
921306757b introduce_named_lifetime assist wasn't applicable when type parameter
followed anonymous lifetime token

(fixes #4684)
2020-06-04 17:31:21 -05:00
bors[bot]
e66c7b3a45
Merge #4737
4737: Parse default unsafe & default const r=matklad a=Avi-D-coder

Closes: #4718 #4264

Co-authored-by: Avi Dessauer <avi.the.coder@gmail.com>
2020-06-04 17:51:03 +00:00
Jonas Schievink
3c496f7fa7 Use ImportMap in find_path, remove old queries 2020-06-04 19:33:01 +02:00
Jonas Schievink
d08c63cb9e Add an ImportMap 2020-06-04 19:33:01 +02:00
Avi Dessauer
c4fd463981 Move default const test out of line 2020-06-04 13:06:57 -04:00
Avi Dessauer
3ec2dcfc0d Address review 2020-06-04 13:00:21 -04:00
bors[bot]
c19496f845
Merge #4740
4740: Remove unneeded "./" prefix affecting error messages r=kjeremy a=dtolnay

I noticed this in the error in the commit message of https://github.com/rust-analyzer/rust-analyzer/pull/4739.

Before:

```console
error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
  --> crates/rust-analyzer/./src/bin/main.rs:99:16
   |
99 |     connection.initialize_finish(initialize_id, initialize_result)?;
   |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
```

After:

```console
error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
  --> crates/rust-analyzer/src/bin/main.rs:99:16
   |
99 |     connection.initialize_finish(initialize_id, initialize_result)?;
   |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
```

```diff
-   --> crates/rust-analyzer/./src/bin/main.rs:99:16
+   --> crates/rust-analyzer/src/bin/main.rs:99:16
```

Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-06-04 13:04:24 +00:00
bors[bot]
a1ca1e7598
Merge #4739
4739: Declare required lsp-server dependency of rust-analyzer crate r=jonas-schievink a=dtolnay

My codebase already depended on lsp-server and introducing a dependency on rust-analyzer failed at first because it assumes some functions that were first present in lsp-server 0.3.2.

Without this change:

```console
error[E0599]: no method named `initialize_start` found for struct `lsp_server::Connection` in the current scope
  --> crates/rust-analyzer/./src/bin/main.rs:83:57
   |
83 |     let (initialize_id, initialize_params) = connection.initialize_start()?;
   |                                                         ^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`

error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
  --> crates/rust-analyzer/./src/bin/main.rs:99:16
   |
99 |     connection.initialize_finish(initialize_id, initialize_result)?;
   |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
```

Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-06-04 10:45:06 +00:00
Mikhail Rakhmanov
b0c8a2be7b Remove AsName import 2020-06-04 10:03:44 +02:00
David Tolnay
4461796f33
Fix type inference failure when built with log/kv_unstable
This code is broken by an `impl From<kv::Error> for fmt::Error` in the
log crate when building in a codebase that has the log/kv_unstable
feature enabled.

    $ cargo check --manifest-path crates/ra_hir_def/Cargo.toml
        Checking ra_hir_def v0.1.0
        Finished dev [unoptimized] target(s) in 0.75s

    $ cargo check --manifest-path crates/ra_hir_def/Cargo.toml --features log/kv_unstable
        Checking ra_hir_def v0.1.0
    error[E0282]: type annotations needed for the closure `fn(&str) -> std::result::Result<(), _>`
       --> crates/ra_hir_def/src/path.rs:278:17
        |
    278 |                 f.write_str("::")?;
        |                 ^^^^^^^^^^^^^^^^^^ cannot infer type
        |
    help: give this closure an explicit return type without `_` placeholders
        |
    276 |         let mut add_segment = |s| -> std::result::Result<(), _> {
        |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020-06-03 19:06:02 -07:00
David Tolnay
7348040944
Remove unneeded "./" prefix affecting error messages
Before:

    error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/./src/bin/main.rs:99:16
       |
    99 |     connection.initialize_finish(initialize_id, initialize_result)?;
       |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`

After:

    error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/src/bin/main.rs:99:16
       |
    99 |     connection.initialize_finish(initialize_id, initialize_result)?;
       |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
2020-06-03 18:02:09 -07:00
David Tolnay
19b27f2ec9
Declare required lsp-server dependency of rust-analyzer crate
My codebase already depended on lsp-server and introducing a dependency
on rust-analyzer failed at first because it assumes some functions that
were first present in lsp-server 0.3.2.

Without this change:

    error[E0599]: no method named `initialize_start` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/./src/bin/main.rs:83:57
       |
    83 |     let (initialize_id, initialize_params) = connection.initialize_start()?;
       |                                                         ^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`

    error[E0599]: no method named `initialize_finish` found for struct `lsp_server::Connection` in the current scope
      --> crates/rust-analyzer/./src/bin/main.rs:99:16
       |
    99 |     connection.initialize_finish(initialize_id, initialize_result)?;
       |                ^^^^^^^^^^^^^^^^^ method not found in `lsp_server::Connection`
2020-06-03 17:55:48 -07:00
Avi Dessauer
a5588b9e19 Update tests 2020-06-03 20:39:57 -04:00
Avi Dessauer
fb632c747d Parse default unsafe & default const 2020-06-03 20:16:38 -04:00
Mikhail Rakhmanov
a6d3c77bdd Fixed tests 2020-06-03 20:43:57 +02:00
Mikhail Rakhmanov
eefa10bc6b Merge branch 'master' into assists_extract_enum 2020-06-03 20:10:54 +02:00
Mikhail Rakhmanov
a9d5675848 Fix incorrect behaviour if not resolved 2020-06-03 20:10:33 +02:00
Mikhail Rakhmanov
6cd2e04bd2 Fix more comments 2020-06-03 19:33:57 +02:00
Mikhail Rakhmanov
6a0083a519 Merge branch 'master' into compute-lazy-assits
# Conflicts:
#	crates/rust-analyzer/src/main_loop/handlers.rs
#	crates/rust-analyzer/src/to_proto.rs
2020-06-03 19:26:01 +02:00
Mikhail Rakhmanov
bacd0428fa Fix review comments 2020-06-03 18:39:01 +02:00
bors[bot]
a33cfcb55d
Merge #4502
4502: Mark fixes from diagnostics as quick fixes r=kjeremy a=kjeremy

Populates the diagnostic UI with fixes:

Before: 
![quickfix-before](https://user-images.githubusercontent.com/4325700/82165183-0e38df00-9882-11ea-96cf-7dab5faec4d4.PNG)

After:
![image](https://user-images.githubusercontent.com/4325700/82165193-1a24a100-9882-11ea-97d7-be1b64b135e0.png)


Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-06-03 13:39:30 +00:00
Jeremy Kolb
9e71fc0314 Mark fixes from diagnostics as quick fixes 2020-06-03 09:31:32 -04:00
bors[bot]
1edf6d2d4f
Merge #4730
4730: Document rust-project.json r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-03 13:18:12 +00:00
Aleksey Kladov
fa019c8f56 Document rust-project.json 2020-06-03 15:17:26 +02:00
bors[bot]
e644f64f2a
Merge #4678
4678: Unsquish parameter types in tooltips for macro-generated functions r=aloucks a=aloucks

Note the missing whitespace between `:` and the parameter type.

Before:
![image](https://user-images.githubusercontent.com/221559/83364680-faf13d80-a370-11ea-96b7-a041969a4954.png)

After:
![image](https://user-images.githubusercontent.com/221559/83364685-03e20f00-a371-11ea-9668-4e6ebcb81947.png)


Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2020-06-03 11:27:10 +00:00
Aaron Loucks
f06b2bcd91 Use split1 when formatting function signature params 2020-06-03 07:26:15 -04:00
bors[bot]
c6b739bad0
Merge #4660
4660: Enable hover and autocomplete docs on macro generated items r=aloucks a=aloucks

Enable hover and autocomplete docs on macro generated items. This de-sugars doc comments into `doc` attributes in some cases, but not all. Comments and `doc` attributes are then merged together. 

This PR is essentially a partial implementation of what's being suggested #3182, but it's not all the way there yet. ~I still need to add unit tests~, but I wanted to first get feedback on whether or not this was an acceptable path forward.

Fixes #4564
Fixes #3984
Fixes #3180
Related #3182

![macro_item_docs](https://user-images.githubusercontent.com/221559/83336760-15012200-a284-11ea-8d0d-b6a615850044.gif)



Co-authored-by: Aaron Loucks <aloucks@cofront.net>
2020-06-03 11:05:52 +00:00
Aaron Loucks
85c4edb0af Consolidate documentation expansion and merging
Removes the duplicated `expand_doc_attrs` and `merge_doc_comments_and_attrs`
functions from `ra_ide` and exposes the same functionality via
`ra_hir::Documentation::from_ast`.
2020-06-03 06:54:41 -04:00
Aaron Loucks
5837acce53 Add basic hover and completion doc tests for macro generated items 2020-06-03 06:46:07 -04:00
Aaron Loucks
4c655c01f3 Enable hover and autocomplete docs on macro generated items 2020-06-03 06:46:07 -04:00
Aleksey Kladov
2e7d12d2f3 Drop test for old format 2020-06-03 12:39:11 +02:00
Aleksey Kladov
8baa4c5d07 Groundwork for specifying the set of projects via config 2020-06-03 12:22:01 +02:00
Aleksey Kladov
03a76191a1 Rename ProjectRoot -> ProjectManifest 2020-06-03 12:05:50 +02:00
Aleksey Kladov
0a88de809f Move project discovery 2020-06-03 12:04:27 +02:00
Aleksey Kladov
a87cd8ecc6 Rename WorldState -> GlobalState 2020-06-03 11:20:01 +02:00
Aleksey Kladov
ee181cf683 Drop no-project test
Eventually, we should support "just open random rust file" use case,
we don't really do this now, so let's avoid spending time on it until
we fix it properly.
2020-06-03 11:07:04 +02:00
Aleksey Kladov
d4b21476a8 Derive local roots from Workspaces 2020-06-03 10:52:35 +02:00
Aleksey Kladov
ca80544f4b Put important things on top 2020-06-03 10:33:01 +02:00
Aleksey Kladov
ac4782ef11
Merge pull request #4382 from woody77/json_cfgs
Begin transition to new fields for JsonProject crate cfgs
2020-06-03 10:28:15 +02:00
bors[bot]
68f26dc1bb
Merge #4679
4679: Update a comment for the new source organization r=matklad a=nelhage



Co-authored-by: Nelson Elhage <nelhage@nelhage.com>
2020-06-03 06:47:18 +00:00
bors[bot]
6d38351db4
Merge #4721
4721: Hide squiggly for unused and unnecessary diagnostics r=matklad a=GabbeV

Fixes #4229 

When working with JavaScript or TypeScript in VSCode unused valiables are faded but don't have a squiggle. This PR makes rust-analyzer work similarly by setting the severity to hint when applying the unnecessary tag.

VSCode usually shows a squiggle for error, warning and information and shows three dots for hint. When the unnecessary tag is present the squiggles will still show up but the three dots will not.

This is my first contribution to open source. Please tell me if i need to do anything more to get this PR considered.

Co-authored-by: Gabriel Valfridsson <gabriel.valfridsson@gmail.com>
2020-06-03 06:16:45 +00:00
Gabriel Valfridsson
599c105e6f Hide squiggly for unused and unnecessary 2020-06-03 01:57:28 +02:00
Paul Daniel Faria
a9cb2933fb Add highlight support for unsafe fn calls and raw ptr deref 2020-06-02 18:54:00 -04:00
Mikhail Rakhmanov
cb482e6351 Merge remote-tracking branch 'upstream/master' into compute-lazy-assits
# Conflicts:
#	crates/rust-analyzer/src/to_proto.rs
2020-06-02 23:22:45 +02:00
Mikhail Rakhmanov
57cd936c52 Preliminary implementation of lazy CodeAssits 2020-06-02 23:10:53 +02:00
bors[bot]
2f6ab77708
Merge #4710
4710: New runnables r=matklad a=matklad

bors d=@vsrs

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-02 20:44:56 +00:00
bors[bot]
0035dafbfa
Merge #4711
4711: Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-06-02 16:16:38 +00:00
Laurențiu Nicola
7a66d99897 Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default 2020-06-02 19:14:34 +03:00
Aleksey Kladov
bc3db7c1de Fix tests 2020-06-02 18:09:12 +02:00
Aleksey Kladov
a83ab820a4 Spec better runnables 2020-06-02 17:34:18 +02:00
Aleksey Kladov
0303982119 New runnables API 2020-06-02 17:22:42 +02:00
Aleksey Kladov
31f282636b Minor 2020-06-02 16:30:47 +02:00
bors[bot]
fe6508bd78
Merge #4658
4658: Fix problem with format string tokenization r=matklad a=ruabmbua

Fixed by just not handling closing curlybrace escaping.

Closes https://github.com/rust-analyzer/rust-analyzer/issues/4637

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-06-02 12:13:02 +00:00
bors[bot]
131ccd9540
Merge #4580
4580: Fix invoking cargo without consulting CARGO env var or standard installation paths r=matklad a=Veetaha

Followup for #4329

The pr essentially fixes [this bug](https://youtu.be/EzQ7YIIo1rY?t=2189)

cc @lefticus

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-06-02 11:58:28 +00:00
veetaha
fb971c3bce Simplify 2020-06-02 02:50:05 +03:00
Mikhail Rakhmanov
b4af02d110 Add top level keywords completion 2020-06-02 01:29:54 +02:00
Aleksey Kladov
285717de33 Rename assist 2020-06-01 15:41:16 +02:00
Aleksey Kladov
d08232b10d Cleanup imports 2020-06-01 15:35:41 +02:00
Nelson Elhage
8101ea0fdc Update a comment for the new source organization 2020-05-31 16:04:52 -07:00
Aaron Loucks
1211a46826 Unsquish parameter types in tooltips for macro-generated functions 2020-05-31 18:58:54 -04:00
veetaha
ddd811601e Small refactor 2020-05-31 21:39:19 +03:00
Brennan Vincent
d39cbeef91 add test 2020-05-31 12:21:45 -04:00
Brennan Vincent
8ef9703740 recursively search submodules 2020-05-31 12:05:54 -04:00
bors[bot]
5579ba8af5
Merge #4667
4667: Infer labelled breaks correctly r=flodiebold a=robojumper

Fixes #4663.

Co-authored-by: robojumper <robojumper@gmail.com>
2020-05-31 12:03:24 +00:00
bors[bot]
09df51dab8
Merge #4664
4664: Generate feature documentation from code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-31 10:50:11 +00:00
robojumper
cc6ba84c40 fmt 2020-05-31 12:06:22 +02:00
robojumper
1cd78a3355 correctly infer labelled breaks 2020-05-31 11:40:18 +02:00
Aleksey Kladov
1c6a2eb14a Move the rest of the features to generated docs 2020-05-31 11:29:19 +02:00
robojumper
fb469c3b31 labelled break test 2020-05-31 11:24:53 +02:00
Aleksey Kladov
b795a07320 Doc more features 2020-05-31 10:14:36 +02:00