Commit Graph

12364 Commits

Author SHA1 Message Date
Paul Daniel Faria
fd30134cf8 Remove token tree from ReprKind::Other variant, expose ReprKind higher, remove debug println. 2020-08-10 08:44:54 -04:00
Paul Daniel Faria
263f9a7f23 Add tracking of packed repr, use it to highlight unsafe refs
Taking a reference to a misaligned field on a packed struct is an
unsafe operation. Highlight that behavior. Currently, the misaligned
part isn't tracked, so this highlight is a bit too aggressive.
2020-08-10 08:44:54 -04:00
Igor Aleksanov
6344a7f362 Fix clippy warnings 2020-08-10 15:05:01 +03:00
bors[bot]
f3336509e5
Merge #5698
5698: Display the value of a const on the hover r=jonas-schievink a=JmPotato

Signed-off-by: JmPotato <ghzpotato@gmail.com>

Close #4051 

To display the value of a const, I modified the implementation of `ShortLabel` for `ast::Const`.

Co-authored-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 09:55:58 +00:00
JmPotato
958b91c1e8 Better codes
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 17:51:45 +08:00
Dmitry
4874c559ef remove fmt skip attr 2020-08-10 14:17:45 +07:00
JmPotato
4d9c8821e5 Show const body in short_label
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-10 14:02:40 +08:00
bors[bot]
7a03f05eac
Merge #5692
5692: Add support for extern crate r=jonas-schievink a=Nashenas88

This adds syntax highlighting, hover and goto def functionality for extern crate.

Fixes #5690 

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-09 23:16:58 +00:00
Paul Daniel Faria
bf9b4578bb Remove Option<...> from result of Crate::root_module
There doesn't seem to be any need for it, and removing it simplies
several paths of code that depend on it.
2020-08-09 18:52:19 -04:00
bors[bot]
b1cb4ac13d
Merge #5693
5693: Fix no inlay hints / unresolved tokens until manual edit to refresh r=jonas-schievink a=Veetaha

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5349 

Now we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.

Here are the examples before/after the change (the gifs are quite lengthy because they show testing rather large cargo workspace).

<details>
<summary>Before</summary>

Here you can see that the client receives empty array of inlay hints and does nothing more.
Same applies to semantic tokens. The client receives unresolved tokens and does nothing more.
The user needs to do a manual edit to refresh the editor.

