Commit Graph

18453 Commits

Author SHA1 Message Date
Aleksey Kladov
12d7f5b56e internal: explain that we don't ref in style.md 2021-08-02 15:59:28 +03:00
Aleksey Kladov
5f3662e01c minor: encode usage convention into API 2021-08-02 15:28:39 +03:00
Aleksey Kladov
8b6ea1545f simplify 2021-08-02 14:27:11 +03:00
Aleksey Kladov
71cd67fe47 failing test 2021-08-02 14:27:11 +03:00
bors[bot]
df0936b4af
Merge #9750
9750: Link “DST” to its definition r=lnicola a=gthb

Being new to Rust I wasn't familiar with this acronym and found it hard to guess (the context of syntax trees biased me to reading it as a D-something Syntax Tree and trying to guess what the D was), hard to google (in retrospect googling "rust dst" does the job, but I thought it was an abstract structure thing, not Rust-specific), and hard to Github-search, because `dst` is commonly short for “destination” in code.

Alternatively `<abbr title="dynamically sized type">DST</abbr>` would be about as helpful.

Co-authored-by: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
2021-08-01 14:40:44 +00:00
Gunnlaugur Thor Briem
4930e5d74d
Link “DST” to its definition
Being new to Rust I wasn't familiar with this acronym and found it hard to guess (the context of syntax trees biased me to reading it as a D-something Syntax Tree and trying to guess what the D was), hard to google (in retrospect googling "rust dst" does the job, but I thought it was an abstract structure thing, not Rust-specific), and hard to Github-search, because `dst` is commonly short for “destination” in code.

Alternatively `<abbr title="dynamically sized type">DST</abbr>` would be about as helpful.
2021-08-01 14:37:16 +00:00
bors[bot]
a793a0098d
Merge #9749
9749: Exclude `rust-analyzer.server.path` from VS Code's sync feature r=lnicola a=brainplot

By changing the scope of this configuration to `machine-overridible`, this setting becomes fully local for the VS Code instance the user is running.

Having this setting excluded from syncing should help avoid inconveniences for users who have VS Code installed on two different operating systems, where the paths to the language server binary would very likely mismatch.

Co-authored-by: Gianluca Recchia <gianluca.recchia@protonmail.com>
2021-08-01 10:11:07 +00:00
Gianluca Recchia
93433364ab
Exclude rust-analyzer.server.path from VS Code's sync feature
By changing the scope of this configuration to `machine-overridible`,
this setting becomes fully local for the VS Code instance the user is
running.

Having this setting excluded from syncing should help avoid
inconveniences for users who have VS Code installed on two different
operating systems, where the paths to the language server binary would
very likely mismatch.
2021-08-01 12:00:41 +02:00
bors[bot]
4118733f33
Merge #9747
9747: fix: Wrap inner tail expressions in MissingOkOrSomeInTailExpr r=Veykril a=Veykril

Fixes #8512

Also fixes a bug in for_each_tail_expr not visiting `else if` chains

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-31 18:27:41 +00:00
Lukas Wirth
1edbaa29f9 Wrap inner tail expressions in MissingOkOrSomeInTailExpr 2021-07-31 20:00:09 +02:00
bors[bot]
eb513c22f7
Merge #9746
9746: internal: add API to check what are the max limits in practice r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-31 15:27:11 +00:00
Aleksey Kladov
f952dc61d1 internal: add API to check what are the max limits in practice 2021-07-31 18:26:43 +03:00
bors[bot]
93873b0ce1
Merge #9739
9739: generate function assist favors deref cmpt types r=matklad a=mahdi-frms

Fixes #9713

Although that's still not relying on sematic info.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-07-31 15:08:29 +00:00
bors[bot]
a423b307e6
Merge #9744
9744: fix: Annotate type hints for pattern name ranges instead of the pattern itself r=Veykril a=Veykril

