Commit Graph

10304 Commits

Author SHA1 Message Date
vsrs
cd45c73b66 JFF, ra_fixture arg name for a code highlighting 2020-05-16 17:27:23 +03:00
vsrs
7e9c7ac4ee smoke test 2020-05-16 16:56:41 +03:00
vsrs
2c00bd8c6a Propogate fixture meta to AnalysisHost
Except crate name.
2020-05-16 15:23:43 +03:00
vsrs
2dde9b1994 Use FixtureMeta in MockAnalysis 2020-05-16 13:17:21 +03:00
bors[bot]
9322790066
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>
2020-05-16 09:50:19 +00:00
Florian Diebold
050601ef7b Chalk upgrade 2020-05-16 11:43:48 +02:00
vsrs
256fb7556e Remove temporary FixtureEntry parsed_meta field. 2020-05-16 12:25:26 +03:00
vsrs
d901e0e709 Reimplement ra_db::fixture::ParsedMeta
in terms of test_utils::FixtureMeta
2020-05-16 11:57:41 +03:00
vsrs
eeb98237d1 parse fixture meta in test_utils crate 2020-05-16 11:16:32 +03:00
George Fraser
fd83d0e9ba Color macros (fixes #4462) 2020-05-15 19:27:18 -07:00
bors[bot]
5dcaf108c2
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>
2020-05-16 02:15:44 +00:00
zbsz
d7d8bfc472 Add 'self to parameter' renaming. 2020-05-15 19:05:59 -07:00
Hasan Ali
001a86dc03 Fix completion and hover for module and function of same name 2020-05-16 01:09:04 +01:00
bors[bot]
cffa70be01 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>
2020-05-15 20:25:42 +00:00
Florian Diebold
3f42b2e837 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.
2020-05-15 17:25:28 +02:00
bors[bot]
d51c1f6217
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>
2020-05-15 14:29:01 +00:00
vsrs
a4ecaa7096 Fix occasional test run during debug configuration 2020-05-15 15:31:09 +03:00
bors[bot]
982b92f966
Merge #4431
4431: Store proc-macro result in salsa db r=matklad a=edwin0cheng

Fixed #4315 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-15 10:17:42 +00:00
bors[bot]
05db35dafb
Merge #4460
4460: Remove flycheck -> LSP dependency r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-15 00:10:58 +00:00
Aleksey Kladov
08027c3075 Cleanups 2020-05-15 02:09:30 +02:00
Aleksey Kladov
f1a5c489fd Better structure 2020-05-15 01:58:39 +02:00
Aleksey Kladov
220813dcb0 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.
2020-05-15 01:52:25 +02:00
vsrs
abef76bc87 Fix runnable naming in the client side fallback. 2020-05-14 17:33:49 +03:00
bors[bot]
12d82687cd
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
    -   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>
2020-05-14 14:29:22 +00:00
bors[bot]
87470e8f13
Merge #4456
4456: Sort preselect items on top r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-14 13:36:56 +00:00
Aleksey Kladov
acedad8134 Minor 2020-05-14 15:36:15 +02:00
Aleksey Kladov
fc0c5dfcd1 Put preselect items on top 2020-05-14 15:33:56 +02:00
vsrs
51d5a08255
Better label for a runnable.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-14 16:28:18 +03:00
bors[bot]
d7c451ed95
Merge #4455
4455: Prioritize locals with correct types r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-14 13:18:22 +00:00
Aleksey Kladov
90c62bcee9 Prioritize locals with correct types 2020-05-14 15:15:52 +02:00
vsrs
20fdd14c62 Multiple binaries support for launch.json.
Generate unique names on the LSP side.
2020-05-14 16:02:01 +03:00
vsrs
5f6cdae18f Mixed "bin" and "test" artifacts workaround. 2020-05-14 14:42:40 +03:00
bors[bot]
f1587ac263
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>
2020-05-14 11:20:42 +00:00
Fedor Sakharov
ccd5268374
Ty -> Type 2020-05-14 13:53:45 +03:00
vsrs
af7c50f8a2 Multiple binaries support for launch.json. 2020-05-14 13:48:02 +03:00
Fedor Sakharov
12bf008ab1
Adds a param_idx helper 2020-05-14 13:47:36 +03:00
vsrs
a233346a2d Fix "rust-analyzer.debug" for QuickPick binaries. 2020-05-14 13:30:05 +03:00
vsrs
be9b0609d5 Runnable quick pick with buttons 2020-05-14 13:22:52 +03:00
Edwin Cheng
20f7068b68 Store proc-macro result in salsa db 2020-05-14 17:57:51 +08:00
bors[bot]
5148d6dc66
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>
2020-05-14 09:23:34 +00:00
Pavan Kumar Sunkara
9f0a7eb97b Make some stuff public so that they can be reused by other tools 2020-05-14 11:14:46 +02:00
bors[bot]
6fde7f1b6b
Merge #4432
4432: Update features.md r=matklad a=bnjjj



Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
2020-05-14 08:28:32 +00:00
vsrs
3ffc26eaeb Remove "rust-analyzer.debug.useLaunchJson" option 2020-05-14 11:12:10 +03:00
Fedor Sakharov
2dfbec149f
Fix formatting 2020-05-14 10:31:34 +03:00
Fedor Sakharov
7e9396c7eb
Change type_arg to type_ref func 2020-05-14 10:14:04 +03:00
Fedor Sakharov
a55ad20388
Use generic_defaults and display_source_code 2020-05-14 09:56:20 +03:00
bors[bot]
62730ae30d
Merge #4452
4452: Use back ticks instead of single quotes around code r=matklad a=tspiteri

Also, use back ticks instead of single quotes in `rustc_unescape_error_to_string` for `EE:UnclosedUnicodeEscape`.

Co-authored-by: Trevor Spiteri <tspiteri@ieee.org>
2020-05-13 23:10:05 +00:00
Trevor Spiteri
2d0a949236 Use back ticks instead of single quotes around code 2020-05-14 01:06:07 +02:00
bors[bot]
530a35f3f9
Merge #4447
4447: Remove VARIATION SELECTOR-16 in Run arrow r=matklad a=lnicola

Closes #4446, cc @Veetaha.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-13 17:15:31 +00:00
bors[bot]
c07050e275
Merge #4400
4400: Enhanced coloring r=georgewfraser a=georgewfraser

This PR builds on #4397 to enhance the existing syntax coloring. 

## Underline mutable variables

The textmate scope `markup.underline` underlines identifiers, which is a nice way to make mutable vars stand out:

<img width="327" alt="Screen Shot 2020-05-09 at 1 18 55 PM" src="https://user-images.githubusercontent.com/1369240/81484179-8bb47d80-91f8-11ea-997d-1dcffbe44aa7.png">

## Italicize static variables

The textmate scope `markup.italic` italicizes identifiers. Italic = static is a common convention in IDEs like IntelliJ:

<img width="288" alt="Screen Shot 2020-05-09 at 1 19 14 PM" src="https://user-images.githubusercontent.com/1369240/81484236-cd452880-91f8-11ea-8478-505ee49bc8b3.png">


Co-authored-by: George Fraser <george@fivetran.com>
2020-05-13 15:43:32 +00:00