Commit Graph

6790 Commits

Author SHA1 Message Date
Michal Terepeta
be967b94e1 Fix a problem with Durability of libraries
When processing a change with added libraries, we used
`Default::default` for `SourceRoot` which sets `is_library` to false.
Since we use `is_library` to decide whether to use low or high
durability, I believe that this caused us to mark many library
dependencies as having low durability and thus increased the size of the
graph that salsa needed to verify on every change.

Based on my initial tests this speeds up the `CrateDefMapQuery` on
rust-analyzer from about ~64ms to ~14ms and reduces the number of
validations for the query from over 60k to about 7k.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-06 22:21:56 +01:00
bors[bot]
07340a62cc
Merge #2750
2750: add note in vscode instructions for vim plugin users r=matklad a=guswynn

Fixes #2746 

As the issue mentions, this is already mentioned below in the setting docs. However, it ended up taking me a long time to figure this out, so a note in the instructions for Vscode specifically is helpful

Co-authored-by: Gus Wynn <guswynn@gmail.com>
2020-01-06 14:14:58 +00:00
bors[bot]
1953ac17fd
Merge #2714
2714: Sanity check for missing server binary r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-06 11:39:41 +00:00
bors[bot]
010d902021
Merge #2726
2726: Improve profiling output when duration filter is specified r=matklad a=michalt

In particular:

  - Use strict inequality for comparisons, since that's what the filter
    syntax supports.

  - Convert to millis for comparisons, since that's the unit used both
    for the filter and when printing.

Now something like `RA_PROFILE='*>0'` will only print things that took
at least 1ms (when rounded to millis).

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>

Co-authored-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-06 09:41:14 +00:00
bors[bot]
b86ab5257e
Merge #2751
2751: Crates up r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-06 03:13:33 +00:00
Jeremy Kolb
051a2d869e Crates up 2020-01-05 22:12:26 -05:00
Gus Wynn
218d211f48 add note in vscode instructions for vim plugin users 2020-01-05 07:37:58 -08:00
bors[bot]
fe00a34fcc
Merge #2747
2747: BinOp helper to detect assignment r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-04 20:59:57 +00:00
Jeremy Kolb
5afb22e2b3 BinOp helper to detect assignment 2020-01-04 15:54:31 -05:00
bors[bot]
c15293e019
Merge #2745
2745: remove unused file r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-04 09:58:37 +00:00
Aleksey Kladov
b5e7186265 remove unused file 2020-01-04 10:58:10 +01:00
bors[bot]
823c15215e
Merge #2743
2743: Switch ast declaration from ron to a macro r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-03 20:54:42 +00:00
Aleksey Kladov
084bd304f3 Switch ast declaration from ron to a macro 2020-01-03 21:54:10 +01:00
bors[bot]
cb160f2a34
Merge #2742
2742: Split `infer` query into two for better profiling r=flodiebold a=michalt

This is the same change as we did with `crate_def_map` and it does seem
that we mostly spend time in salsa, without recomputing much on
rust-analyzer side.

Example output:

```
 233ms - handle_inlay_hints
      163ms - get_inlay_hints
          163ms - SourceAnalyzer::new
               67ms - def_with_body_from_child_node
                   67ms - analyze_container
                       67ms - analyze_container
                           67ms - Module::from_definition
                               67ms - Module::from_file
                                   67ms - crate_def_map
                                        0ms - parse_macro_query (6 calls)
                                        0ms - raw_items_query (1 calls)
                                       66ms - ???
                            0ms - crate_def_map (1 calls)
                        0ms - crate_def_map (1 calls)
               96ms - infer
                    2ms - trait_solve_query (2 calls)
                   94ms - ???
                0ms - body_with_source_map_query (1 calls)
                0ms - crate_def_map (1 calls)
      [...]
```

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>

Co-authored-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 19:08:32 +00:00
Michal Terepeta
d6c2a59538 Split infer query into two for better profiling
This is the same change as we did with `crate_def_map` and it does seem
that we mostly spend time in salsa, without recomputing much on
rust-analyzer side.

Example output:

```
 233ms - handle_inlay_hints
      163ms - get_inlay_hints
          163ms - SourceAnalyzer::new
               67ms - def_with_body_from_child_node
                   67ms - analyze_container
                       67ms - analyze_container
                           67ms - Module::from_definition
                               67ms - Module::from_file
                                   67ms - crate_def_map
                                        0ms - parse_macro_query (6 calls)
                                        0ms - raw_items_query (1 calls)
                                       66ms - ???
                            0ms - crate_def_map (1 calls)
                        0ms - crate_def_map (1 calls)
               96ms - infer
                    2ms - trait_solve_query (2 calls)
                   94ms - ???
                0ms - body_with_source_map_query (1 calls)
                0ms - crate_def_map (1 calls)
      [...]
```

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 19:58:11 +01:00
bors[bot]
1a18fe2ec0
Merge #2740
2740: Fix unused import for windows in cargo_watch test r=matklad a=edwin0cheng

