Commit Graph

13621 Commits

Author SHA1 Message Date
Dusty Pomerleau
4e66fc57bd fix: distinguish turbofish function calls from namespaces 2020-11-03 23:47:15 +11:00
bors[bot]
07c7f35eff
Merge #6430
6430: Move completions rendering into a separate module r=popzxc a=popzxc

This PR extracts rendering-related things from `Completions` structure to the new `render` module.

`render` module declares a `Render` structure (which is a generic renderer interface), `RenderContext` (interface for data/methods not required for completions generating, but required for rendering), and a bunch of smaller `*Render` structures which encapsulate logic behind rendering a certain item.

This is just a step in full separation direction, since the following this are still to be done:

- Move some data from `CompletionContext` to the `RenderContext`;
- Forbid any kind of rendering outside of `render` module;
- Extract score computing into a separate module.

This PR is already pretty big, so not to make it even harder to review I decided to split this process into several subsequent PRs.


Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-11-03 07:54:45 +00:00
bors[bot]
658e97a39e
Merge #6447
6447: Textmate grammar: allow function declarations without curly brackets r=lnicola a=dustypomerleau

Functions inside trait declarations can break subsequent highlighting, because they have no curly brackets. In a case such as:

```rust
pub trait Summary {
    fn summarize(&self) -> String;
}
```

the scope `meta.function.definition.rust` will continue past the end of the block looking for `{` after `fn`. This PR allows `meta.function.definition.rust` to terminate with `;` in these cases. 

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-03 07:48:24 +00:00
Dusty Pomerleau
01a228f689 fix: allow functions without curly brackets 2020-11-03 18:37:43 +11:00
bors[bot]
65b44d2ba5
Merge #6421
6421: Check for allow(..) attributes in case check diagnostic r=popzxc a=popzxc

Resolves #6348

This is not a full-fledged solution, as it doesn't looks up for parent elements (e.g. function -> module -> parent module -> crate root), but it does at least checks attributes of item being checked.
I played a bit with code, and it seems that implementing a proper solution (which will also check for `deny` / `warn` attributes overriding values for `allow`s from above).

So, this solution should fix all the macros which intentionally do "weird" naming and wrap it with `allow`, such as `lazy_static`.

cc @ArifRoktim 


Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-11-03 07:36:49 +00:00
Igor Aleksanov
8efe43245b Remove intra-crate facade from completions 2020-11-03 10:36:01 +03:00
Igor Aleksanov
4d333ebb63 Get rid of do-er antipattern 2020-11-03 10:33:13 +03:00
Igor Aleksanov
caf0fa20a7 Provide only explicit constructor for RenderContext 2020-11-03 10:17:59 +03:00
Igor Aleksanov
2a214e15d3 Add doc-comments to the new files 2020-11-03 10:16:35 +03:00
Igor Aleksanov
af7175f332 Make structures order more logical in render.rs 2020-11-03 10:16:35 +03:00
Igor Aleksanov
97a504805d Move rendering tests to the render module 2020-11-03 10:16:35 +03:00
Igor Aleksanov
15b16917fc Add TypeAliasRender 2020-11-03 10:16:35 +03:00
Igor Aleksanov
944ccf6075 Add ConstRender 2020-11-03 10:16:35 +03:00
Igor Aleksanov
fc8a1cd800 Introduce render module 2020-11-03 10:16:35 +03:00
Igor Aleksanov
dd2febf05a Improve decl_check module readability 2020-11-03 10:13:49 +03:00
Igor Aleksanov
9e172ffeb7 Remove numbers from comments in decl_check.rs 2020-11-03 10:11:02 +03:00
Igor Aleksanov
bdfe12df8f Check for allow(..) attributes for case diagnostic 2020-11-03 10:11:02 +03:00
Lukas Wirth
74c82ca8ce Only show self ident when showing parameter self hints 2020-11-02 21:56:16 +01:00
Lukas Wirth
cd349dbbc4 Make insert_use return a SyntaxRewriter 2020-11-02 21:40:52 +01:00
James Leitch
ff87726074 Feedback. 2020-11-02 10:57:31 -07:00
bors[bot]
245e1b533b
Merge #6445
6445: Fix coalescing of prime_caches updates r=jonas-schievink a=jonas-schievink

The previous implementation could try to create a progress bar when one
was already registered.

bors r+ 🤖 

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-11-02 17:54:01 +00:00
Jonas Schievink
285960aa6b Fix coalescing of prime_caches updates
The previous implementation could try to create a progress bar when one
was  already registered
2020-11-02 18:49:54 +01:00
bors[bot]
173e45f872
Merge #6365
6365: Do insertion lookahead in algo::diff r=matklad a=Veykril

This is the last blocker for #6287 after this I can update that PR to properly fix things through using `SyntaxRewriter`.

This PR also shuffles tests around a bit and adds some more.

