Commit Graph

4809 Commits

Author SHA1 Message Date
Aleksey Kladov
aedff7cdcf Move utility functions down 2020-01-14 11:29:43 +01:00
Aleksey Kladov
eb8989f9e4 Rename file 2020-01-14 11:29:43 +01:00
Veetaha
60251da204 refactor(ra_syntax.validation): removed code duplication from validate_literal() function 2020-01-14 04:09:03 +02:00
kjeremy
170c7bd7e3 Log client info if present 2020-01-13 16:20:47 -05:00
Aleksey Kladov
5654387e77 Don't panic if chalk panics 2020-01-13 19:00:42 +01:00
bors[bot]
7ea7de338f
Merge #2825
2825: Some clippy lints r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-01-13 17:06:19 +00:00
kjeremy
c5c5f4260b Readability 2020-01-13 11:38:53 -05:00
kjeremy
a82c679c97 Some clippy lints 2020-01-13 11:27:06 -05:00
Emil Lauridsen
c774850fd8 Schedule check update regardless of notification setting 2020-01-13 17:22:21 +01:00
Emil Lauridsen
daca5a3711 Defer cargo check until after workspace load 2020-01-13 17:12:14 +01:00
kjeremy
0610444407 Dropping a reference does nothing.
Allows clippy to continue compilation
2020-01-13 10:51:39 -05:00
bors[bot]
96e759413d
Merge #2815
2815: Report macro calls as functions r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-13 10:34:43 +00:00
memoryruins
5575588387 Add macro_rules item snippet 2020-01-12 18:47:15 -05:00
Jeremy Kolb
9e71ff9636 Report macro calls as functions 2020-01-12 17:22:09 -05:00
Roland Ruckerbauer
20b8d283ae Remove hir usage from macro_rules! detection in structure_node() 2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
15c5426b54 Use hir .path() and .name() to differentiate
macro call and macro definition
2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
c6655c67d2 Added test for file_structure unidentified macro definition 2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
db151763d4 Fix file_structure() to recognize macro_rules!
where first token != "macro_rules"
2020-01-12 17:34:57 +01:00
Joshua Nelson
c3ac2c93fb
Allow attributes before function arguments
This adds support for function calls of the form:

```rust
  (
    #[attr(...)] 1.2,
    #[attr_one(...)]
    #[attr_two(...)]
    1.5,
    ... etc ...
  )
```

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2801
2020-01-12 10:25:41 -05:00
Edwin Cheng
0593da9a36 Fix format 2020-01-12 20:25:58 +08:00
Edwin Cheng
384e1ced88 Use prev_token and next_token 2020-01-12 20:25:58 +08:00
Edwin Cheng
b7ab079211 Use indices first and last instead of min-max 2020-01-12 20:25:58 +08:00
Edwin Cheng
caed836e41 Use first and last token only 2020-01-12 20:25:58 +08:00
Edwin Cheng
b30e6a7b56 Handle extend selection in recursive macro 2020-01-12 20:25:58 +08:00
Edwin Cheng
07f4171b18 Minor fix 2020-01-12 20:25:58 +08:00
Edwin Cheng
4c4416543a Fix formatting 2020-01-12 20:25:58 +08:00
Edwin Cheng
83b2d78bbb Supporting extend selection inside macro calls 2020-01-12 20:25:58 +08:00
bors[bot]
8bb2a50ce6
Merge #2807
2807: Use attr location for builtin derive in goto-implementation r=matklad a=edwin0cheng

This PR is use attribute location for builtin derive in `ImplBlock`'s NavigationTarget such that the goto-implementation will goto to a correct position. 