![prev-demo](https://user-images.githubusercontent.com/36276403/89717721-e4471280-d9c1-11ea-89ce-7dc3e83d9768.gif)

</details>

<details>
<summary>After</summary>

Here the server returns ContentModified, so the client periodically retries the requests and eventually receives the wellformed response.

![new-demo](https://user-images.githubusercontent.com/36276403/89717725-eb6e2080-d9c1-11ea-84c9-796bb2b22cec.gif)

</details>

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-08-09 22:39:10 +00:00
Jeremy Kolb
58c97bdcbf Remove 'as any' 2020-08-09 18:09:27 -04:00
Jeremy Kolb
7252babc13 Remove workaround for semantic token flickering
See: https://github.com/microsoft/vscode-languageserver-node/issues/576#issuecomment-593384479

This has been fixed since vscode 1.44
2020-08-09 17:57:27 -04:00
Veetaha
dbe7ede2ee Let shutdown request to pass through when status == Loading 2020-08-10 00:49:53 +03:00
bors[bot]
9995e79cce
Merge #5414
5414: Fix test code lens r=jonas-schievink a=avrong

Closes #5217

The implementation is quite similar to #4821. Maybe we should somehow deal with duplicated code.

Also, both of these requests introduce some unclear behavior. I'm not sure how to process this, therefore asking for advice. Examples are below.
<img width="286" alt="image" src="https://user-images.githubusercontent.com/6342851/87713209-83595f80-c7b2-11ea-8c0f-a12e7571e7df.png">

Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2020-08-09 21:23:20 +00:00
bors[bot]
859963b9a7
Merge #5694
5694: Format docs in to_proto::markup_content r=jonas-schievink a=JmPotato

Signed-off-by: JmPotato <ghzpotato@gmail.com>

Close #5442 

Removing # was handled in rust_analyzer::markdown::format_docs(). However, this function is no longer called in rust_analyzer::handlers::handle_hover() since commit e8bb153 (PR #5273). This pr add this formatting function back.

Co-authored-by: JmPotato <ghzpotato@gmail.com>
2020-08-09 18:02:02 +00:00
Dmitry
8366e3a7d5 refactoring to show more clearly the import problems 2020-08-10 00:48:32 +07:00
Dmitry
4c6f3f6880 refactoring to show more clearly the import problems 2020-08-10 00:47:22 +07:00
Dmitry
751d0367c2 fix tidy check 2020-08-10 00:35:42 +07:00
Dmitry
fab733b3ae Revert "fixes"
This reverts commit b602c73911.
2020-08-10 00:23:35 +07:00
Dmitry
ceadcf23fe add skip for generate file 2020-08-10 00:09:53 +07:00
Dmitry
b602c73911 fixes 2020-08-09 23:55:45 +07:00
Dmitry
cff0fba5e5 apply format 2020-08-09 23:47:02 +07:00
Dmitry
7f71ae8d73 Merge branch 'master' of https://github.com/Fihtangolz/rust-analyzer into master 2020-08-09 23:30:56 +07:00
Dmitry
06ca135bba fix trailing space 2020-08-09 23:28:48 +07:00
Dmitry Opokin
66b972ecc1
Update Cargo.toml 2020-08-09 21:13:35 +07:00
Dmitry
cdf6eee9f5 Merge branch 'master' of https://github.com/Fihtangolz/rust-analyzer into master 2020-08-09 21:04:29 +07:00
Dmitry
a2eb7e5739 fix unused 2020-08-09 21:03:42 +07:00
Dmitry
3af00eb45a fix unused 2020-08-09 20:53:02 +07:00
Dmitry
8068302fef Merge remote-tracking branch 'origin/master' 2020-08-09 20:39:32 +07:00
Dmitry
1a43a0f63e Added competition for unstable features
Added xtask for download unstable book from rust repository and codegene for it. Also small changes from lint
2020-08-09 20:33:47 +07:00
JmPotato
3f2bc813d3 format in to_proto::markup_content
Signed-off-by: JmPotato <ghzpotato@gmail.com>
2020-08-09 21:33:14 +08:00
Veetaha
e43811c164 Fix no inlay hints / unresolved tokens until manual edit
No we return ContentModified during the workspace loading. This signifies the language
client to retry the operation (i.e. the client will
continue polling the server while it returns ContentModified).
I believe that there might be cases of overly big projects where the backoff
logic we have setup in `sendRequestWithRetry` (which we use for inlay hints)
might bail too early (currently the largest retry standby time is 10 seconds).
However, I've tried on one of my project with 500+ dependencies and it is still enough.
2020-08-08 21:53:38 +03:00
Paul Daniel Faria
6cde0b1aa0 Add support for extern crate
This adds syntax highlighting, hover and goto def
functionality for extern crate
2020-08-08 14:14:18 -04:00
bors[bot]
8a57afe5a4
Merge #5684
5684: Semantic highlighting for unsafe union field access r=jonas-schievink a=Nashenas88

This change adds support for unions in inference and lowering, then extends on that to add the unsafe semantic modifier on field access only. The `is_possibly_unsafe` function in `syntax_highlighting.rs` could be extended to support fns and static muts so that their definitions are not highlighted as unsafe, but only their usage.

Also, each commit of this PR updates the tests. By reviewing the files by commit, it's easy to see how the changes in the code affected the tests.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-08 16:45:37 +00:00
bors[bot]
eed05a95b4
Merge #5689
5689: Remove clone r=kjeremy a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-08-08 16:18:01 +00:00
Paul Daniel Faria
be935b2b56 Apply unsafe semantic highlighting to union field access 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
3bf033e548 Add support for unions in inference and lowering 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
a39d503ef3 Add additional checks for union inference tests 2020-08-08 11:29:50 -04:00
Veetaha
b1ec08e3ff Remove clone 2020-08-08 17:42:50 +03:00
bors[bot]
a69f19a6a5
Merge #5686
5686: Fix typo in settings description r=kjeremy a=rherrmann

Remove a duplicate word from the description of the `warningsAsHint` setting.

Co-authored-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2020-08-08 11:51:14 +00:00
Yusuke Tanaka
cd49e41642
Add test for handle_document_symbol (#5655) 2020-08-08 20:49:09 +09:00
Yusuke Tanaka
b970d675f5
Reverse document symbols for each scope (#5655) 2020-08-08 20:48:45 +09:00
Rüdiger Herrmann
c04b2e39da
Fix typo in settings description
Remove a duplicate word from the description of the `warningsAsHint` setting.
2020-08-08 11:57:54 +02:00
bors[bot]
7a02cc8845
Merge #5679
5679: Account for static mut in missing unsafe diagnostic r=jonas-schievink a=Nashenas88

Accessing or modifying a static mut is an unsafe operation. The "missing unsafe" diagnostic now tracks this.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:26:23 +00:00
bors[bot]
911ef38b24
Merge #5678
5678: Static mut unsafe semantic highlighting r=jonas-schievink a=Nashenas88

This marks static mutable names as unsafe, since accessing or modifying a static mut is an unsafe operation.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:20:13 +00:00
Igor Aleksanov
c51fb7aca5 Fix failing test 2020-08-07 14:35:43 +03:00
Igor Aleksanov
78c1a87797 Add a test for disabled diagnostics 2020-08-07 14:26:36 +03:00
Igor Aleksanov
90857ff8b0 Add an AnalysisConfig structure and use it to configure diagnostics run 2020-08-07 14:25:55 +03:00
bors[bot]
ae1197accd
Merge #5674
5674: Update chalk r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-07 10:32:06 +00:00
Igor Aleksanov
c463d217a1 Add names for diagnostics and add a possibility to disable them 2020-08-07 13:18:47 +03:00