Ideally this is just a hack until we implement a "proper" diff algorithm that approximates a minimal diff. Maybe something like [gumtree](https://github.com/GumTreeDiff/gumtree)?

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-02 17:47:08 +00:00
bors[bot]
d021dbeb4f
Merge #6393 #6399
6393: Remove repetitive inlay hints (take 2) r=matklad a=lnicola



6399: Keep generic annotations when qualifying things r=matklad a=Veykril

The `qualify_path` assists currently eats up already annotated generics in all but one cases which can be annoying if one already pre-fills generics of a type before it's been qualified.

Co-authored-by: Matthew Sanetra <matthewsanetra@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-02 17:40:47 +00:00
bors[bot]
2bd26e6afc
Merge #6443
6443: Remove unnecessary clone r=jonas-schievink a=jonas-schievink

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-11-02 17:34:41 +00:00
Jonas Schievink
58e3fd8e8e Remove unnecessary clone 2020-11-02 18:33:46 +01:00
bors[bot]
eb4e84ff51
Merge #6441
6441: Coalesce prime_caches updates r=matklad a=jonas-schievink

This reduces the number of progress bar updates we send to the client by collapsing subsequent updates into one. This doesn't work as well as I'd hoped (which is that we end up sending *no* updates, or only `start` and `end`, when the cache is already fresh), but it does reduce the number considerably: instead of ~720 updates on the rust-analyzer codebase, we now only send ~60.

It uses the same approach that is already in use for coalescing VFS events.

Hopefully this is enough to fix https://github.com/rust-analyzer/rust-analyzer/issues/6413.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-11-02 17:12:08 +00:00
bors[bot]
4e80002ace
Merge #6442
6442: Bump chalk and lexer r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-02 17:02:21 +00:00
kjeremy
0403e82d91 Bump chalk and lexer 2020-11-02 12:00:58 -05:00
Jonas Schievink
a968cb6aef Remove debug print 2020-11-02 17:24:35 +01:00
Jonas Schievink
6e8ddac165 Coalesce prime_caches updates 2020-11-02 17:24:35 +01:00
bors[bot]
cb04f0c019
Merge #6440
6440: Deny unreachable pub r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-02 16:01:38 +00:00
Aleksey Kladov
f5e7f07838 Update crates
This is to bust the caches
2020-11-02 17:00:05 +01:00
Aleksey Kladov
ba8d6d1e4e Remove more unreachable pubs 2020-11-02 16:58:33 +01:00
bors[bot]
731b38fa3c
Merge #6438
6438: Deny unreachable-pub r=matklad a=matklad

It's very useful when `pub` is equivalent to "this is crate's public
API", let's enforce this!

Ideally, we should enforce it for local `cargo test`, and only during
CI, but that needs https://github.com/rust-lang/cargo/issues/5034.


Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-02 13:08:53 +00:00
Aleksey Kladov
b610118453 Deny unreachable-pub
It's very useful when `pub` is equivalent to "this is crate's public
API", let's enforce this!

Ideally, we should enforce it for local `cargo test`, and only during
CI, but that needs https://github.com/rust-lang/cargo/issues/5034.
2020-11-02 14:07:08 +01:00
bors[bot]
6507877e70
Merge #6437
6437: Document doer object anti-pattern r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-02 11:18:03 +00:00
Aleksey Kladov
412d6b3db5
Update docs/dev/style.md
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-11-02 12:17:34 +01:00
Aleksey Kladov
4318828f21 Document doer object anti-pattern 2020-11-02 12:13:59 +01:00
bors[bot]
e7f90866bc
Merge #6436
6436: Textmate grammar: allow comments in attributes r=dustypomerleau a=dustypomerleau

Fixes #6419

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
2020-11-02 04:46:09 +00:00
Dusty Pomerleau
79598f55b0 fix: allow comments in attributes 2020-11-02 15:33:11 +11:00
James Leitch
d2d7a4403c Test Fixture ExplicitRoot + ModuleResolutionRelativePathOutsideRoot. 2020-11-01 17:20:55 -07:00
bors[bot]
86d3b78407
Merge #6423
6423: cargo update r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-10-31 14:22:36 +00:00
Jeremy Kolb
5fccb72dd5 cargo update 2020-10-31 10:20:25 -04:00
bors[bot]
28b1cd32b3
Merge #6420
6420: Update Cargo.toml r=flodiebold a=pksunkara

This was blocking the automated publishing.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-10-31 09:00:26 +00:00
Pavan Kumar Sunkara
c070146a83
Update Cargo.toml 2020-10-31 08:49:57 +01:00
bors[bot]
dd84b7a24d
Merge #6416
6416: Respond with JSON-RPC error if we failed to deserialize request r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-30 19:07:29 +00:00
Aleksey Kladov
3b9548e163 Respond with JSON-RPC error if we failed to deserialize request
Historically, we intentinally violated JSON-RPC spec here by hard
crashing. The idea was to poke both the clients and servers to fix
stuff.

However, this is confusing for server implementors, and falls down in
one important place -- protocol extension are not always backwards
compatible, which causes crashes simply due to version mismatch. We
had once such case with our own extension, and one for semantic
tokens.

So let's be less adventerous and just err on the err side!
2020-10-30 19:57:52 +01:00
bors[bot]
590fdba284
Merge #6415
6415: Upgrade Chalk to 0.36 r=flodiebold a=flodiebold

Quite a few changes, because Chalk got rid of the `ApplicationTy` nesting.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-10-30 18:22:03 +00:00
Florian Diebold
bca51e3519 Upgrade Chalk to 0.36
Quite a few changes, because Chalk got rid of the `ApplicationTy` nesting.
2020-10-30 18:57:55 +01:00