This PR fixed some unused import in ra_cargo_watch test which are not used in Windows. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-03 18:25:14 +00:00
Edwin Cheng
ff5883637c Fix unused import for windows in cargo_watch test 2020-01-04 01:18:46 +08:00
bors[bot]
dfe3824eb0
Merge #2735
2735: Update quick-error r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-01-03 14:42:24 +00:00
kjeremy
f2a7a33c25 Update quick-error 2020-01-03 09:41:22 -05:00
bors[bot]
906d4dee3e
Merge #2734
2734: Fix #2705 r=flodiebold a=flodiebold

The `-` turned into a `+` during a refactoring.

The original issue was caused by `Read` resolving wrongly to a trait without
type parameters instead of a struct with one parameter; this only fixes the
crash, not the wrong resolution.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-03 13:59:35 +00:00
Florian Diebold
67240c8d91 Fix #2705
The `-` turned into a `+` during a refactoring.

The original issue was caused by `Read` resolving wrongly to a trait without
type parameters instead of a struct with one parameter; this only fixes the
crash, not the wrong resolution.
2020-01-03 14:57:11 +01:00
bors[bot]
15d94cbffc
Merge #2731
2731: Split `crate_def_map` into two methods r=matklad a=michalt

This change:

  - introduces `compute_crate_def_map` query and renames
    `CrateDefMap::crate_def_map_query` for consistency,

  - annotates `crate_def_map` as `salsa::transparent` and adds a
    top-level `crate_def_map` wrapper function around that starts the
    profiler and immediately calls into `compute_crate_def_map` query.

This allows us to better understand where we spent the time, in
particular, how much is spent in the recomputaiton and how much in
salsa.

Example output (where we don't actually re-compute anything, but the
query still takes a non-trivial amount of time):

```
  211ms - handle_inlay_hints
      150ms - get_inlay_hints
          150ms - SourceAnalyzer::new
               65ms - def_with_body_from_child_node
                   65ms - analyze_container
                       65ms - analyze_container
                           65ms - Module::from_definition
                               65ms - Module::from_file
                                   65ms - crate_def_map
                                        1ms - parse_macro_query (6 calls)
                                        0ms - raw_items_query (1 calls)
                                       64ms - ???
```

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>

Co-authored-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 13:25:37 +00:00
Michal Terepeta
2e2e443560 Add _query suffix to compute_crate_def_map for consistency
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 14:20:24 +01:00
Michal Terepeta
7cd6f12926 Split crate_def_map into two methods
This change:

  - introduces `compute_crate_def_map` query and renames
    `CrateDefMap::crate_def_map_query` for consistency,

  - annotates `crate_def_map` as `salsa::transparent` and adds a
    top-level `crate_def_map` wrapper function around that starts the
    profiler and immediately calls into `compute_crate_def_map` query.

This allows us to better understand where we spent the time, in
particular, how much is spent in the recomputaiton and how much in
salsa.

Example output (where we don't actually re-compute anything, but the
query still takes a non-trivial amount of time):

```
  211ms - handle_inlay_hints
      150ms - get_inlay_hints
          150ms - SourceAnalyzer::new
               65ms - def_with_body_from_child_node
                   65ms - analyze_container
                       65ms - analyze_container
                           65ms - Module::from_definition
                               65ms - Module::from_file
                                   65ms - crate_def_map
                                        1ms - parse_macro_query (6 calls)
                                        0ms - raw_items_query (1 calls)
                                       64ms - ???
```

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 13:59:46 +01:00
bors[bot]
e423cfe383
Merge #2730
2730: Add `profile` calls to {Module,Function}::diagnostics r=matklad a=michalt

With this change the output `ra_prof` gives a better indication where
the time is spent. Example output:

```
  213ms - publish_diagnostics
      213ms - diagnostics
           70ms - Module::from_definition
               70ms - Module::from_file
          132ms - Module::diagnostics
               78ms - Function::diagnostics
                    0ms - body_with_source_map_query (1 calls)
                    2ms - trait_solve_query (1 calls)
                   76ms - ???
               15ms - Function::diagnostics
                    0ms - body_with_source_map_query (1 calls)
                   15ms - trait_solve_query (5 calls)
               38ms - Function::diagnostics (51 calls)
            8ms - parse_query (1 calls)
 ```

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>

