Commit Graph

7509 Commits

Author SHA1 Message Date
Aleksey Kladov
3ceb9a941a Remove dead code 2020-01-16 17:56:14 +01:00
Aleksey Kladov
6bc236253d Correctly discover module containers 2020-01-16 17:52:58 +01:00
Aleksey Kladov
595b06a1b8 Create modules via SourceBinder 2020-01-16 17:33:07 +01:00
Aleksey Kladov
9a6c26e348 Move module to SourceBinder 2020-01-16 16:53:11 +01:00
bors[bot]
e614356de1
Merge #2827
2827: Fix array element attribute position r=matklad a=edwin0cheng

This PR fixed a bug which an ATTR node insert in the wrong place in array element. ~~And introduce `precede_next` for allow outer attributes to insert into a parsed `expr`.~~  

related #2783

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-16 15:49:23 +00:00
Edwin Cheng
a766883a75 fix formating 2020-01-16 23:48:03 +08:00
Aleksey Kladov
16cfc8d50c Cache source for generics 2020-01-16 16:44:25 +01:00
Aleksey Kladov
7aa627fe58 Move more stuff to SourceBinder 2020-01-16 16:37:51 +01:00
Edwin Cheng
ed8d5c86e3 Fix array element attribute position 2020-01-16 23:37:43 +08:00
Aleksey Kladov
a3d6ddbe69 More natural trait setup 2020-01-16 16:27:21 +01:00
Aleksey Kladov
8691ae8ac0 Removed FromSource 2020-01-16 16:16:31 +01:00
Aleksey Kladov
81a45ca1b3 Make FromSource private 2020-01-16 16:08:46 +01:00
bors[bot]
f4eeff2c82
Merge #2861
2861: Micro-optimize type hints to avoid allocations r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-16 13:32:07 +00:00
Aleksey Kladov
272f6dfd9e Micro-optimize type hints to avoid allocations 2020-01-16 14:31:34 +01:00
bors[bot]
04b8bda515
Merge #2860
2860: Minimize visibility r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-16 10:59:03 +00:00
Aleksey Kladov
bd96d0b258 Minimize visibility 2020-01-16 11:58:31 +01:00
Joshua Nelson
c78e34968f
shrink inline tes 2020-01-15 19:12:56 -05:00
Veetaha
51fec39b82 fix(xtask.gen_syntax.typo): add s to the verb that refers to the 3d person 2020-01-16 00:47:03 +02:00
Veetaha
a24dcd7bab fix(ra_parser.typo): amend 'format language' to 'formal language' 2020-01-15 23:29:55 +02:00
bors[bot]
c78d269b66
Merge #2837
2837: Accidentally quadratic r=matklad a=matklad

Our syntax highlighting is accdentally quadratic. Current state of the PR fixes it in a pretty crude way, looks like for the proper fix we need to redo how source-analyzer works. 

**NB:** don't be scared by diff stats, that's mostly a test-data file

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-15 19:38:10 +00:00
bors[bot]
aa2e13b37f
Merge #2716
2716: Allow assists with multiple selectable actions r=SomeoneToIgnore a=SomeoneToIgnore

This PR prepares an infra for https://github.com/rust-analyzer/rust-analyzer/issues/2180 task by adding a possibility to specify multiple actions in one assist as multiple edit parameters to the `applySourceChange` command.

When this is done, the command opens a selection dialog, allowing the user to pick the edit to be applied.

I have no working example to test in this PR, but here's a demo of an auto import feature (a separate PR coming later for that one) using this functionality:

![out](https://user-images.githubusercontent.com/2690773/71633614-f8ea4d80-2c1d-11ea-9b15-0e13611a7aa4.gif)

The PR is not that massive as it may seem: all the assist files' changes are very generic and similar.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-01-15 18:43:23 +00:00
Kirill Bulatov
79b77403b6 Reduce visibility 2020-01-15 20:21:05 +02:00
Kirill Bulatov
d51cf7794d itertools::Either -> either::Either 2020-01-15 20:20:20 +02:00
Kirill Bulatov
78a21253b4 Apply the api design suggestions 2020-01-15 20:17:17 +02:00
Kirill Bulatov
73dc8b6f06 Another attempt to add multiple edits 2020-01-15 20:16:27 +02:00
bors[bot]
01422cc31d
Merge #2856
2856: More orthogonal path editing r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-15 17:54:41 +00:00
Aleksey Kladov
ef1326ee19 More orthogonal path editing 2020-01-15 18:48:28 +01:00
bors[bot]
2f1df3cd74
Merge #2855
2855: More fluent API r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-15 17:32:34 +00:00
Aleksey Kladov
7d2d3ac3db More fluent API 2020-01-15 18:30:23 +01:00
Aleksey Kladov
c84010e246 Slightly more fluent API 2020-01-15 18:14:49 +01:00
Aleksey Kladov
8296d3208d Simplify 2020-01-15 18:01:05 +01:00
Aleksey Kladov
448575aa4a Simplify 2020-01-15 18:01:05 +01:00
Aleksey Kladov
263401bf75 Rename 2020-01-15 17:44:12 +01:00
Aleksey Kladov
aaef88db0e Typos 2020-01-15 16:53:01 +01:00
Aleksey Kladov
5b255b4e6b ⬆️ once_cell 2020-01-15 16:52:28 +01:00
Aleksey Kladov
787d1aba63 Add comment 2020-01-15 16:52:28 +01:00
Aleksey Kladov
4194e5c88c Optimize inlay hints 2020-01-15 16:52:28 +01:00
Aleksey Kladov
11d6b9dadd Only new-style classification 2020-01-15 16:52:28 +01:00
Aleksey Kladov
35bfeaf4af Add a test 2020-01-15 16:52:28 +01:00
Aleksey Kladov
c640c2ea11 Make syntax highlighting linear 2020-01-15 16:52:28 +01:00
Aleksey Kladov
7e70fc22a7 Flip generics 2020-01-15 16:52:28 +01:00
Aleksey Kladov
a71bb70f0a Store DB in SourceBinder 2020-01-15 16:52:28 +01:00
Aleksey Kladov
ccfe53376a Introduce SourceBinder 2020-01-15 16:52:28 +01:00
bors[bot]
c0661ce744
Merge #2853
2853: Manage `cargo check` state updates in `main_loop` to reduce lock contention r=matklad a=kiljacken

State is now updated exclusively from `main_loop` so several threads theoretically can't compete for the lock. Updates to the state are requested via the existing task channel.

Also updates some naming to make slightly more sense.

Based upon an idea/suggestion from @matklad on Zulip:

> I think I've noticed at leas something suspicious!
> 
> In WorldSnapshot, we store an Arc<RwLock<CheckWatcherSharedState>>. We read lock this lock in handle_diagnostics.
> 
> Additionally, we .write this lock from the watcher thread in CheckWatcherState::run.
> 
> I think in general this is less then ideal, b/c diagnostics request can be blocked on another thread. I think it makes sense to architect this in a way which does not block.
>
> For that, we stop sharing the state between ServerWorld and CheckWatcherState. Instead, the watcher thread sends new diagnostics via a channel, and we accomodate thouse diagnostics intot he server state in the main loop.
> 
> So, instead of:
> ```rust
> struct Server {
>     diagnostics: Arc<Mutex<Vec<Diagnostics>>>,
> }
> 
> struct Watcher {
>     diagnostics: Arc<Mutex<Vec<Diagnostics>>>,
> }
> ```
> we'll have something like this:
> ```rust
> struct Server {
>     // this bit now *owns* diagnostics
>     diagnostisc: Vec<Diagnostics>
> }
> 
> struct Watcher {
>     diagnostics_sink: Sender<Vec<Diagnostics>>,
> }
> ```
> I am not sure this is the cuprit of slowness on widnows, but I think we should fix it, because it's very useful when all changes to the server's state can occur only via the main loop.
> 
> Note how VFS is set up in a similar way: instead of modifing some global hash map with files, VFS sends a message to the main looop that hey, I have these new files for you. The main loop than incorporates the changes itself.
> 
> Note that I think we'll still need some locks here, to share the state between ServerWorld and WorldSnapshot, but we won't actually be changing anyting mid-snapshot


Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2020-01-15 15:37:28 +00:00
Emil Lauridsen
7a8c6351bf Extract check task handling into function 2020-01-15 16:33:58 +01:00
bors[bot]
8013636768
Merge #2854
2854: Add logo r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-15 15:09:19 +00:00
Aleksey Kladov
f10b209234 Extension icon 2020-01-15 16:07:39 +01:00
Emil Lauridsen
ade657cb66 Tweak naming slightly 2020-01-15 15:53:08 +01:00
Emil Lauridsen
478ba65f8d Manage check state updates in main_loop to reduce lock contention 2020-01-15 15:50:49 +01:00
Aleksey Kladov
286930f1b6 Add logo 2020-01-15 15:48:11 +01:00