]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoUse snippets in change_return_type_to_result
Aleksey Kladov [Wed, 20 May 2020 09:10:15 +0000 (11:10 +0200)]
Use snippets in change_return_type_to_result

4 years agowip
Aleksey Kladov [Wed, 20 May 2020 08:30:18 +0000 (10:30 +0200)]
wip

4 years agoCleanup
Aleksey Kladov [Wed, 20 May 2020 08:28:58 +0000 (10:28 +0200)]
Cleanup

4 years agoMinor
Aleksey Kladov [Wed, 20 May 2020 08:26:14 +0000 (10:26 +0200)]
Minor

4 years agoMinor
Aleksey Kladov [Wed, 20 May 2020 08:20:21 +0000 (10:20 +0200)]
Minor

4 years agoSnippetify add_new
Aleksey Kladov [Wed, 20 May 2020 08:17:46 +0000 (10:17 +0200)]
Snippetify add_new

4 years agoMerge #4505
bors[bot] [Wed, 20 May 2020 07:22:53 +0000 (07:22 +0000)]
Merge #4505

4505: Infer return type of loops with value breaks r=flodiebold a=ruabmbua

Creates a type variable to represent the return value of the loop.
Uses `coerce_merge_branch` on each break with the previous value, to determine the actual return value of the loop.

Resolves: https://github.com/rust-analyzer/rust-analyzer/issues/4492 , https://github.com/rust-analyzer/rust-analyzer/issues/4512

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
4 years agoMerge #4525
bors[bot] [Wed, 20 May 2020 00:11:25 +0000 (00:11 +0000)]
Merge #4525

4525: Better cursor placement when adding impl members r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoBetter cursor placement when adding impl members
Aleksey Kladov [Wed, 20 May 2020 00:07:21 +0000 (02:07 +0200)]
Better cursor placement when adding impl members

4 years agoMerge #4524
bors[bot] [Tue, 19 May 2020 23:54:08 +0000 (23:54 +0000)]
Merge #4524

4524: Use snippets in add_missing_members r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse snippets in add_missing_members
Aleksey Kladov [Tue, 19 May 2020 23:53:21 +0000 (01:53 +0200)]
Use snippets in add_missing_members

4 years agoMerge #4521 #4522
bors[bot] [Tue, 19 May 2020 23:30:48 +0000 (23:30 +0000)]
Merge #4521 #4522

4521: Use snippets in add_function r=matklad a=matklad

bors r+
🤖

4522: Explain the purpose of `ast::make` module more clearly r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoModerate cleanup of add_function
Aleksey Kladov [Tue, 19 May 2020 21:12:01 +0000 (23:12 +0200)]
Moderate cleanup of add_function

4 years agoExplain the purpose of `ast::make` module more clearly
Aleksey Kladov [Tue, 19 May 2020 23:28:11 +0000 (01:28 +0200)]
Explain the purpose of `ast::make` module more clearly

4 years agoUse snippets in add function
Aleksey Kladov [Tue, 19 May 2020 20:25:07 +0000 (22:25 +0200)]
Use snippets in add function

4 years agoCleanup
Aleksey Kladov [Tue, 19 May 2020 19:43:14 +0000 (21:43 +0200)]
Cleanup

4 years agoCleanup
Aleksey Kladov [Tue, 19 May 2020 19:40:47 +0000 (21:40 +0200)]
Cleanup

4 years agoUse new format for all assists that don't change cursor positon
Aleksey Kladov [Tue, 19 May 2020 19:39:27 +0000 (21:39 +0200)]
Use new format for all assists that don't change cursor positon

4 years agoMerge #4519
bors[bot] [Tue, 19 May 2020 22:50:26 +0000 (22:50 +0000)]
Merge #4519

4519: Fix client-side snippets r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFix client-side snippets
Aleksey Kladov [Tue, 19 May 2020 22:49:08 +0000 (00:49 +0200)]
Fix client-side snippets

4 years agoMerge #4518
bors[bot] [Tue, 19 May 2020 22:27:55 +0000 (22:27 +0000)]
Merge #4518

