Commit graph

8516 commits

Author SHA1 Message Date
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
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
Fireassember 787043496a added fmt::Display as a supertrait for AstNode and changed generation. 2020-03-06 19:29:30 +02: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