Commit Graph

13990 Commits

Author SHA1 Message Date
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
Dusty Pomerleau
397b76f28b add += to assignment operators 2020-11-07 09:49:08 +11:00
bors[bot]
c365329911
Merge #6486
6486: Cleanup API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-06 21:54:14 +00:00
Aleksey Kladov
5db789df9c Cleanup API 2020-11-06 22:52:42 +01:00
bors[bot]
7f12a1f225
Merge #6485
6485: Remove RAW literals r=matklad a=matklad

bors r+
🤖

closes https://github.com/rust-analyzer/rust-analyzer/issues/6308

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-06 21:39:02 +00:00
bors[bot]
cdddcaee85
Merge #6477
6477: Add infer_function_return_type assist r=matklad a=Veykril

This adds an assist to insert a functions return type if it hasn't been specified yet by inferring it from the functions tail expression. This assist only becomes active if the cursor is on the tail expression. See https://github.com/rust-analyzer/rust-analyzer/issues/6303#issuecomment-714657326

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-06 21:32:27 +00:00
Aleksey Kladov
6158304f8b Simplify 2020-11-06 22:30:58 +01:00
Aleksey Kladov
5ba4f949c2 Kill RAW_ literals
Syntactically, they are indistinguishable from non-raw versions, so it
doesn't make sense to separate then *at the syntax* level.
2020-11-06 22:23:14 +01:00
Lukas Wirth
186431e178 Adjust test-texts in infer_function_return_type 2020-11-06 21:51:15 +01:00
Lukas Wirth
4f0d02c276 Enable infer_function_return_type in return-type position 2020-11-06 21:49:03 +01:00
bors[bot]
fe13a4aeb1
Merge #6484
6484: Minor, cleanup style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-06 20:10:15 +00:00
Aleksey Kladov
6725dcf847 Minor, cleanup style 2020-11-06 21:09:37 +01:00
bors[bot]
1faa9559fe
Merge #6480
6480: Support closure in change_return_type_to_result assist r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-06 19:41:13 +00:00
Lukas Wirth
e95a65ccaf Support closure in change_return_type_to_result assist 2020-11-06 20:40:03 +01:00
bors[bot]
6a759e5160
Merge #6483
6483: don\t indent tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-06 19:30:06 +00:00
Aleksey Kladov
9b1d4cc8ab don\t indent tests 2020-11-06 20:29:41 +01:00
bors[bot]
0d5be44b6e
Merge #6482
6482: More orthogonal API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-06 18:10:17 +00:00
Aleksey Kladov
eb46033390 More orthogonal API 2020-11-06 19:09:01 +01:00
Aleksey Kladov
735aaa7b39 Move int parsing to IntNumber token 2020-11-06 18:54:01 +01:00
Aleksey Kladov
6bcc33e5b7 Better imports 2020-11-06 18:39:09 +01:00
Aleksey Kladov
3820b26a93 Generate token for ints and floats 2020-11-06 18:19:24 +01:00
bors[bot]
2c408c68a4
Merge #6479
6479: Ignore RUST_SRC_PATH if it is set to invalid value r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-06 10:33:04 +00:00
Aleksey Kladov
85db47ac76 Ignore RUST_SRC_PATH if it is set to invalid value
Folks report a ton of hard-to-diagnose issues, the solution for which
is "unset RUST_SRC_PATH". Let's just ignore RUST_SRC_PATH when it
won't work anyway!
2020-11-06 11:30:57 +01:00
Lukas Wirth
c665884474 Wrap non-block expressions in closures with a block 2020-11-06 03:06:08 +01:00
Lukas Wirth
2e6e5d8f73 Ignore unit expressions in infer_function_return_type assist 2020-11-06 02:17:34 +01:00
Lukas Wirth
0a7c8512ff Support closures in infer_function_return_type assist 2020-11-06 02:15:13 +01:00
Lukas Wirth
a14df19d82 Add infer_function_return_type assist 2020-11-06 01:47:41 +01:00
Anatol Liu
3aa0e40726 Add static semantic token modifier for associated functions with no &self
refactor logic into code_model.rs

address comments
2020-11-05 15:46:04 -08:00
Lukas Wirth
19443c1fa3 Add missing AssocItems in add_custom_impl assist 2020-11-05 23:41:46 +01:00
bors[bot]
7709b6a2d4
Merge #6470
6470: Restore semantic token flickering workaround removed in #5697 r=kjeremy a=charlespierce

Closes #6452 

Info
-----
* As discussed in #6452, the `Error('busy')` workaround for semantic token flickering was removed because the underlying issue was believed to be fixed in VS Code.
* It turns out that the fix isn't yet complete, so this caused flickering of the semantic highlighting when making rapid edits (e.g. typing quickly).
* This PR restores that workaround and makes it slightly more robust, covering all areas of semantic token middleware.

Changes
-----
* Added middleware functions for `provideDocumentSemanticTokens`, `provideDocumentSemanticTokensEdits`, and `provideDocumentRangeSemanticTokens` to match the 3 possible middleware hooks defined in https://github.com/microsoft/vscode-languageserver-node/blob/master/client/src/common/semanticTokens.ts#L33
* Each intercepts a `null` or `undefined` return and throws an error with the message `busy` instead, which prevents the tokens from being removed and re-added (causing the flickering behavior)

Tested
-----
* Tested locally that the flickering behavior is gone.
* There don't appear to be any significant tests of the VS Code plugin side of things, other than that it loads. Is there somewhere I can / should add tests to cover this behavior?

Co-authored-by: Charles Pierce <cpierce.grad@gmail.com>
2020-11-05 13:09:22 +00:00
Anatol Liu
14b38e198c Add static semantic token modifier for associated functions with no &self
refactor logic into code_model.rs
2020-11-04 23:41:02 -08:00
Anatol Liu
771c0d8c08 Add static semantic token modifier for associated functions with no &self
refactor logic into code_model.rs
2020-11-04 21:55:44 -08:00
Anatol Liu
3baa526fb0 Add static semantic token modifier for associated functions with no &self 2020-11-04 20:08:46 -08:00
bors[bot]
f5b72638bd
Merge #6471
6471: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-05 03:02:46 +00:00
kjeremy
6b9a3504ca cargo update 2020-11-04 22:01:19 -05:00