4518: New assist: add turbo fish r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoNew assist: add turbo fish
Aleksey Kladov [Tue, 19 May 2020 22:07:00 +0000 (00:07 +0200)]
New assist: add turbo fish

4 years agoApply suggestion of @flodiebold: Get rid of multiple unwraps
Roland Ruckerbauer [Tue, 19 May 2020 20:52:15 +0000 (22:52 +0200)]
Apply suggestion of @flodiebold: Get rid of multiple unwraps

4 years agoloop return value inference: add tests
Roland Ruckerbauer [Tue, 19 May 2020 19:49:45 +0000 (21:49 +0200)]
loop return value inference: add tests

4 years agoMove false negative expr_diverges_missing_arm() to working tests
Roland Ruckerbauer [Tue, 19 May 2020 19:18:43 +0000 (21:18 +0200)]
Move false negative expr_diverges_missing_arm() to working tests

4 years agoloop return value inference: coerce_merge branches
Roland Ruckerbauer [Tue, 19 May 2020 19:03:59 +0000 (21:03 +0200)]
loop return value inference: coerce_merge branches

4 years agoMerge #4494
bors[bot] [Tue, 19 May 2020 18:29:46 +0000 (18:29 +0000)]
Merge #4494

4494: Support snippet text edit r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUpdate test data
Aleksey Kladov [Tue, 19 May 2020 18:27:14 +0000 (20:27 +0200)]
Update test data

4 years agoImplement client-side of SnippetTextEdit
Aleksey Kladov [Sun, 17 May 2020 23:53:55 +0000 (01:53 +0200)]
Implement client-side of SnippetTextEdit

4 years agoServer side of SnippetTextEdit
Aleksey Kladov [Sun, 17 May 2020 22:11:40 +0000 (00:11 +0200)]
Server side of SnippetTextEdit

4 years agoAdd snippetTextEdit protocol extension
Aleksey Kladov [Sun, 17 May 2020 19:24:33 +0000 (21:24 +0200)]
Add snippetTextEdit protocol extension

4 years agoAdd snippet support for some assists
Aleksey Kladov [Sun, 17 May 2020 12:21:24 +0000 (14:21 +0200)]
Add snippet support for some assists

4 years agoAdd AssistConfig
Aleksey Kladov [Sun, 17 May 2020 10:09:53 +0000 (12:09 +0200)]
Add AssistConfig

4 years agoMerge #4491
bors[bot] [Tue, 19 May 2020 18:16:20 +0000 (18:16 +0000)]
Merge #4491

4491: fix doctest inside impl block r=matklad a=bnjjj

close #4449

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
4 years agoMerge #4514
bors[bot] [Tue, 19 May 2020 15:03:41 +0000 (15:03 +0000)]
Merge #4514

4514: find_path cleanups r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoCleanup query fn naming
Aleksey Kladov [Tue, 19 May 2020 14:54:45 +0000 (16:54 +0200)]
Cleanup query fn naming

4 years agoMove public API to the top
Aleksey Kladov [Tue, 19 May 2020 14:46:33 +0000 (16:46 +0200)]
Move public API to the top

4 years agoSimplify
Aleksey Kladov [Tue, 19 May 2020 14:45:57 +0000 (16:45 +0200)]
Simplify

4 years agoCleanup imports
Aleksey Kladov [Tue, 19 May 2020 14:43:26 +0000 (16:43 +0200)]
Cleanup imports

4 years agoMerge #4513
bors[bot] [Tue, 19 May 2020 14:35:21 +0000 (14:35 +0000)]
Merge #4513

4513: Update crates r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoUpdate crates
kjeremy [Tue, 19 May 2020 14:11:34 +0000 (10:11 -0400)]
Update crates

4 years agoInfer return type of loops with value breaks.
Roland Ruckerbauer [Mon, 18 May 2020 21:39:10 +0000 (23:39 +0200)]
Infer return type of loops with value breaks.

4 years agoMerge #4501
bors[bot] [Mon, 18 May 2020 19:43:12 +0000 (19:43 +0000)]
Merge #4501

4501: Querify `importable_locations_in_crate` r=jonas-schievink a=jonas-schievink