Co-authored-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 11:57:11 +00:00
Michal Terepeta
100c2d0127 Add profile calls to {Module,Function}::diagnostics
With this change the output `ra_prof` gives a better indication where
the time is spent. Example output:

```
  213ms - publish_diagnostics
      213ms - diagnostics
           70ms - Module::from_definition
               70ms - Module::from_file
          132ms - Module::diagnostics
               78ms - Function::diagnostics
                    0ms - body_with_source_map_query (1 calls)
                    2ms - trait_solve_query (1 calls)
                   76ms - ???
               15ms - Function::diagnostics
                    0ms - body_with_source_map_query (1 calls)
                   15ms - trait_solve_query (5 calls)
               38ms - Function::diagnostics (51 calls)
            8ms - parse_query (1 calls)
 ```

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 12:50:35 +01:00
bors[bot]
1cb8aa1311
Merge #2729
2729: Remove a duplicate line in `collect_defs` r=matklad a=michalt



Co-authored-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 11:43:41 +00:00
Michal Terepeta
84e2e173ee Remove a duplicate line in collect_defs
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-03 12:40:50 +01:00
Michal Terepeta
bc91120b7c Improve profiling output when duration filter is specified
In particular:

  - Use strict inequality for comparisons, since that's what the filter
    syntax supports.

  - Convert to millis for comparisons, since that's the unit used both
    for the filter and when printing.

Now something like `RA_PROFILE='*>0'` will only print things that took
at least 1ms (when rounded to millis).

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-02 17:26:02 +01:00
Aleksey Kladov
67922a029a kill unused file 2020-01-02 15:32:36 +01:00
bors[bot]
4516c4c144
Merge #2723
2723: Update dependencies r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-01 22:53:02 +00:00
Jeremy Kolb
35d72e40e2 Update dependencies 2020-01-01 17:51:48 -05:00
bors[bot]
cf67c74213
Merge #2722
2722: Fix ra_cargo_watch test on windows. r=matklad a=kiljacken

Due to difference in path parsing on platforms, the current input to the snapshot tests in ra_cargo_watch cause a panic when running on Windows. This PR disables the tests when running on Windows until a better solution is found.

If somebody running on Windows could test this that would be great, as I'm working in the blind here :) 

Fixes #2720 (probably).

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2020-01-01 22:25:37 +00:00
Emil Lauridsen
167cbb7c4d Disable cargo_watch snapshot tests on windows 2020-01-01 23:21:35 +01:00
bors[bot]
d0a59164d5
Merge #2718
2718: Allow disabling inlay hints r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-01 16:06:21 +00:00
Aleksey Kladov
8327049fae Allow disabling inlay hints 2020-01-01 17:04:37 +01:00
bors[bot]
d5a1a5e614
Merge #2715
2715: Fixes to progress display r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-31 20:14:02 +00:00
Aleksey Kladov
ef24721640 Fixes to progress display 2019-12-31 21:13:30 +01:00
Aleksey Kladov
c3a86325da
Merge pull request #2672 from Speedy37/master
fix #2520: change expand_repeat loop stop condition
2019-12-31 20:57:26 +01:00
Aleksey Kladov
695b8ba0f0 Sanity check for missing server binary 2019-12-31 20:54:31 +01:00
bors[bot]
e4d217074d
Merge #2711
2711: Add semicolons r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-31 17:59:59 +00:00
Aleksey Kladov
ff0ceb30a9 Add semicolons 2019-12-31 18:55:34 +01:00
bors[bot]
c8b98c4667
Merge #2710
2710: Fix NPEs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-31 17:51:08 +00:00
Aleksey Kladov
cb41ffbbbd Fix NPEs 2019-12-31 18:50:32 +01:00
bors[bot]
6d23140ba0
Merge #2709
2709: Work around synchrnonisation issue r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-31 17:38:55 +00:00
Aleksey Kladov
6368b40dd9 Work around synchrnonisation issue 2019-12-31 18:38:22 +01:00
Aleksey Kladov
087af54069 Refactor server lifecycle 2019-12-31 18:32:17 +01:00
Aleksey Kladov
0849f7001c Refactor config 2019-12-31 17:34:52 +01:00
Aleksey Kladov
76f283108b Drop needless pubs 2019-12-31 17:28:27 +01:00
Aleksey Kladov
433000be34 Move config to Ctx 2019-12-31 17:28:01 +01:00