Commit graph

13524 commits

Author SHA1 Message Date
Aleksey Kladov
81ac99f60a Simplify code 2020-11-12 11:45:18 +01:00
bors[bot]
802665873d
Merge #6531
6531: Update crates r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-12 10:23:40 +00:00
Aleksey Kladov
f73b874157 Update tests 2020-11-12 11:19:26 +01:00
kjeremy
3b9d164043 Update crates 2020-11-11 11:17:48 -05:00
bors[bot]
b7bd0bb55d
Merge #6530
6530: Do not use yanked once_cell r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-11 16:03:42 +00:00
kjeremy
f32be79296 Do not use yanked once_cell 2020-11-11 11:02:49 -05:00
Xavier Denis
16443760a3 Reorder rustc_private loading 2020-11-11 13:04:27 +01:00
Xavier Denis
8716087919 Add support for loading rustc private crates 2020-11-11 12:45:40 +01:00
bors[bot]
23c9f5b87e
Merge #6526
6526: Replace RacyFlag with OnceCell r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-11 02:13:46 +00:00
Aleksey Kladov
731f7bfc02 Replace RacyFlag with OnceCell 2020-11-11 03:11:40 +01:00
bors[bot]
111cc34c8f
Merge #6523
6523: Be more pedantic when checking codeAction/resolve support r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-10 19:39:27 +00:00
Aleksey Kladov
0caa491893 Be more pedantic when checking codeAction/resolve support 2020-11-10 20:38:34 +01:00
bors[bot]
5c06e820fa
Merge #6521
6521: Switch to upstream protocol for resolving code action r=matklad a=matklad

Note that we have to maintain custom implementation on the client
side: I don't see how to marry bulitin resolve support with groups and
snippets.


Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-10 17:53:10 +00:00
Aleksey Kladov
7d2eb000b0 Switch to upstream protocol for resolving code action
Note that we have to maintain custom implementation on the client
side: I don't see how to marry bulitin resolve support with groups and
snippets.
2020-11-10 18:48:46 +01:00
bors[bot]
ada5a88f8f
Merge #6512
6512: Don't replace parent node when inserting as first child in algo::diff r=SomeoneToIgnore a=Veykril

This makes the diff a bit more detailed.

See https://github.com/rust-analyzer/rust-analyzer/pull/6287#issuecomment-723889267 for context
cc @SomeoneToIgnore 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-09 23:41:43 +00:00
bors[bot]
f5f33741da
Merge #6516
6516: Textmate grammar: prevent `/**/` from matching block doc comments r=dustypomerleau a=dustypomerleau

Fixes #6493.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-09 23:35:33 +00:00
Dusty Pomerleau
22dbbd16d8 fix: prevent /**/ from matching block doc comments 2020-11-10 09:54:00 +11:00
bors[bot]
0a715cfbd2
Merge #6472
6472: Add `static` modifier for associated functions r=matklad a=p3achyjr

Adds static semantic token modifier to associated functions, resolves #6194 

## Info

- Associated functions are more-or-less equivalent to static methods in other languages. This PR checks, for each function, whether that function has a self_param, and whether it's enclosed in a trait/impl.

## Changes

- Added method ```is_associated``` to code_model::Function. This basically gets the source from the ast, and checks whether the enclosing scope is an impl or trait.
- Added `static` to HighlightModifiers
- Added unit test

## Tests

- Ran ```cargo test```

Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
2020-11-09 21:13:51 +00:00
Anatol Liu
6b950d24d4 Add static semantic token modifier for associated functions with no &self
refactor logic into code_model.rs

address comments
2020-11-09 13:09:20 -08:00
Lukas Wirth
a61bb4abb5 Don't replace parent node when inserting as first child in algo::diff 2020-11-09 20:10:49 +01:00
Lukas Wirth
949c580d1b Add multiple file edit tes to remove_unused_param assist 2020-11-09 19:06:11 +01:00
bors[bot]
d5775b320c
Merge #6511
6511: . is an operator r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-09 17:12:57 +00:00
Aleksey Kladov
9634521abd . is an operator
closes #6498
2020-11-09 18:12:28 +01:00
bors[bot]
2fd29d0470
Merge #6510
6510: Fix panic when extracting struct r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-09 16:01:19 +00:00
Aleksey Kladov
4a16c228e7 Fix panic when extracting struct 2020-11-09 16:59:57 +01:00
bors[bot]
6b92cc4384
Merge #6509
6509: Support multi-file assist tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-09 13:44:44 +00:00
Aleksey Kladov
018f826197 Support multi-file assist tests 2020-11-09 14:44:08 +01:00
bors[bot]
9febb9eb0e
Merge #6508
6508: Fix debug for SyntaxRewriter r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-09 13:10:23 +00:00
Aleksey Kladov
e72cd4600e Fix debug for SyntaxRewriter 2020-11-09 14:09:49 +01:00
bors[bot]
73b08131df
Merge #6506
6506: Cleanup assists r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-09 12:28:57 +00:00
Aleksey Kladov
d31ce3b16c Use standard style for test code 2020-11-09 13:28:04 +01:00
Aleksey Kladov
3cecf78488 More consistent naming 2020-11-09 13:18:40 +01:00
Aleksey Kladov
29bf6bed9b More consistent naming 2020-11-09 13:07:18 +01:00
bors[bot]
2d3b0571bb
Merge #6465
6465: Support multiple file edits in AssistBuilder r=matklad a=Veykril