Related to #2531

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-12 11:33:31 +00:00
Edwin Cheng
db5f73d261 Add test 2020-01-12 19:24:34 +08:00
Florian Diebold
2c11a9b42d Qualify paths in 'fill match arms' assist 2020-01-12 11:34:52 +01:00
Edwin Cheng
d7be1a4372 Use attr location for builtin macro goto-imp 2020-01-12 18:08:53 +08:00
bors[bot]
86d2af9f7b
Merge #2803
2803: Fix various names, e.g. Iterator not resolving in core prelude r=matklad a=flodiebold

Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-11 23:00:37 +00:00
Florian Diebold
9dc1826cfa Fix various names, e.g. Iterator not resolving in core prelude
Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.
2020-01-11 23:37:58 +01:00
Florian Diebold
ccb75f7c97 Use FxHashMap 2020-01-11 23:33:04 +01:00
Florian Diebold
4496e2a06a Apply review suggestions 2020-01-11 23:33:04 +01:00
Florian Diebold
15fc643e05 Fix ordering problem between qualifying paths and substituting params 2020-01-11 23:33:04 +01:00
Florian Diebold
12905e5b58 Some more refactoring 2020-01-11 23:33:04 +01:00
Florian Diebold
def124e932 Fix file ID when qualifying paths; add another failing test 2020-01-11 23:33:04 +01:00
Florian Diebold
4545f289a9 Handle type args 2020-01-11 23:33:04 +01:00
Florian Diebold
5cb1f71322 More failing tests 2020-01-11 23:33:04 +01:00
Florian Diebold
4d75430e91 Qualify some paths in 'add missing impl members' 2020-01-11 23:33:04 +01:00
Florian Diebold
460fa71c55 Use self 2020-01-11 23:33:04 +01:00
Florian Diebold
2906d188c2 Cleanup 2020-01-11 23:33:04 +01:00
Florian Diebold
38cd9f0c94 Handle cycles 2020-01-11 23:33:04 +01:00
Florian Diebold
b1325488ec Use query for importable locations 2020-01-11 23:33:04 +01:00
Florian Diebold
947eec7b87 Use super, don't use private imports 2020-01-11 23:33:04 +01:00
Florian Diebold
df9d3bd25e Use shortest path 2020-01-11 23:33:04 +01:00
Florian Diebold
1ea2b475a9 handle most cases 2020-01-11 23:33:04 +01:00
Florian Diebold
b62292e8f9 basics working 2020-01-11 23:33:04 +01:00
Florian Diebold
2c50f996b6 more WIP 2020-01-11 23:33:04 +01:00
Florian Diebold
22b412f1a9 find_path WIP 2020-01-11 23:33:04 +01:00
Florian Diebold
877fda04c5 Add test 2020-01-11 23:33:04 +01:00
bors[bot]
3924c7de50
Merge #2791
2791: Slightly more robust cargo watcher root search r=kiljacken a=kiljacken

Fixes #2780 (hopefully).

Use the already painstakingly found `workspaces` instead of naively using `folder_roots` from editor.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2020-01-11 20:41:41 +00:00
Emil Lauridsen
8e778f9842 Clean up straggling mut 2020-01-11 21:37:01 +01:00
Emil Lauridsen
480c44918c Disable cargo checking in workspaces with no cargo projects 2020-01-11 21:32:40 +01:00
bors[bot]
7c1af25b22
Merge #2795
2795: Use dummy value for macro file in bulitin macros r=matklad a=edwin0cheng

This PR skip the actual line and column computation for `MacroFile` and return a dummy value instead.

Related to #2794



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-11 20:13:48 +00:00
Edwin Cheng
9f65ae20c2 Use dummy value for macro file in bulitin macros 2020-01-11 16:37:42 +08:00
bors[bot]
991b62a4f9
Merge #2790
2790: Add test for macro expansion in various expressions r=edwin0cheng a=flodiebold

cc @edwin0cheng 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-11 03:51:04 +00:00
Emil Lauridsen
d6da18e99d Address nit 2020-01-10 22:41:52 +01:00
Emil Lauridsen
1d1eea217d Slightly more robust cargo watcher root search 2020-01-10 22:10:26 +01:00
Florian Diebold
dd6ec81d65 Add test for macro expansion in various expressions 2020-01-10 22:08:02 +01:00
kjeremy
a633a6275a Fix Write being sent down the wire.
Not sure what the deal is here but it wasn't sending Write.
2020-01-10 15:30:17 -05:00
kjeremy
32540abcb3 Add AccessMode to decls 2020-01-10 15:14:19 -05:00
kjeremy
49fd6a5228 Split Declaration out into it's own type 2020-01-10 15:14:19 -05:00
kjeremy
cc96ddfe69 Simplify and update tests to account for access 2020-01-10 15:14:19 -05:00
Jeremy Kolb
6c89d86ade Tweaks 2020-01-10 15:14:19 -05:00
Jeremy Kolb
d993f329a0 Basic DocumentHighlightKind support for assignments 2020-01-10 15:14:19 -05:00
Edwin Cheng
dca9195f75 Add missing expr cases for expand macro 2020-01-11 03:11:23 +08:00
bors[bot]
029c02982b
Merge #2786
2786: Proper handling local in hover r=flodiebold a=edwin0cheng

This PR implement back the `Local` hover information generation, which is fall back to a general case catch previously :

