Commit Graph

8355 Commits

Author SHA1 Message Date
Florian Diebold
f617455d10 Remove TODOs 2020-03-07 19:58:18 +01:00
Florian Diebold
941a574409 Fix CompletionContext module field (by removing it)
Two uses only needed the crate; one was wrong and should use the module from the
scope instead.
2020-03-07 17:53:22 +01:00
Florian Diebold
020c00e44d Add some sanity checks 2020-03-07 17:47:49 +01:00
Florian Diebold
cbca4effce Fix record pattern completion 2020-03-07 16:53:16 +01:00
Florian Diebold
b719e211cf Fix record literal completion 2020-03-07 16:48:39 +01:00
Florian Diebold
6bea6199b3 Fix range for postfix snippets 2020-03-07 16:44:51 +01:00
Florian Diebold
8cc4210278 Add more tests 2020-03-07 15:48:06 +01:00
Florian Diebold
24e98121d8 Try to complete within macros 2020-03-07 15:48:06 +01:00
bors[bot]
aff82cf7ac
Merge #3378
3378: vscode: redesign inlay hints to be capable of handling multiple editors for one source file r=Veetaha a=Veetaha

Fixes: #3008 (inlay corruption with multiple editors for one file).
Fixes: #3319 (unnecessary requests for inlay hints when switching unrelated source files or output/log/console windows)
Also, I don't know how, but the problem described in #3057 doesn't appear for me anymore (maybe it was some fix on the server-side, idk), the inlay hints are displaying right away. Though the last time I checked this it was caused by the server returning an empty array of hints and responding with a very big latency, I am not sure that this redesign actually fixed #3057....

We didn't handle the case when one rust source file is open in multiple editors in vscode (e.g. by manually adding another editor for the same file or by opening an inline git diff view or just any kind of preview within the same file).