This brings the time needed to compute the `add_missing_impl_members` assist down from ~5 minutes to 20 seconds on my test workload (which is editing within an impl of a MIR [`MutVisitor`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/visit/trait.MutVisitor.html))

cc #4498

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years ago Querify `importable_locations_in_crate`
Jonas Schievink [Mon, 18 May 2020 19:42:39 +0000 (21:42 +0200)]
 Querify `importable_locations_in_crate`

 This brings the time needed to compute the `add_missing_impl_members`
assist down from ~5 minutes to 20 seconds

4 years agoMerge #4497
bors[bot] [Mon, 18 May 2020 11:03:44 +0000 (11:03 +0000)]
Merge #4497

4497: Create LowerCtx on the fly r=matklad a=edwin0cheng

Previously we create `LowerCtx` at the beginning of lowering, however, the hygiene content is in fact changing between macro expression expanding.

This PR change it to create the `LowerCtx` on the fly to fix above bug.

However, #4465 is not fixed by this PR, the goto-def is still not work yet. It only fixed the infer part.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoMerge #4493
bors[bot] [Mon, 18 May 2020 07:44:44 +0000 (07:44 +0000)]
Merge #4493

4493: Provide builtin impls of Fn traits for fn-pointers r=flodiebold a=hban

Meant to be, but isn't actually a fix for #2880.

Consider this snippet:

```rust
use std::marker::PhantomData;
use std::ops::Deref;

struct Lazy<T, F/* = fn() -> T*/>(F, PhantomData<T>);

impl<T, F> Lazy<T, F> {
    pub fn new(f: F) -> Lazy<T, F> {
        Lazy(f, PhantomData)
    }
}

impl<T, F: FnOnce() -> T> Deref for Lazy<T, F> {
    type Target = T;

    fn deref(&self) -> &T { todo!() }
}

fn test() {
    let lazy1: Lazy<u32, _> = Lazy::new(|| 0u32);
    let r1 = lazy1.to_string();

    fn make_u32_fn() -> u32 { todo!() }
    let make_u32_fn_ptr: fn() -> u32 = make_u32_fn;
    let lazy2: Lazy<u32, _> = Lazy::new(make_u32_fn_ptr);
    let r2 = lazy2.to_string();
}
```

* On current master:
  * When type default is commented-out, `r1` is correctly inferred, `r2` in _{unknown}_.
  * When type default is not commented-out, both `r1`  and `r2` are _{unknown}_.
* With this PR:
  * When type default is commented-out, both `r1` and `r2` are correctly inferred.
  * When type default is not commented-out, both `r1`  and `r2` are _{unknown}_.

Well, it's a improvement at least. I guess this thing with type defaults is a different problem.

I also tried add Fn impls for fn items, but wasn't successful. So this PR only adds those impls for fn pointers.

Co-authored-by: Hrvoje Ban <hban@users.noreply.github.com>
4 years agoMerge #4499
bors[bot] [Mon, 18 May 2020 07:37:04 +0000 (07:37 +0000)]
Merge #4499

4499: CodeLens configuration options r=vsrs a=vsrs

This PR
- adds an option to granularly enable\disable all CodeLens, just like the TypeScript extension.
- fixes a minor bug for doctests. It makes no sense to show `Debug` lens for them as cargo `Can't skip running doc tests with --no-run`.

Co-authored-by: vsrs <vit@conrlab.com>
4 years agoAdd "rust-analyzer.lens.enable"
vsrs [Mon, 18 May 2020 07:27:00 +0000 (10:27 +0300)]
Add "rust-analyzer.lens.enable"

4 years agoAdd more tests for Fn traits
Hrvoje Ban [Mon, 18 May 2020 06:07:31 +0000 (08:07 +0200)]
Add more tests for Fn traits

4 years agoMerge #4496
bors[bot] [Sun, 17 May 2020 22:16:57 +0000 (22:16 +0000)]
Merge #4496

4496: Relax VS Code version requirement r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRelax VS Code version requirement
Aleksey Kladov [Sun, 17 May 2020 13:57:30 +0000 (15:57 +0200)]
Relax VS Code version requirement