9a44f627be/crates/ra_ide/src/hover.rs (L173-L182)



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-10 17:58:14 +00:00
Edwin Cheng
19094abd41 Proper handling local in hover 2020-01-11 01:51:08 +08:00
bors[bot]
9a44f627be
Merge #2785
2785: Expand PAREN_EXPR as expression r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-10 16:31:02 +00:00
Edwin Cheng
ca62d98781 Expand PAREN_EXPR as expression 2020-01-11 00:29:00 +08:00
Emil Lauridsen
aa433c67d8 Parse trait aliases 2020-01-09 18:40:01 +01:00
bors[bot]
c2bbfb9a5f
Merge #2778
2778: ⬆️ rowan r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-09 15:33:37 +00:00
Aleksey Kladov
47785b0cd4 ⬆️ rowan 2020-01-09 16:33:02 +01:00
Aleksey Kladov
cf5bdf464c
Merge pull request #2732 from detrumi/cargo-toml-not-found-message-toggle
Flag to hide cargo.toml not found error
2020-01-09 15:16:39 +01:00
bors[bot]
3263c70766
Merge #2772
2772: Actually test references r=kjeremy a=kjeremy

This will be a little more work when `ReferenceSearchResults` change but I think it's easier to maintain in the end. It also follows a similar pattern to navigation targets and call hierarchy.

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-09 12:26:59 +00:00
Jeremy Kolb
6fc80efe77 visibility tweak 2020-01-09 07:26:04 -05:00
bors[bot]
0d6e5a986c
Merge #2771
2771: Remove the Default impl for SourceRoot r=matklad a=michalt

Let's be always explicit whether we create a library (i.e., an immutable
dependency) or a local `SourceRoot`, since it can have a large impact on
the validation performance in salsa. (we found it the hard way recently,
where the `Default` instance made it quite tricky to spot a bug)

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

Co-authored-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-09 10:35:17 +00:00
bors[bot]
5ced6f4be3
Merge #2777
2777: Better error message r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-09 10:26:22 +00:00
Aleksey Kladov
4223760a7b Better error message
closes #2775
2020-01-09 11:25:44 +01:00
kjeremy
9791b9c36a Actually test references 2020-01-08 16:35:58 -05:00
Michal Terepeta
d761435ba0 Remove the Default impl for SourceRoot
Let's be always explicit whether we create a library (i.e., an immutable
dependency) or a local `SourceRoot`, since it can have a large impact on
the validation performance in salsa. (we found it the hard way recently,
where the `Default` instance made it quite tricky to spot a bug)

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-08 19:42:27 +01:00
kjeremy
c7b2bc1363 Move private API down 2020-01-08 11:33:04 -05:00
Wilco Kusee
11caebe6ce
Remove unneeded Box::new
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-08 17:22:08 +01:00
Wilco Kusee
738d5a7ec2
Derive debug 2020-01-08 17:21:19 +01:00
Jeremy Kolb
1b19a8aa5e Implement proposed CallHierarchy feature
See: https://github.com/microsoft/vscode-languageserver-node/blob/master/protocol/src/protocol.callHierarchy.proposed.ts
2020-01-08 10:15:49 -05:00
Mikhail Modin
fb25c91979 Adds a way to limits reference search by StructLiteral 2020-01-08 15:21:54 +01:00
Wilco Kusee
003620f0d6
Use downcasting for CargoTomlNotFoundError 2020-01-08 14:06:08 +01:00
Aleksey Kladov
5d8f2bd822
Merge pull request #2762 from edwin0cheng/fix-2759
Reject tuple index for missing fields assist
2020-01-08 12:49:54 +01:00
Edwin Cheng
a4c9babedb Proper emit diagnostic without fix 2020-01-08 02:18:43 +08:00
Edwin Cheng
e55e6da13a Reject tuple index for missing fields assist 2020-01-08 02:08:17 +08:00
Aleksey Kladov
8317efa191
Merge pull request #2760 from edwin0cheng/fix-descend-into-macros
Use src node for analyze source in `descend_into_macros`
2020-01-07 18:08:43 +01:00
Edwin Cheng
1fdee24608 Use src node for analyze source 2020-01-08 00:23:53 +08:00
Aleksey Kladov
b8ca479a2e
Merge pull request #2756 from matklad/retasks
⬆️ crates
2020-01-07 17:17:31 +01:00
Aleksey Kladov
072f0d323b Fix back compat 2020-01-07 16:45:57 +01:00
Aleksey Kladov
4d66f5d7d2 Fix panic in tuple fields 2020-01-07 14:49:42 +01:00
Michael Chesser
ce1b34fd59 Improve const generics parsing
- Handle const generics type args
- Fix issue with const generic as first parameter in trait impl
2020-01-07 09:29:03 +10:30
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]
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
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
Edwin Cheng
ff5883637c Fix unused import for windows in cargo_watch test 2020-01-04 01:18:46 +08:00
Wilco Kusee
e7bb82c3a4
Allow disabling Cargo.toml not found error 2020-01-03 15:04:54 +01: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
Wilco Kusee
6c321d7318
Move error to new file 2020-01-03 14:34:16 +01: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
Wilco Kusee
2202891221
Split errors into WorkspaceError enum 2020-01-03 14:04:46 +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
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
Jeremy Kolb
35d72e40e2 Update dependencies 2020-01-01 17:51:48 -05:00
Emil Lauridsen
167cbb7c4d Disable cargo_watch snapshot tests on windows 2020-01-01 23:21:35 +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
26bd7a896b Drop support for legacy colorization 2019-12-31 14:11:25 +01:00
Aleksey Kladov
23bac12062 Retry inlay hints on content modified error 2019-12-30 22:20:04 +01:00
Vincent Rouillé
dc98930965
Add details about test_repeat_bad_var current state 2019-12-30 17:12:20 +01:00
Vincent Rouillé
c670a15345
Details about macro NestingState hit and at_end fields 2019-12-30 17:09:07 +01:00
bors[bot]
be37c3369b
Merge #2681
2681: cargo-watcher: Resolve macro call site in more cases r=matklad a=kiljacken