The git diff preview is actually quite special because it causes memory leaks in vscode (https://github.com/microsoft/vscode/issues/91782). It is not removed from `visibleEditors` once it is closed. However, this bug doesn't affect the inlay hints anymore, because we don't issue a request and set inlay hints for each editor in isolation. Editors are grouped by their respective files and we issue requests only for files and then update all duplicate editors using the results (so we just update the decorations for already closed git diff preview read-only editors).

Also, note on a hack I had to use. `vscode.TextEdtior` identity is not actually public, its `id` field is not exposed to us. I created a dedicated upstream issue for this (https://github.com/microsoft/vscode/issues/91788).

Regarding #3319: the newly designed hints client doesn't issue requests for type hints when switching the visible editors if it has them already cached (though it does rerender things anyway, but this could be optimized in future if so wanted).

<details>
<summary>Before</summary>

![bug_demo](https://user-images.githubusercontent.com/36276403/75613171-3cd0d480-5b33-11ea-9066-954fb2fb18a5.gif)


</details>

<details>
<summary> After </summary>

![multi-cursor-replace](https://user-images.githubusercontent.com/36276403/75612710-d5b12100-5b2e-11ea-99ba-214b4219e6d3.gif)

</details>

Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-03-07 12:44:18 +00:00
Veetaha
65cecff316 vscode: post refactor HintsUpdater (simplify create() -> constructor call) 2020-03-07 14:39:42 +02:00
Veetaha
61a4ea2532 vscode: more privacy for HintsUpdater 2020-03-07 14:37:15 +02:00
Veetaha
2734ffa20c vscode: remove logging from inlays, run fix lint issues 2020-03-07 14:34:09 +02:00
Veetaha
ef52fd543f vscode: remove logic for caching editors as per @matklad 2020-03-07 14:08:35 +02:00
Veetaha
a63446f254 vscode: prerefactor util.ts and ctx.ts 2020-03-07 14:08:35 +02:00
Veetaha
3d93e2108e vscode: refresh all editors on text changes, simplify inlays api 2020-03-07 14:08:35 +02:00
Veetaha
057cd959da vscode: add dat semicolon 2020-03-07 14:08:35 +02:00
Veetaha
fd709c0c04 vscode: simpify 2020-03-07 14:08:35 +02:00
Veetaha
6441988d84 vscode: redesign inlay hints to be capable of handling multiple editors 2020-03-07 14:08:35 +02:00
Veetaha
0e6d066a29 vscode: extract Type and Param hint cases of InlayHint at type level (needed further) 2020-03-07 14:08:35 +02:00
bors[bot]
013e908056
Merge #3509
3509: Prevent include! macro include itself r=matklad a=edwin0cheng

This PR prevent `include` macro including itself. 

Note: It **does not** prevent a cyclic include: 
```rust
// foo.rs
include!("bar.rs")

// bar.rs
include!("foo.rs")
```

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-07 11:09:54 +00:00
Edwin Cheng
18f88ad10b Prevent include! macro include itself 2020-03-07 19:08:42 +08:00
bors[bot]
919747c323
Merge #3505
3505: Use actions/checkout@v2 r=matklad a=CAD97

---
bors: r+
🤖

Co-authored-by: CAD97 <cad97@cad97.com>
2020-03-07 08:11:26 +00:00
bors[bot]
8218494b53
Merge #3508
3508: Use a not so dummy implementation of env macro r=edwin0cheng a=edwin0cheng

Currently we have a dummy `env` macro implementation which expand to an empty string, such that a `include!(concat!(env!("OUT_DIR"), "/foo.rs"))` will become `include!("/foo.rs")`, and here may be a infinite loop. :)

This PR use a not so dummy version of `env` macro to prevent this infinite loop. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-07 05:04:36 +00:00
Edwin Cheng
2e178b5475 Fix test and add more comment 2020-03-07 13:02:54 +08:00
Edwin Cheng
36c7684687 Use a not so dummy implementation of env macro 2020-03-07 12:53:40 +08:00
CAD97
cf140ac995 Use actions/checkout@v2 2020-03-06 20:32:03 -05:00
bors[bot]
48bb1c5172
Merge #3504
3504: Normalize waiting queries names r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 23:18:28 +00:00
Aleksey Kladov
9abf0d9659 Normalize waiting queries names 2020-03-07 00:18:04 +01:00
bors[bot]
d4cea98bc3
Merge #3502
3502: Don't reuse the Chalk solver r=matklad a=flodiebold

This slows down analysis-stats a bit (~5% in my measurement), but improves
incremental checking a lot because we can reuse trait solve results.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-03-06 22:29:57 +00:00
bors[bot]
44a3f430f2
Merge #3503
3503: ⬆️ npm deps r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 22:23:21 +00:00
Aleksey Kladov
dd4b001505 ⬆️ npm deps 2020-03-06 23:22:58 +01:00
Florian Diebold
9ce30281f6 Don't reuse the Chalk solver
This slows down analysis-stats a bit (~5% in my measurement), but improves
incremental checking a lot because we can reuse trait solve results.
2020-03-06 23:04:14 +01:00
bors[bot]
26ae35c62e
Merge #3499
3499: Resolve `Self::AssocTy` in impls r=matklad a=flodiebold

To do this we need to carry around the original resolution a bit, because `Self`
gets resolved to the actual type immediately, but you're not allowed to write
the equivalent type in a projection. (I tried just comparing the projection base
type with the impl self type, but that seemed too dirty.) This is basically how
rustc does it as well.

Fixes #3249.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-03-06 19:50:55 +00:00
bors[bot]
a42f29166b
Merge #3500
3500: Don't creat public APIs with typos r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 17:41:53 +00:00
Aleksey Kladov
80909f7698 Don't creat public APIs with typos 2020-03-06 18:38:56 +01:00
Aleksey Kladov
95a2755aa8 Concise mode for parameter hints
This works around VS Code bug where it tries to cram everything in a
tiny popup, and brings experience closer to Intellij.
2020-03-06 18:35:30 +01:00
Florian Diebold
d17c5416af Resolve Self::AssocTy in impls
To do this we need to carry around the original resolution a bit, because `Self`
gets resolved to the actual type immediately, but you're not allowed to write
the equivalent type in a projection. (I tried just comparing the projection base
type with the impl self type, but that seemed too dirty.) This is basically how
rustc does it as well.

Fixes #3249.
2020-03-06 18:14:39 +01:00
bors[bot]
8e8c5a73ff
Merge #3498
3498: Trigger parameter info automatically r=matklad a=matklad

See https://github.com/Microsoft/vscode/issues/64023



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 17:09:58 +00:00
Aleksey Kladov
3ff170d658 Trigger parameter info automatically
See https://github.com/Microsoft/vscode/issues/64023
2020-03-06 18:00:06 +01:00
Aleksey Kladov
4e7f6c2354 Feature flag for arg snippets 2020-03-06 17:51:10 +01:00
Aleksey Kladov
21f40f2b8f Fix comment order 2020-03-06 17:44:30 +01:00
bors[bot]
ce7496ec22
Merge #3497
3497: Allow specifying additional info on call to profile r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 16:37:19 +00:00
Aleksey Kladov
b33b843f40 Allow specifying additional info on call to profile 2020-03-06 17:36:51 +01:00
bors[bot]
190179489d
Merge #3496
3496: Less confusing profile names r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 15:41:09 +00:00
Aleksey Kladov
59f91f2f9b Less confusing profile names 2020-03-06 16:40:38 +01:00
bors[bot]
aa82b5915d
Merge #3494
3494: Implement include macro r=matklad a=edwin0cheng

This PR implement builtin `include` macro.

* It does not support include as expression yet.
* It doesn't consider `env!("OUT_DIR")` yet.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-06 15:08:41 +00:00
Edwin Cheng
0a06c7e6e6 Implment include macro 2020-03-06 22:58:45 +08:00
bors[bot]
4173645a71
Merge #3493
3493: make::use_item r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 14:56:52 +00:00
Aleksey Kladov
1f84c3b18f make::use_item 2020-03-06 15:56:25 +01:00
bors[bot]
995a92814f
Merge #3490
3490: Support aliases and Self in struct literals r=matklad a=flodiebold

Fixes #3306.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-03-06 14:46:03 +00:00