Commit graph

6867 commits

Author SHA1 Message Date
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
Aleksey Kladov
8915183d7d Don't require module docs for Features and Assists 2020-05-31 09:59:38 +02:00
Aleksey Kladov
f593393ebb Specify actions 2020-05-31 09:45:41 +02:00
veetaha
d605ec9c32 Change Runnable.bin -> Runnable.kind
As per matklad, we now pass the responsibility for finding the binary to the frontend.
Also, added caching for finding the binary path to reduce
the amount of filesystem interactions.
2020-05-31 05:21:45 +03:00
veetaha
a419cedb1c Fix tests, apply code review proposals 2020-05-31 03:10:23 +03:00
veetaha
030d78345f Fix invoking cargo without consulting CARGO or standard installation paths 2020-05-31 03:10:23 +03:00
Aleksey Kladov
c8f27a4a88 Generate features docs from source 2020-05-31 01:54:54 +02:00
Roland Ruckerbauer
780c89959a Test case for format string highlighting of closing curlybrace 2020-05-30 18:35:11 +02:00
Roland Ruckerbauer
a27ede88a3 Fix problem with format string tokenization
Fixed by just not handling closing curlybrace escaping.
2020-05-30 14:09:10 +02:00
bors[bot]
07060b3daa
Merge #4654
4654: Add semantic highlight to ? operator r=matklad a=ruabmbua

Made it an operator with controlFlow modifier.

To highlight in vscode as red:

```json
"editor.semanticTokenColorCustomizations": {
        "enabled": true,
        "rules": {
            "operator.controlFlow": "#ff0000",
        }
}
```

![Bildschirmfoto von 2020-05-29 21-32-06](https://user-images.githubusercontent.com/2522373/83297998-f3585a00-a1f3-11ea-9d14-4ef04b9b6b9a.png)

https://github.com/rust-analyzer/rust-analyzer/issues/4597


Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-05-30 08:26:04 +00:00
bors[bot]
5d84028170
Merge #4562
4562: Assist: replace anonymous lifetime with a named one r=matklad a=jbalint

(fixes #4523)

Co-authored-by: Jess Balint <jbalint@gmail.com>
2020-05-30 08:01:00 +00:00
bors[bot]
11f74f2827
Merge #4653
4653: Fix match ergonomics in closure parameters r=matklad a=flodiebold

Fixes #4476.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-05-30 07:52:07 +00:00
bors[bot]
f7f01dd5f0
Merge #4651
4651: Use first match branch in case of type mismatch, not last r=kjeremy a=flodiebold

The comment says this was intentional, but I do agree with #4304 that it makes
more sense the other way around (for if/else as well).

Fixes #4304.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-05-29 21:07:43 +00:00
bors[bot]
3689c8c3f6
Merge #4652
4652: Upgrade Chalk r=kjeremy a=flodiebold

Fixes #4072.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-05-29 19:33:52 +00:00
Roland Ruckerbauer
18aa4bcb03 Add semantic highlight to QUESTION token
Made it an operator with controlFlow modifier.
2020-05-29 21:17:14 +02:00
Florian Diebold
6f67a46a6a Fix match ergonomics in closure parameters
Fixes #4476.
2020-05-29 17:36:43 +02:00
Florian Diebold
ab28f6c249 Upgrade Chalk
Fixes #4072.
2020-05-29 16:49:52 +02:00
Florian Diebold
7d0586cb15 Use first match branch in case of type mismatch, not last
The comment says this was intentional, but I do agree with #4304 that it makes
more sense the other way around (for if/else as well).

Fixes #4304.
2020-05-29 16:04:56 +02:00
Jess Balint
bd8aa04bae add support for naming anon lifetimes in function return type 2020-05-28 15:10:14 -05:00
robojumper
367487fe88 Support raw_ref_op's raw reference operator 2020-05-28 21:42:22 +02:00
bors[bot]
fc29d0e924
Merge #4641
4641: Upgrade Chalk r=matklad a=flodiebold

Chalk newly added TypeName::Never and Array; I implemented the conversion for
Never, but not Array since that expects a const argument.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-05-28 09:34:33 +00:00
Florian Diebold
c8a4bb1445 Upgrade Chalk
Chalk newly added TypeName::Never and Array; I implemented the conversion for
Never, but not Array since that expects a const argument.
2020-05-27 21:07:08 +02:00
Cadu
c011f04f55 Fixed missing newline on each field on "Missing structure fields". 2020-05-27 13:15:19 -03:00
bors[bot]
94889b6472
Merge #4592
4592: fix textedit range returned for completion when left token is a keyword r=bnjjj a=bnjjj

close #4545

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-27 13:22:26 +00:00
Benjamin Coenen
846cefa491 fix textedit range returned for completion when left token is a keyword
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-05-27 15:15:19 +02:00
bors[bot]
59adc7bfb6
Merge #4596
4596: Strip leading underscores of argument names in function/method r=matklad a=kuy

Closes #4510 

### Goal

When I select a function/method from completions, I get a snippet that doesn't contain leading underscores of argument names.

### Solution

- Option 1: All signatures don't contain underscores
- Option 2: Keep same signature, but inserted snippet doesn't contain underscores

I choose Option 2 because I think that leading underscores is a part of "signature". Users should get correct signatures. On the other hand, trimming underscores is an assist by IDE.

### Other impls.

rls: Complete argument names with underscores (same as actual ra)
IntelliJ Rust: Doesn't complete argument names
VSCode (TypeScript): Doesn't complete argument names

### Working example

![Screen Shot 2020-05-25 at 0 03 21](https://user-images.githubusercontent.com/151614/82757771-a05e5b80-9e1d-11ea-9dbc-1263c960e2ae.png)


Co-authored-by: Yuki Kodama <endflow.net@gmail.com>
2020-05-27 12:41:38 +00:00
bors[bot]
3c5112b079
Merge #4625 #4629
4625: Partially fix displaying inlay hints in Github PR diff views r=matklad a=Veetaha

See the comment in https://github.com/rust-analyzer/rust-analyzer/issues/4608#issuecomment-63424257

It partially fixes the left side of diff view (the one where old code is displayed), but the diff editor with new code changes still has `file` scheme and will proceed displaying inlay hints...

4629: Fix the `should_panic` snippet r=matklad a=eminence

Closes #4628

Co-authored-by: veetaha <veetaha2@gmail.com>
Co-authored-by: Andrew Chin <achin@eminence32.net>
2020-05-27 12:34:03 +00:00