This resolves the actual macro call site in a few more cases, f.x. when a macro invokes `compile_error!` (I'm looking at you `ra_hir_def::path::__path`).

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 21:40:42 +00:00
Emil Lauridsen
bca8524fa2 Add related information with original error site 2019-12-29 20:10:20 +01:00
Emil Lauridsen
96156b95b5 Resolve macro call site in more cases 2019-12-29 19:14:18 +01:00
bors[bot]
fc77921acc
Merge #2680
2680: Fix cargo-watcher file urls on windows r=matklad a=kiljacken

Fixes #2676 

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 17:53:13 +00:00
Emil Lauridsen
0d69d23d2f Lowercase drive letters when getting paths from cargo check 2019-12-29 18:27:14 +01:00
Emil Lauridsen
8280795a85 Remove unused hard-coded paths 2019-12-29 17:39:44 +01:00
Emil Lauridsen
8fad8e897a Resolve traits in infer using lang item infrastructure 2019-12-29 17:39:31 +01:00
Emil Lauridsen
fc3ab03af7 Add helpers for unpacking lang items 2019-12-29 17:38:37 +01:00
bors[bot]
523b4cbc60
Merge #2650
2650: Add macro call support for SourceAnalyzer::type_of r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-29 15:02:27 +00:00
bors[bot]
ada9e16537
Merge #2674
2674: Reduce visibility r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-29 14:08:37 +00:00
Aleksey Kladov
e1d040a6a4 Reduce visibility 2019-12-29 15:07:53 +01:00
Aleksey Kladov
8f36f768e1 Don't add non-impl/trait containers to scope 2019-12-29 14:47:47 +01:00
bors[bot]
dc48f89581
Merge #2668
2668: In-server cargo check watching r=matklad a=kiljacken

Opening a draft now so people can follow the progress, and comment if they spot something stupid.

Things that need doing:
- [x] Running cargo check on save
- [x] Pipe through configuration options from client
- [x] Tests for parsing behavior
- [x] Remove existing cargo watch support from VSCode extension
- [x] Progress notification in VSCode extension using LSP 3.15 `$/progress` notification
- [ ] ~~Rework ra-ide diagnostics to support secondary messages~~
- [ ] ~~Make cargo-check watcher use ra-ide diagnostics~~

~~I'd love some input on whether to try to keep the status bar progress thingy for VSCode? It will require some plumbing, and maintaining yet another rust-analyzer specific LSP notification, which I'm not sure we want to.~~

Fixes #1894 

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-29 12:57:24 +00:00
bors[bot]
cdcb3d3833
Merge #2667
2667: Visibility r=matklad a=flodiebold

This adds the infrastructure for handling visibility (for fields and methods, not in name resolution) in the HIR and code model, and as a first application hides struct fields from completions if they're not visible from the current module. (We might want to relax this again later, but I think it's ok for now?)

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-29 12:24:19 +00:00
Vincent Rouillé
6d84dee4e7
fix #2520: change expand_repeat loop stop condition 2019-12-28 22:48:49 +01:00
Emil Lauridsen
899dbebd02 Fix busy-waiting issue in main cargo watch thread 2019-12-27 17:29:02 +01:00
Emil Lauridsen
c732f215cb Don't finish main cargo watch thread when subprocess finishes. 2019-12-27 12:43:14 +01:00
Emil Lauridsen
ed84c85aef Fix shutdown behavoir of main cargo-watch thread.
Even though this didn't error, it became clear to me that it was closing
the wrong channel, resulting in the child thread never finishing.
2019-12-27 12:42:18 +01:00
Emil Lauridsen
59837c75f4 Add doc comment to module 2019-12-27 11:57:00 +01:00
Emil Lauridsen
4d33835a34 Cargo fmt run 2019-12-27 11:47:09 +01:00
Emil Lauridsen
02ce5bbf6b Shutdown/cancelation story for main cargo watch thread 2019-12-27 11:43:05 +01:00
Emil Lauridsen
a2d10694cc Consistent, hopefully robust, shutdown/cancelation story for cargo check subprocess 2019-12-27 11:32:05 +01:00
Florian Diebold
9fd2c813ca visible_from -> is_visible_from 2019-12-27 11:25:04 +01:00
bors[bot]
823e9193fe
Merge #2657
2657: Omit closure parameters in closure type display strings r=flodiebold a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/1946

