Commit Graph

892 Commits

Author SHA1 Message Date
Lukas Wirth
78fe6133c4 Split punctuation semantic highlighting up into more tags 2021-01-10 13:33:03 +01:00
Aleksey Kladov
3dfa2768ac Shorten names 2021-01-09 14:48:15 +03:00
Aleksey Kladov
64a6ee4535 Shorten frequent names 2021-01-09 14:44:01 +03:00
Aleksey Kladov
6fb52af521 Rename dummy -> none 2021-01-09 14:41:31 +03:00
Aleksey Kladov
e30c1c3fbf Simplify highlighting infra
This also fixes the killer whale bug
2021-01-08 23:47:35 +03:00
bors[bot]
4ddf075673
Merge #7193
7193: Show progress for fetching workspace (cargo-metadata and loadOutDirsFromCheck) r=matklad a=edwin0cheng


![Peek 2021-01-07 21-57](https://user-images.githubusercontent.com/11014119/103902132-0db4c780-5135-11eb-94d3-32429445be87.gif)


Fixes #7188 
Fixes #3300

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-07 18:07:01 +00:00
Edwin Cheng
2b2d699b35 Report progress for cargo metadata and output-dir 2021-01-08 01:18:58 +08:00
bors[bot]
7967ce85cf
Merge #7184
7184: Changes Cursor Marker To $0 r=matklad a=kevaundray



Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
2021-01-07 12:27:17 +00:00
Kevaundray Wedderburn
72b9a4fbd3 Change <|> to $0 - Rebase 2021-01-07 12:09:23 +00:00
Aleksey Kladov
037caec62c Use american spelling for config
As per

171c3c08fe/docs/dev/style.md (variable-naming)

Also implement config aliasing, for pain-free settings migrations in the future
2021-01-07 15:07:19 +03:00
Aleksey Kladov
c8ace3a295 Remove some stale deprecations 2021-01-07 13:54:18 +03:00
Aleksey Kladov
f8a0561178 Align config's API with usage
The config now is mostly immutable, optimize for that.
2021-01-06 21:22:24 +03:00
Aleksey Kladov
6e87828756 YAGNI active_resolve_capabilities
This leaks a lot of LSP details into ide layer, which we want to avoid:

c9cec381bc/docs/dev (lsp-independence)

Additionally, all what this infra does is providing a toggle for
auto-import completion, but we already have one!
2021-01-06 20:23:53 +03:00
Aleksey Kladov
edf03548e3 More readable test 2021-01-06 18:36:13 +03:00
Aleksey Kladov
66ed821e18 Speed up snapshoting
Config can be fairly big, no need to deep clone it frequently
2021-01-06 15:46:31 +03:00
Aleksey Kladov
f7a15b5cd1 More maintainable config
Rather than eagerly converting JSON, we losslessly keep it as is, and
change the shape of user-submitted data at the last moment.

This also allows us to remove a bunch of wrong Defaults
2021-01-06 15:39:28 +03:00
bors[bot]
c310446659
Merge #7174
7174: Normalize line endings when formatting r=matklad a=Jesse-Bakker

Fixes #7166


Co-authored-by: Jesse Bakker <github@jessebakker.com>
2021-01-06 09:03:38 +00:00
Jesse Bakker
c49d5f757c Normalize line endings when formatting 2021-01-05 23:58:51 +01:00
Aleksey Kladov
624eb1ee54 More maintainable caps config
The idea here is that we preserve client's config as is, without
changes. This gets rid of state!
2021-01-05 17:46:57 +03:00
Aleksey Kladov
d7741d1610 Allow #anchor linking of config options 2021-01-05 13:09:06 +03:00
Lukas Wirth
5804b3fae8 Fix HoverAction::Implementation typo 2021-01-04 14:38:08 +01:00
Jesse Bakker
c7e0c7f43a Upgrade expect-test to 1.1 2021-01-03 14:43:29 +01:00
bors[bot]
1cc73d60bb
Merge #7068
7068: Add VSCode command to view the hir of a function body r=theotherphil a=theotherphil

Will fix https://github.com/rust-analyzer/rust-analyzer/issues/7061. Very rough initial version just to work out where I needed to wire everything up.

@matklad would you be happy merging a hir visualiser of some kind? If so, do you have any thoughts on what you'd like it show, and how?

I've spent very little time on this thus far, so I'm fine with throwing away the contents of this PR, but I want to avoid taking the time to make this more polished/interactive/useful only to discover that no-one else has any interest in this functionality.

![image](https://user-images.githubusercontent.com/1974256/103236081-bb58f700-493b-11eb-9d12-55ae1b870f8f.png)


Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
2021-01-03 09:03:15 +00:00
bors[bot]
520b8a5a4d
Merge #7115
7115: Migrate HasSource::source to return Option r=matklad a=nick96

I've made a start on fixing #6913 based on the provided work plan, migrating `HasSource::source` to return an `Option`. The simple cases are migrated but there are a few that I'm unsure exactly how they should be handled:

- Logging the processing of functions in `AnalysisStatsCmd::run`: In verbose mode it includes the path to the module containing the function and the syntax range. I've handled this with an if-let but would it be better to blow up here with `expect`? I'm not 100% on the code paths but if we're processing a function definition then the source should exist.

I've handled `source()` in all code paths as `None` being a valid return value but are there some cases where we should just blow up? Also, all I've done is bubble up the returned `None`s, there may be some places where we can recover and still provide something.

Co-authored-by: Nick Spain <nicholas.spain@stileeducation.com>
Co-authored-by: Nick Spain <nicholas.spain96@gmail.com>
2021-01-03 08:56:17 +00:00
cynecx
59fe884ef5 Fix warnings on rust-nightly 2021-01-02 20:48:39 +01:00
Nick Spain
562e2ee28a Only log path and syntax range when processing function if source exists 2021-01-02 21:53:52 +11:00
Nick Spain
ea4708c444 Mark HasSource::source_old as deprecated but allow at all call sites 2021-01-02 21:53:51 +11:00
Nick Spain
27cadcd531 HasSource::source -> HasSource::source_old
To start migrating HasSource::source to return an Option.
2021-01-02 21:53:51 +11:00
Mara Bos
273d2f9123 Formatting. 2021-01-01 17:31:32 +01:00
Mara Bos
4833972067 Add support for Rust 2021. 2021-01-01 17:22:23 +01:00
bors[bot]
0e5fe47153
Merge #7080
7080: Implement ConstParams for HIR r=Veykril a=Veykril

r? @flodiebold 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-01 13:45:10 +00:00
Lukas Wirth
18bf2e5af5 Add ConstParams to the ide layer 2021-01-01 14:43:16 +01:00
bors[bot]
0a3d08e2e3
Merge #7106
7106: Split textDocument/formatting TextEdit with diff r=matklad a=Jesse-Bakker

#7044 

Co-authored-by: Jesse Bakker <github@jessebakker.com>
2020-12-31 15:11:14 +00:00
Jesse Bakker
f355a6d831 Split textDocument/formatting TextEdit with diff 2020-12-31 15:33:20 +01:00
Daniel Silverstone
5ce420ac84
handle_formatting: Notice if rustfmt is missing and report
In an attempt to fix #6052 and #4249 this attempts to detect
if rustfmt is a rustup proxy which isn't installed, and reports
the error message to the user for them to fix.

In theory this ought to be memoised but for now it'll do as-is.

Future work might be to ask the user if they would like us to
trigger the installation (if possible).

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-12-31 10:25:51 +00:00
kjeremy
dc1396eec7 Update crates 2020-12-30 10:39:50 -05:00
Laurențiu Nicola
42c24ff25f Avoid a couple of allocations 2020-12-29 14:35:49 +02:00
Phil Ellison
077592a12f Initial implementation of view-hir command 2020-12-28 18:29:58 +00:00
Aleksey Kladov
2f22675537 Simplify assists resolution API
Assist vs UnresolvedAssist split doesn't really pull its weight. This
is especially bad if we want to include `Assist` as a field of
diagnostics, where we'd have to make the thing generic.
2020-12-26 14:11:42 +03:00
bors[bot]
581419fd78
Merge #7030
7030: Support labels in reference search r=matklad a=Veykril

Implements general navigation for labels, goto def, rename and gives labels their own semantic highlighting class.

Fixes #6966

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-24 14:46:41 +00:00
Lukas Wirth
42e3f97c30 Support labels in reference search 2020-12-24 15:40:18 +01:00
bors[bot]
a31ee54afa
Merge #7029
7029: Flush stdout when clearing the progress bar r=lnicola a=lnicola

To prevent this from happening:

```
Database loaded 496.24ms, 288mi
Crates in this dir: 1
Total modules found: 14
Total declarations: 159
Total functions: 122
Item Collection: 6.02s, 61846mi
122/122 100% processing: archive::sizeTotal expressions: 6592       
Expressions of unknown type: 4 (0%)
Expressions of partially unknown type: 104 (1%)
Type mismatches: 3
Inference: 1.03s, 8622mi
Total: 7.05s, 70468mi
```

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-24 13:40:29 +00:00
Laurențiu Nicola
b21a79364a Flush stdout when clearing the progress bar 2020-12-24 15:38:45 +02:00
Aleksey Kladov
33384d289e pit-of-success API for unresolved code actions 2020-12-24 15:32:29 +03:00
Jeremy Kolb
4f989cfa08 Implement workspace/willRenameFiles for single-level file moves
Renames modules during file rename if they're in the same directory.
2020-12-23 07:47:31 -05:00
bors[bot]
27ccde9ce9
Merge #7019
7019: Try serde_path_to_error for LSP InitializeParams r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-23 12:04:32 +00:00
Laurențiu Nicola
4e89c2a664 Try serde_path_to_error for LSP InitializeParams 2020-12-23 13:21:58 +02:00
Aleksey Kladov
2ec92b3dc3 Make code more direct
* Push control flow outwards, as per
  https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#preconditions

* Don't re-do the work, pass-in the arguments
2020-12-23 13:51:30 +03:00
Aleksey Kladov
3ced546033 Make code more understandable
Avoid mutation of snapshot's config -- that's spooky action at a
distance. Instead, copy it over to a local variable.

This points out a minor architecture problem, which we won't fix right
away.

Various `ide`-level config structs, like `AssistConfig`, are geared
towards one-shot use when calling a specific methods. On the other
hand, the large `Config` struct in `rust-analyzer` is a long-term
config store.

The fact that `Config` stores `AssistConfig` is accidental -- a better
design would probably be to just store `ConfigData` inside `Config`
and create various `Config`s on the fly out of it.
2020-12-23 13:16:24 +03:00
Aleksey Kladov
e1aca75974 Rename for clarity 2020-12-23 13:14:05 +03:00