Fixes #6459

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-09 11:54:42 +00:00
bors[bot]
2f24714081
Merge #6501
6501: Remove text_edit_builder api from AssistBuilder r=matklad a=Veykril

Also fixes a small bug in `expand_glob_import` in regards to the very nice looking `something::{*}` import when only one item was used. Before it would duplicate the path and just append it, causing the following wrong import `something::something::UsedItem`.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-09 11:40:08 +00:00
bors[bot]
a120884560
Merge #6500
6500: Add some postfix snippet r=matklad a=pksunkara

Nothing much to explain. Just a simple addition. I was recently doing some refactoring and this would have made it a bit more faster.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-11-09 09:55:46 +00:00
Lukas Wirth
4c03d98db4 Remove text_edit_builder api from AssistBuilder 2020-11-08 23:22:11 +01:00
Pavan Kumar Sunkara
ca3498bd84 Add some postfix snippet 2020-11-08 20:10:40 +01:00
Anatol Liu
90031a267a Add static semantic token modifier for associated functions with no &self
refactor logic into code_model.rs

address comments
2020-11-08 00:01:02 -08:00
bors[bot]
945900bdbf
Merge #6497
6497: vscode: fix tmGrammar issues around non-controlflow keywords r=dustypomerleau a=cynecx

Addresses some of the issues mentioned here: https://github.com/dustypomerleau/rust-syntax/issues/5.
In sync with https://github.com/dustypomerleau/rust-syntax/issues/6.

Co-authored-by: cynecx <me@cynecx.net>
2020-11-08 01:47:10 +00:00
cynecx
fbd3d73bbc vscode: fix tmGrammar issues around non-controlflow keywords 2020-11-07 20:12:56 +01:00
George Fraser
fe435ffb27 Use builtin scopes more 2020-11-07 10:50:57 -08:00
bors[bot]
dac7060382
Merge #6476
6476: Add missing AssocItems in add_custom_impl assist r=matklad a=Veykril

```rust
use std::fmt;

#[derive(Debu<|>g)]
struct Foo {
    bar: String,
}
```
->
```rust
use std::fmt;

struct Foo {
    bar: String,
}

impl fmt::Debug for Foo {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        ${0:todo!()}
    }
}
```

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-07 18:21:11 +00:00
bors[bot]
f3fe6561c0
Merge #6491
6491: Textmate grammar: allow variables to terminate ranges r=dustypomerleau a=dustypomerleau

Variables were originally designed not to match after a dot, in order to avoid matching struct field access, however this resulted in variables that end ranges not being highlighted. In order to fix this we match a preceding dot, only if it's preceded by at least one other dot. Attempting to match on `(\.{2,})?` won't work, because the optional group allows struct field access to match even when one dot is present.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-07 11:17:55 +00:00
Dusty Pomerleau
6959cb045c allow variables to terminate ranges 2020-11-07 22:08:29 +11:00
bors[bot]
1b147306b4
Merge #6490
6490: Minimize convert_integer_literal tests r=matklad a=m-ysk

Closes #6455 

This PR removes some redundant tests around convert_integer_literal.

First, it removes test cases about converting integer with underscores except for just one case. This is because the process of removing of underscores in given integer literals is independent from radix.

Second, as well as underscore cases, it removes test cases about converting integer with suffix except for just one case. This is because the process of handling suffix is independent from radix.

Finally, it removes small decimal integer cases. This is because "special case where they return early" has been removed by the PR #6482, so we have no need to retain this cases.


Co-authored-by: m-ysk <myskjp@gmail.com>
2020-11-07 10:45:09 +00:00
m-ysk
69ba62e6cd Minimize convert_integer_literal tests 2020-11-07 18:47:25 +09:00
bors[bot]
fa03bfb115
Merge #6489
6489: Textmate grammar: Precedence fixes r=dustypomerleau a=dustypomerleau

- prevent `pat` from matching before `path` in metavariable types
- reduce the precedence of math operators so that assignment operators match correctly

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-07 03:59:36 +00:00
Dusty Pomerleau
ffc5f4cf2b precedence fixes:
- prevent `pat` from matching before `path` in metavariable types
- reduce the precedence of math operators so that assignment operators match correctly
2020-11-07 14:56:06 +11:00
bors[bot]
ed9f8d53bc
Merge #6488
6488: Textmate grammar: add `+=` to assignment operators r=dustypomerleau a=dustypomerleau

Fixes https://github.com/dustypomerleau/rust-syntax/issues/3.

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-06 22:52:13 +00:00