4 years agocode formatting
vsrs [Sun, 17 May 2020 17:38:50 +0000 (20:38 +0300)]
code formatting

4 years agoRunnable QuickPick with debuggees only
vsrs [Sun, 17 May 2020 17:29:59 +0000 (20:29 +0300)]
Runnable QuickPick with debuggees only

4 years agoCodeLens configuration options.
vsrs [Sun, 17 May 2020 16:51:44 +0000 (19:51 +0300)]
CodeLens configuration options.

4 years agoCreate LowerCtx on the fly
Edwin Cheng [Sun, 17 May 2020 15:37:30 +0000 (23:37 +0800)]
Create LowerCtx on the fly

4 years agoFix doctests in an Impl block
Coenen Benjamin [Sun, 17 May 2020 10:10:35 +0000 (12:10 +0200)]
Fix doctests in an Impl block

4 years agofix doctest inside impl block #4449
Benjamin Coenen [Sun, 17 May 2020 09:09:38 +0000 (11:09 +0200)]
fix doctest inside impl block #4449

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4473
bors[bot] [Sun, 17 May 2020 09:07:22 +0000 (09:07 +0000)]
Merge #4473

4473: Color macros r=matklad a=georgewfraser

Adds a fallback scope for macros. Before:

<img width="359" alt="Screen Shot 2020-05-15 at 7 31 03 PM" src="https://user-images.githubusercontent.com/1369240/82108339-a304d680-96e2-11ea-9521-e95d5d330c32.png">

After:

<img width="373" alt="Screen Shot 2020-05-15 at 7 29 58 PM" src="https://user-images.githubusercontent.com/1369240/82108308-81a3ea80-96e2-11ea-8660-7f6979df59bf.png">

Note how `hashset` in `maplit::hashset` is now yellow.

Fixes #4462

Co-authored-by: George Fraser <george@fivetran.com>
4 years agoMerge #4489
bors[bot] [Sat, 16 May 2020 23:06:23 +0000 (23:06 +0000)]
Merge #4489

4489: Memory allocation optimization r=matklad a=simonvandel

I did some profiling using DHAT, and this was what I could easily optimize without much knowledge of the codebase.

This speeds up analysis-stats on rust-analyser by ~4% on my local machine.

**Benchmark**
➜  rust-analyzer-base git:(master) hyperfine --min-runs=2 '/home/simon/Documents/rust-analyzer/target/release/rust-analyzer analysis-stats .' '/home/simon/Documents/rust-analyzer-base/target/release/rust-analyzer analysis-stats .'
Benchmark #1: /home/simon/Documents/rust-analyzer/target/release/rust-analyzer analysis-stats .
  Time (mean ± σ):     49.621 s ±  0.317 s    [User: 48.725 s, System: 0.792 s]
  Range (min … max):   49.397 s … 49.846 s    2 runs

Benchmark #2: /home/simon/Documents/rust-analyzer-base/target/release/rust-analyzer analysis-stats .
  Time (mean ± σ):     51.764 s ±  0.045 s    [User: 50.882 s, System: 0.756 s]
  Range (min … max):   51.733 s … 51.796 s    2 runs

Summary
  '/home/simon/Documents/rust-analyzer/target/release/rust-analyzer analysis-stats .' ran
    1.04 ± 0.01 times faster than '/home/simon/Documents/rust-analyzer-base/target/release/rust-analyzer analysis-stats .'

Co-authored-by: Simon Vandel Sillesen <simon.vandel@gmail.com>
4 years agofix doctest inside impl block #4449
Benjamin Coenen [Sat, 16 May 2020 22:43:42 +0000 (00:43 +0200)]
fix doctest inside impl block #4449

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4484
bors[bot] [Sat, 16 May 2020 21:59:26 +0000 (21:59 +0000)]
Merge #4484

4484: Allow calling dyn trait super trait methods without the super trait in scope r=flodiebold a=flodiebold

This also removes some vestiges of the old impl trait support which I think aren't currently in use.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
4 years agoReuse Vec allocations
Simon Vandel Sillesen [Sat, 16 May 2020 19:56:08 +0000 (21:56 +0200)]
Reuse Vec allocations

