Commit graph

8428 commits

Author SHA1 Message Date
bors[bot]
7ac99aad28
Merge #3524
3524: Ignore client-specific notifications r=matklad a=matklad

closes #3523



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-09 08:27:31 +00:00
Aleksey Kladov
8aeab8d7b0 Ignore client-specific notifications
closes #3523
2020-03-09 09:26:41 +01:00
bors[bot]
51a50e3f50
Merge #3520
3520: Omit unit struct hints r=matklad a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/3488

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-09 08:08:23 +00:00
Steffen Lyngbaek
9138d39947 Clean up completion matching.
- Add test to ensure nested completions don't happen
2020-03-08 17:50:41 -07:00
bors[bot]
5b3d97e449
Merge #3521
3521: Use markdown description in vscode r=matklad a=vbfox

By using `markdownDescription` the markdown in the description is parsed and displayed.

Before:

![image](https://user-images.githubusercontent.com/131878/76171725-cb2a0380-618e-11ea-956f-7668a746946f.png)

After:

![image](https://user-images.githubusercontent.com/131878/76171743-00365600-618f-11ea-8847-f4ab09639bb5.png)


Co-authored-by: Julien Roncaglia <julien@roncaglia.fr>
2020-03-08 22:11:22 +00:00
Julien Roncaglia
a231172283 Use markdown description in vscode 2020-03-08 22:46:42 +01:00
Kirill Bulatov
605dc98451 Omit unit struct hints 2020-03-08 23:21:08 +02:00
Kirill Bulatov
5cffef56e2 Consider crate declaration names 2020-03-08 23:00:50 +02:00
Veetaha
de99fa7199 vscode: fix inversion of askBeforeDownload 2020-03-08 21:47:35 +02:00
Veetaha
2847636d30 docs: change formatting 2020-03-08 19:10:52 +02:00
Veetaha
6bd1ff16e5 vscode: rename alwaysDownloadServer -> askBeforeDownload
The new name seems much simpler and it doesn't limit
this config value only to downloading the server binary.
Thus we wouldn't need to create another config
properties to handle other downloads whatsoever.
Anyway, I believe (heuristically) that most of the users
would want to set "askBeforeDownload": false once
and never bother clicking on the notification again
(because otherwise there is no big point in installing rust-analyzer if it cannot install the server)
2020-03-08 18:58:02 +02:00
Veetaha
49b4e88458 vscode: add docs on alwaysDownloadServer 2020-03-08 18:51:21 +02:00
Edwin Cheng
e7206467d5 Add parse_to_token_tree 2020-03-09 00:13:04 +08:00
Florian Diebold
05e1c7b197 Handle visibility for assoc item path completion as well 2020-03-08 15:15:46 +01:00
Steffen Lyngbaek
7c439355ce Don't allow nested completions 2020-03-08 03:24:34 -07:00
Florian Diebold
afdf08e964 Move hypothetical expansion to hir_expand 2020-03-08 11:10:48 +01:00
Florian Diebold
d9c77c5453 Handle visibility for path completion (not in all cases yet) 2020-03-08 10:51:40 +01:00
Florian Diebold
734e68da4c Handle visibility in method call completion 2020-03-07 23:03:56 +01:00
Veetaha
c29a502e25 vscode: care about alwaysDownloadServer option before asking
Also renamed BinarySource to ArtifactSource in anticipation of
nightlies installation that requires downloading
not a binary itself but .vsix package, thus generalized
to `artifact` term
2020-03-08 00:01:48 +02:00
Veetaha
9dae94a78d vscode: contribute "alwaysDownloadServer" option to config 2020-03-07 23:59:33 +02:00
Kirill Bulatov
32f5276465 Show mod path in hover tooltip 2020-03-07 23:20:18 +02:00
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
Steffen Lyngbaek
15ed114a49 Next steps in assoc item completion #3183
Allow trait autocompletions for unimplemented associated fn's, types,
and consts without using explicit keywords before hand (fn, type,
const).

The sequel to #3108.
2020-03-06 17:35:39 -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