I wonder, should we display the the closure trait (Fn/FnMut/FnOnce) in inlay hints instead of `|...|` at all?

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-12-27 10:10:07 +00:00
Emil Lauridsen
428a6ff5b8 Move cargo watch functionality to separate crate 2019-12-27 11:10:07 +01:00
Florian Diebold
dfe95d735b Remove Arc from RawVisibility
Now that it's not used as a direct query return value anymore, it doesn't need
to be cheaply cloneable anymore.
2019-12-26 16:42:57 +01:00
Florian Diebold
04cf98f8a6 Fix cross-crate glob privacy handling 2019-12-26 16:31:38 +01:00
Florian Diebold
78111620a3 Remove visibility query, instead add struct field visibility to data
Methods should be handled the same, and for items the visibility will be in the
def map.
2019-12-26 16:23:40 +01:00
Florian Diebold
50ebff257d Rename ResolvedVisibility -> Visibility 2019-12-26 16:23:40 +01:00
Florian Diebold
e1a2961273 Rename Visibility -> RawVisibility 2019-12-26 16:23:40 +01:00
Florian Diebold
04e8eaa14b Handle privacy for modules 2019-12-26 16:23:40 +01:00
Florian Diebold
21359c3ab5 Take visibility into account for glob imports 2019-12-26 16:23:40 +01:00
Florian Diebold
8ac25f119e Keep track of visibility during def collection 2019-12-26 16:23:40 +01:00
Florian Diebold
79c90b5641 Collect visibility of items during nameres 2019-12-26 16:23:40 +01:00
Florian Diebold
c31dae2aca Add doc comment 2019-12-26 16:23:40 +01:00
Florian Diebold
8aeaf93b9a Make enum variant fields public 2019-12-26 16:23:40 +01:00
Florian Diebold
9e9c4be48a Hide completions for private struct fields 2019-12-26 16:23:40 +01:00
Florian Diebold
ca15cf422c Add visibility in code model for fields 2019-12-26 16:23:40 +01:00
Florian Diebold
1ce809d0fa Add logic for resolving and checking visibility 2019-12-26 16:23:40 +01:00
Florian Diebold
069bf55cca Add infrastructure for visibility on syntax and hir_def level 2019-12-26 16:23:40 +01:00
bors[bot]
97f01396ed
Merge #2658
2658: Only add features flags if non-empty r=matklad a=edwin0cheng