4 years agoReduce reallocations in ra_tt::buffer::TokenBuffer::new_inner
Simon Vandel Sillesen [Sat, 16 May 2020 16:24:17 +0000 (18:24 +0200)]
Reduce reallocations in ra_tt::buffer::TokenBuffer::new_inner

4 years agoShrink ra_parser::Event from 32 bytes to 16 bytes
Simon Vandel Sillesen [Sat, 16 May 2020 16:06:23 +0000 (18:06 +0200)]
Shrink ra_parser::Event from 32 bytes to 16 bytes

This boxes the Error variant with the assumption that it is rarely constructed

4 years agoMerge #4472
bors[bot] [Sat, 16 May 2020 19:49:01 +0000 (19:49 +0000)]
Merge #4472

4472: Fix path resolution for module and function with same name r=hasali19 a=hasali19

This fixes #3970 and also fixes completion for the same issue.

Co-authored-by: Hasan Ali <git@hasali.co.uk>
4 years agoAdd doc comment for resolve_hir_path_qualifier
Hasan Ali [Sat, 16 May 2020 19:40:58 +0000 (20:40 +0100)]
Add doc comment for resolve_hir_path_qualifier

4 years agoAllow calling dyn trait super trait methods without the super trait in scope
Florian Diebold [Sat, 16 May 2020 16:32:15 +0000 (18:32 +0200)]
Allow calling dyn trait super trait methods without the super trait in scope

This also removes some vestiges of the old impl trait support which I think
aren't currently in use.

4 years agoMerge #4479
bors[bot] [Sat, 16 May 2020 09:50:19 +0000 (09:50 +0000)]
Merge #4479

4479: Chalk upgrade r=matklad a=flodiebold