The current type hints do not go well with `bindings_after_at` which is likely to land with 1.56(https://github.com/rust-lang/rust/pull/85305 🎉very excited for this), hence annotate the names of ident patterns instead of the entire pattern.

This changes where the typehints go for ident patterns that use @ bindings, some example comparisons:

Before:
![Code_82ILMppkve](https://user-images.githubusercontent.com/3757771/127741276-e1dd173b-2964-4df0-abae-860283b2e1be.png)
After:
![Code_tPttN2rJpw](https://user-images.githubusercontent.com/3757771/127741277-e7fc2836-4f31-4c45-a3a9-69cbff3d52d9.png)

This change has no visible effect on patterns without ``@`` bindings.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-31 13:41:04 +00:00
Lukas Wirth
f7c7f89c3c Annotate type hints for pattern name ranges instead of the pattern itself 2021-07-31 15:30:45 +02:00
bors[bot]
6b733eac67
Merge #9743
9743: internal: a bit of completion profiling r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-31 13:23:00 +00:00
Aleksey Kladov
a5049e13bf internal: make non-zero times stand out in profile 2021-07-31 16:22:03 +03:00
Aleksey Kladov
08756012a5 internal: document query implication of completion rendering 2021-07-31 16:13:15 +03:00
Aleksey Kladov
d4e381f7b2 minor: follow code style 2021-07-31 16:05:07 +03:00
bors[bot]
3236845d67
Merge #9742
9742: fix: Fix hover range for derive inputs r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-31 13:00:09 +00:00
Lukas Wirth
b363755901 Fix hover range for derive inputs 2021-07-31 14:59:31 +02:00
bors[bot]
bcc3241c9e
Merge #9741
9741: minor: Replace useless types r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-31 12:30:09 +00:00
Lukas Wirth
7c7c4543da Replace useless types 2021-07-31 14:29:15 +02:00
bors[bot]
0cf28cedef
Merge #9740
9740: feat: `add_explicit_type` is applicable for closure parameters r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8886
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-31 12:05:41 +00:00
Lukas Wirth
778e6e8ba8 add_explicit_type is applicable for closure parameters 2021-07-31 14:04:34 +02:00
mahdi-frms
a5edf6de79 generate function assist favors deref cmpt types 2021-07-31 16:34:09 +04:30
bors[bot]
6aeaceaf45
Merge #9737
9737: minor: Bump deps r=lnicola a=lnicola

Upgrade `rowan` and avoid the duplicate `object` dependency.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-31 09:05:06 +00:00
Laurențiu Nicola
90e05ba57e Bump deps 2021-07-31 11:25:03 +03:00
bors[bot]
4281cbe89f
Merge #9736
9736: ⬆️ crates r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-31 07:25:34 +00:00
Aleksey Kladov
89d4b9a95a ⬆️ crates 2021-07-31 10:25:13 +03:00
bors[bot]
14f00adcb1
Merge #9733
9733: internal: cleanup lsp-extensions docs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-30 16:51:16 +00:00
Aleksey Kladov
2229cfcf48 internal: cleanup lsp-extensions docs 2021-07-30 19:50:39 +03:00
bors[bot]
33f12a3608
Merge #9732
9732: feat: gate custom clint-side commands behind capabilities r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-30 16:27:10 +00:00
Aleksey Kladov
be84f85c1d feat: gate custom clint-side commands behind capabilities
Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.

Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.

That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.

To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.

So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.
2021-07-30 19:16:33 +03:00
bors[bot]
1f817833e7
Merge #9727
9727: internal: Simplify extract_function assist r=Veykril a=Veykril

also fixes #7839(blocked on #9728)

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:56:50 +00:00
Lukas Wirth
3e351cc0ba Add trailing comma when extracting match arm expressions into functions 2021-07-30 16:48:13 +02:00
bors[bot]
4cc961007f
Merge #9731
9731: feat: Add `replace_char_with_string` assist r=Veykril a=Veykril

Adds the counterpart for the `replace_string_with_char` assist and fixes the assist not escaping the `'` in the string `"'"` when transforming that to a char.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:47:38 +00:00
Lukas Wirth
17a47a830b Add replace_char_with_string assist 2021-07-30 16:46:06 +02:00
bors[bot]
0a3ac7a96c
Merge #9728
9728: fix: Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:11:37 +00:00
Lukas Wirth
82c1e61887 Fix assists assuming comma belonging to MATCH_ARM_LIST 2021-07-30 16:01:26 +02:00
bors[bot]
956e205417
Merge #9730
9730: minor: drop impl-specific stuff from lsp docs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-30 13:38:38 +00:00
Aleksey Kladov
68836c0dbe minor: drop impl-specific stuff from lsp docs
The lc. prefix is a copy-paste from our typescript code, it doesn't make
sense in the impl-agnostic docs.
2021-07-30 16:37:41 +03:00
Lukas Wirth
f04cff102f Simplify 2021-07-30 13:12:52 +02:00
Lukas Wirth
836784f02b Fix move_item test fixture indentations 2021-07-30 13:03:28 +02:00
Lukas Wirth
4de447b293 Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST 2021-07-29 23:02:52 +02:00
Lukas Wirth
322513b06c Reorder definitions in extract_function 2021-07-29 22:10:40 +02:00
Lukas Wirth
b21f66fce3 Simplify extract_function assist 2021-07-29 22:07:56 +02:00
bors[bot]
8232804d3e
Merge #9706
9706: minor: perf and grammar fixes r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-29 16:14:10 +00:00
bors[bot]
8a6bac3fc8
Merge #9724
9724: internal: Use more strictly typed syntax nodes for analysis in extract_function assist r=Veykril a=Veykril

This also prevents it from looking into local items unnecessarily(which might even cause problems in some cases)
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-29 15:27:03 +00:00
Lukas Wirth
b537cb186e Use more strictly typed syntax nodes for analysis in extract_function assist 2021-07-29 17:26:37 +02:00