This prevent error when disabled  `all-features` in a cargo workspace, because of `--features is not allowed in the root of a virtual workspace` when running `cargo metadata`.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-25 20:26:08 +00:00
bors[bot]
24e552fadf
Merge #2663
2663: Fill in type params in 'add missing impl members' assist r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-25 19:26:18 +00:00
Emil Lauridsen
0cdbd08149 Keep VSCode config mostly backwards compatible 2019-12-25 20:26:06 +01:00
Emil Lauridsen
71d2d81dcc Some documentatioN 2019-12-25 19:56:07 +01:00
Emil Lauridsen
069c165536 Actually respect disabling cargo check functionality 2019-12-25 19:17:54 +01:00
Emil Lauridsen
f7d04d0575 Re-format ra_lsp_server changes 2019-12-25 19:14:30 +01:00
Emil Lauridsen
178c23f505 Re-implement status display using LSP 3.15 progress event 2019-12-25 19:08:44 +01:00
Emil Lauridsen
c21fbc3e87 Migrate tests from extension to rust 2019-12-25 17:37:40 +01:00
Emil Lauridsen
17360b5d14 Fix use of wrong message in diagnostic 2019-12-25 17:37:40 +01:00
Emil Lauridsen
6af4bf7a8d Configuration plumbing for cargo watcher 2019-12-25 17:37:40 +01:00
Emil Lauridsen
66e8ef53a0 Initial implementation of cargo check watching 2019-12-25 17:37:40 +01:00
Florian Diebold
c39352fa43 Fill in type params in 'add missing impl members' assist 2019-12-24 17:29:27 +01:00
bors[bot]
3f7e5cde0b
Merge #2661
2661: Implement infer await from async function r=flodiebold a=edwin0cheng

This PR is my attempt for trying to add support for infer `.await` expression from an `async` function, by desugaring its return type to `Impl Future<Output=RetType>`.

Note that I don't know it is supposed to desugaring it in that phase, if it is not suitable in current design, just feel free to reject it :)

r=@flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-24 16:28:46 +00:00
Edwin Cheng
208ad97fdc Remove AsyncOwner 2019-12-25 00:25:18 +08:00
Edwin Cheng
42813126d9 Check if parameters is empty 2019-12-25 00:12:29 +08:00
Edwin Cheng
3a2cf708ed Add FIXME 2019-12-24 23:39:17 +08:00
Edwin Cheng
d0537cda9e Formatting 2019-12-24 20:30:39 +08:00
Edwin Cheng
0edb5b4a50 Implement infer await from async func 2019-12-24 19:45:28 +08:00
Kirill Bulatov
242be3631e Omit closure parameters 2019-12-23 18:30:25 +02:00
Edwin Cheng
4ee3c5202e Only add features flags if non-empty 2019-12-24 00:27:48 +08:00
Jeremy Kolb
019fab2261 lsp-types 0.67 2019-12-23 09:33:49 -05:00
Edwin Cheng
12cc2ed557 Use pre-stored macro file 2019-12-23 21:56:10 +08:00
bors[bot]
ce07a2daa9
Merge #2636
2636: Chalk update and refactoring r=flodiebold a=flodiebold

This updates the Chalk integration to https://github.com/rust-lang/chalk/pull/311, which will presumably get merged soon, and refactors it some more, most notably introducing our own `TypeFamily` instead of reusing `ChalkIr`. It's still mostly the same as `ChalkIr` though, except for using Salsa `InternId`s directly.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-23 10:58:06 +00:00
John-John Tedro
700e74df4a Bump lsp-types to 0.66.0 (fixes #2651) 2019-12-23 11:03:41 +01:00
Edwin Cheng
16156d766d Add macro call support for type_of 2019-12-23 13:19:01 +08:00
Florian Diebold
1f7f4578f7 Filter out error predicates in type bounds as well 2019-12-23 00:08:03 +01:00
Florian Diebold
4053fcfca0 Introduce our own Chalk TypeFamily, instead of using ChalkIr
It's not very different, except we can directly use Salsa IDs instead of casting
them. This means we need to refactor the handling of errors to get rid of
UNKNOWN_TRAIT though.
2019-12-23 00:08:03 +01:00
Florian Diebold
6b5efe5bda Refactor Chalk integration some more 2019-12-23 00:08:03 +01:00
Florian Diebold
67a2555f6d Update Chalk, clean up Chalk integration a bit 2019-12-23 00:08:03 +01:00
Aleksey Kladov
e424545c0f Rudimentary name resolution for local items 2019-12-22 22:41:21 +01:00
Aleksey Kladov
7c405c0156 Simplify 2019-12-22 19:32:35 +01:00
Aleksey Kladov
007032f850 Refactor 2019-12-22 19:31:01 +01:00
Aleksey Kladov
baee746185 Share impl Scope between modules and blocks 2019-12-22 15:52:35 +01:00
Aleksey Kladov
6c3ddcfa50 Simplify 2019-12-22 15:37:53 +01:00
Aleksey Kladov
e8da7d4061 Remove unused parameters 2019-12-22 15:31:30 +01:00