This includes the fix for `dyn Trait` super traits, but I noticed that still a lot of `db.super_trait_method()` calls don't work because the super trait isn't in scope (because it doesn't actually need to be). Somehow, I thought we handled that already, but I'll fix it in a separate PR. Also I'll see what happens if we use more of Chalk's new built-in types and traits in a separate PR.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
4 years agoChalk upgrade
Florian Diebold [Sat, 16 May 2020 08:49:43 +0000 (10:49 +0200)]
Chalk upgrade

4 years agoColor macros (fixes #4462)
George Fraser [Sat, 16 May 2020 02:27:18 +0000 (19:27 -0700)]
Color macros (fixes #4462)

4 years agoMerge #4288
bors[bot] [Sat, 16 May 2020 02:15:44 +0000 (02:15 +0000)]
Merge #4288

4288: Add rename self to parameter and back. r=zbsz a=zbsz

This is a first stab at #3439
I liked the idea to do this as a rename instead of separate assist, so I tried implementing that.
It mostly works, but I'm sure there are some cases that I missed, especially in regards to parameter type.

Note: I'm playing with this this as a way to learn Rust and this project. So I'm sure it could be cleaner and put in better places`. Any suggestions?

Co-authored-by: zbsz <zbigniewo@gmail.com>
4 years agoAdd 'self to parameter' renaming.
zbsz [Mon, 4 May 2020 05:12:18 +0000 (22:12 -0700)]
Add 'self to parameter' renaming.

4 years agoFix completion and hover for module and function of same name
Hasan Ali [Fri, 15 May 2020 21:23:49 +0000 (22:23 +0100)]
Fix completion and hover for module and function of same name

4 years agoMerge #4470
bors[bot] [Fri, 15 May 2020 20:25:42 +0000 (20:25 +0000)]
Merge #4470

4470: Handle `Self` in values and patterns r=matklad a=flodiebold

I.e.
 - `Self(x)` or `Self` in tuple/unit struct impls
 - `Self::Variant(x)` or `Self::Variant` in enum impls
 - the same in patterns

Fixes #4454.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
4 years agoHandle `Self` in values and patterns
Florian Diebold [Fri, 15 May 2020 15:15:40 +0000 (17:15 +0200)]
Handle `Self` in values and patterns

I.e.
 - `Self(x)` or `Self` in tuple/unit struct impls
 - `Self::Variant(x)` or `Self::Variant` in enum impls
 - the same in patterns

Fixes #4454.

4 years agoMerge #4448
bors[bot] [Fri, 15 May 2020 14:29:01 +0000 (14:29 +0000)]
Merge #4448

4448: Generate configuration for launch.json r=vsrs a=vsrs

This PR adds two new commands: `"rust-analyzer.debug"` and `"rust-analyzer.newDebugConfig"`. The former is a supplement to the existing `"rust-analyzer.run"` command and works the same way: asks for a runnable and starts new debug session. The latter allows adding a new configuration to **launch.json** (or to update an existing one).

If the new option `"rust-analyzer.debug.useLaunchJson"` is set to true then `"rust-analyzer.debug"` and Debug Lens will first look for existing debug configuration in **launch.json**. That is, it has become possible to specify startup arguments, env variables, etc.

`"rust-analyzer.debug.useLaunchJson"` is false by default, but it might be worth making true the default value. Personally I prefer true, but I'm not sure if it is good for all value.

----
I think that this PR also solves https://github.com/rust-analyzer/rust-analyzer/issues/3441.
Both methods to update launch.json mentioned in the issue do not work:
1. Menu. It is only possible to add a launch.json configuration template via a debug adapter. And anyway it's only a template and it is impossible to specify arguments from an extension.

2. DebugConfigurationProvider. The exact opposite situation: it is possible to specify all debug session settings, but it is impossible to export these settings to launch.json.

Separate `"rust-analyzer.newDebugConfig"` command looks better for me.

----
Fixes #4450
Fixes #3441

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: vsrs <62505555+vsrs@users.noreply.github.com>
4 years agoFix occasional test run during debug configuration
vsrs [Fri, 15 May 2020 12:31:09 +0000 (15:31 +0300)]
Fix occasional test run during debug configuration

4 years agoMerge #4431
bors[bot] [Fri, 15 May 2020 10:17:42 +0000 (10:17 +0000)]
Merge #4431

4431: Store proc-macro result in salsa db r=matklad a=edwin0cheng

Fixed #4315

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoMerge #4460
bors[bot] [Fri, 15 May 2020 00:10:58 +0000 (00:10 +0000)]
Merge #4460

4460: Remove flycheck -> LSP dependency r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoCleanups
Aleksey Kladov [Fri, 15 May 2020 00:08:50 +0000 (02:08 +0200)]
Cleanups

4 years agoBetter structure
Aleksey Kladov [Thu, 14 May 2020 23:58:39 +0000 (01:58 +0200)]
Better structure

4 years agoMove LSP bits from flycheck to rust-analyzer
Aleksey Kladov [Thu, 14 May 2020 23:51:48 +0000 (01:51 +0200)]
Move LSP bits from flycheck to rust-analyzer

There should be only one place that knows about LSP, and that place is
right before we spit JSON on stdout.

4 years agoFix runnable naming in the client side fallback.
vsrs [Thu, 14 May 2020 14:32:24 +0000 (17:32 +0300)]
Fix runnable naming in the client side fallback.

4 years agoMerge #4273
bors[bot] [Thu, 14 May 2020 14:29:22 +0000 (14:29 +0000)]
Merge #4273

4273: Trigger add_vis assist on paths/record fields as well r=flodiebold a=TimoFreiberg

Resolves #4037.

- [x] Function defs
- [x] ADT defs
- [x] Enum variants
- [x] Consts
- [x] Statics
- [x] Traits
- [x] Type aliases
- [x] Modules
- [x] Record fields (using different implementation)
    - [x] struct fields
    - [x] enum variant fields
    - :x:  union fields (`Semantics::resolve_record_field` seems to not work for union fields, so I think this can be handled in a future PR)
- [x] More tests?
- [x] Improve test fixture code and documentation a bit (see [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/resolve_path.20between.20fixture.20files))

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
4 years agoMerge #4456
bors[bot] [Thu, 14 May 2020 13:36:56 +0000 (13:36 +0000)]
Merge #4456

4456: Sort preselect items on top r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMinor
Aleksey Kladov [Thu, 14 May 2020 13:36:15 +0000 (15:36 +0200)]
Minor

4 years agoPut preselect items on top
Aleksey Kladov [Thu, 14 May 2020 13:29:40 +0000 (15:29 +0200)]
Put preselect items on top

4 years agoBetter label for a runnable.
vsrs [Thu, 14 May 2020 13:28:18 +0000 (16:28 +0300)]
Better label for a runnable.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMerge #4455
bors[bot] [Thu, 14 May 2020 13:18:22 +0000 (13:18 +0000)]
Merge #4455

4455: Prioritize locals with correct types r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoPrioritize locals with correct types
Aleksey Kladov [Thu, 14 May 2020 13:15:52 +0000 (15:15 +0200)]
Prioritize locals with correct types

4 years agoMultiple binaries support for launch.json.
vsrs [Thu, 14 May 2020 13:02:01 +0000 (16:02 +0300)]
Multiple binaries support for launch.json.

Generate unique names on the LSP side.

4 years agoMixed "bin" and "test" artifacts workaround.
vsrs [Thu, 14 May 2020 11:42:40 +0000 (14:42 +0300)]
Mixed "bin" and "test" artifacts workaround.

4 years agoMerge #4445
bors[bot] [Thu, 14 May 2020 11:20:42 +0000 (11:20 +0000)]
Merge #4445

4445: Correctly fill default type parameters r=flodiebold a=montekki

Fixes #3877

So, basically even if the parameters are omitted from the `impl` block, check the parameters in `trait` if they have a default type, and if they do go from `hir` to `ast::TypeArg`. I've added a helper for that but I am not sure that it's a proper way to go from `hir` to `ast` here.

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
4 years agoTy -> Type
Fedor Sakharov [Thu, 14 May 2020 10:53:45 +0000 (13:53 +0300)]
Ty -> Type

4 years agoMultiple binaries support for launch.json.
vsrs [Thu, 14 May 2020 10:48:02 +0000 (13:48 +0300)]
Multiple binaries support for launch.json.

4 years agoAdds a param_idx helper
Fedor Sakharov [Thu, 14 May 2020 10:47:36 +0000 (13:47 +0300)]
Adds a param_idx helper

4 years agoFix "rust-analyzer.debug" for QuickPick binaries.
vsrs [Thu, 14 May 2020 10:30:05 +0000 (13:30 +0300)]
Fix "rust-analyzer.debug" for  QuickPick binaries.

4 years agoRunnable quick pick with buttons
vsrs [Thu, 14 May 2020 10:22:52 +0000 (13:22 +0300)]
Runnable quick pick with buttons

4 years agoStore proc-macro result in salsa db
Edwin Cheng [Thu, 14 May 2020 09:57:37 +0000 (17:57 +0800)]
Store proc-macro result in salsa db

4 years agoMerge #4405
bors[bot] [Thu, 14 May 2020 09:23:34 +0000 (09:23 +0000)]
Merge #4405

4405: Make some stuff public so that they can be reused by other tools r=pksunkara a=pksunkara

So, my little experiment of building a code analysis tool using rust-analyzer is successful. I am going to proceed to build the tool now. This PR makes the needed things public.

I know there were some things about trying to change stuff regarding loading workspaces, which would make it more easier for other tools to reuse. But, until then, it should be okay using this `load_cargo` fn.

Btw, if I were publish my tool, I would need the `ra` crates to be released. Since @matklad told me that he doesn't want to care about breaking stuff, I would propose the following.

Every monday, during the weekly release, we release a new pre v1 minor version of all the crates. That way, we don't need to care about breaking stuff but still have rust-analyzer on crates.io.

I made https://github.com/pksunkara/cargo-workspaces to help release workspace crates easily.

So, coming week, we start with `0.1.0`, then week after that, we release `0.2.0` and then `0.3.0` etc.. until we decide on `1.0.0` which is probably when the compiler team also starts using the crates. There is no limit to the minor versions (we can even have `0.150.0` or `0.1500.0`), so I don't see anything wrong with this strategy.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>