Commit Graph

1463 Commits

Author SHA1 Message Date
bors[bot]
2cb85c14b6
Merge #11281
11281: ide: parallel prime caches r=jonas-schievink a=jhgg

cache priming goes brrrr... the successor to #10149

---

this PR implements a parallel cache priming strategy that uses a topological work queue to feed a pool of worker threads the crates to index in parallel.

## todo
- [x] should we keep the old prime caches?
- [x] we should use num_cpus to detect how many cpus to use to prime caches. should we also expose a config for # of worker CPU threads to use?
- [x] something is wonky with cancellation, need to figure it out before this can merge. 

Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-25 16:03:35 +00:00
Laurențiu Nicola
e3e6133ff4 Bump pulldown-cmark and pulldown-cmark-to-cmark 2022-01-21 19:49:57 +02:00
Jonas Schievink
a3d06f824b status: output all crates a file belongs to 2022-01-17 18:10:01 +01:00
bors[bot]
7a52f83700
Merge #11294
11294: internal: Move format specifier lexing from syntax to ide_db r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-15 12:18:46 +00:00
Lukas Wirth
91279db2b4 Move format specifier lexing from syntax to ide_db 2022-01-15 13:14:59 +01:00
bors[bot]
4c34909308
Merge #11293
11293: feat: Add very simplistic ident completion for format_args! macro input r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-15 11:24:21 +00:00
Lukas Wirth
82fccb971e feat: Add very simplistic ident completion for format_args! macro input 2022-01-15 12:23:26 +01:00
Jake Heinz
25f67b6939 make it a config 2022-01-15 02:47:47 +00:00
bors[bot]
9ba6cfa9c7
Merge #11283
11283: fix: Adjust `.` typing auto indentation r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/629
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-14 11:16:18 +00:00
Lukas Wirth
ba3efafc0d fix: Adjust . typing auto indentation 2022-01-14 12:15:43 +01:00
Jake Heinz
bcc99091f3 hacky fix for cancelling 2022-01-14 10:30:51 +00:00
Jake Heinz
6c5504a617 one last bit of cleanup 2022-01-14 10:10:47 +00:00
Jake Heinz
c3f30ae4f0 removed scoped threads, cleanup 2022-01-14 10:06:28 +00:00
Jake Heinz
f83c0166be cleanup + detect num cpus 2022-01-14 09:48:59 +00:00
Jake Heinz
0b0bfc6fdd cleanup 2022-01-14 09:36:03 +00:00
Jake Heinz
c8aa2f6a61 use index map 2022-01-14 09:35:41 +00:00
Jake Heinz
5f0c1aa2de make progress callback dyn 2022-01-14 09:33:40 +00:00
Jake Heinz
2b0d8a86a2 fix warnings 2022-01-14 09:25:45 +00:00
Jake Heinz
343b0ccfb9 simplify 2022-01-14 09:21:25 +00:00
Jake Heinz
3168148cc6 ide: parallel prime caches 2022-01-14 09:16:35 +00:00
Jonas Schievink
09219e10f1 Mostly restore hir API boundary 2022-01-12 19:56:47 +01:00
Lukas Wirth
b32f611b6e fix: Fix outline modules spilling inner doc injections into their parent 2022-01-08 14:54:31 +01:00
Lukas Wirth
6746ba5839 Record attribute calls on assoc items in TraitData and ImplData 2022-01-08 10:45:12 +01:00
bors[bot]
40009e07d0
Merge #11145
11145: feat: add config to use reasonable default expression instead of todo! when filling missing fields r=Veykril a=bnjjj

Use `Default::default()` in struct fields when we ask to fill it instead of putting `todo!()` for every fields

before:

```rust
pub enum Other {
    One,
    Two,
}

pub struct Test {
    text: String,
    num: usize,
    other: Other,
}

fn t_test() {
    let test = Test {<|>};
}
``` 

after: 

```rust
pub enum Other {
    One,
    Two,
}

pub struct Test {
    text: String,
    num: usize,
    other: Other,
}

fn t_test() {
    let test = Test {
        text: String::new(),
        num: 0,
        other: todo!(),
    };
}
``` 



Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
2022-01-07 14:10:11 +00:00
Lukas Wirth
ca4baa6e55 Use FileAstId<ast::Adt> in nameres where appropriate instead 2022-01-07 14:20:27 +01:00
Laurențiu Nicola
e14d9208f5 Move pretty-printing test out of assist 2022-01-06 16:38:25 +02:00
Lukas Wirth
dc135cc076 internal: Support registered tools and attributes in ide layer 2022-01-06 14:56:50 +01:00
Jonas Platte
c90c88b083
Always put a space after impl in macro pretty-printing
… regardless of whether the next symbol is punctuation or not.
2022-01-06 11:33:08 +01:00
bors[bot]
ac3ea3e81c
Merge #11112
11112: Evaluate constants in array repeat expression r=HKalbasi a=HKalbasi

cc #8655 

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-01-04 21:51:37 +00:00
hkalbasi
75c2acae6e Evaluate constants in array repeat expression 2022-01-05 01:17:01 +03:30
Lukas Wirth
c5a9985fc5 Remove lossy Definition::from_token/Definition::from_node methods 2022-01-04 18:29:53 +01:00
bors[bot]
68bc12c3b8
Merge #11157
11157: internal: Remove `SemanticScope::speculative_resolve_as_mac` r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-04 16:49:47 +00:00
Lukas Wirth
19f1ff5c70 give resolve_derive_ident a more robust api 2022-01-03 16:00:45 +01:00
bors[bot]
8e9ccbf97a
Merge #11177
11177: internal: dont descend into comments r=Veykril a=jhgg

fixes #11176

Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-03 02:03:03 +00:00
Jake Heinz
04decd5e6b internal: dont descend into comments 2022-01-03 01:53:58 +00:00
bors[bot]
abbc7e3a0e
Merge #11088
11088: closes #10446 hide type inlay hints r=Veykril a=Heinenen

Passes tests as described in #10446
Works for all happy cases, there may be some cases that I forgot as I am not that familiar with Rust and r-a (yet).

Co-authored-by: Heinenen <th.m.heinen@gmail.com>
2022-01-03 00:51:08 +00:00
Lukas Wirth
087122ad1a fix: Fix highlighting hack for self-params 2022-01-03 01:32:03 +01:00
Lukas Wirth
6b7b09d329 internal: Record unresolved derive invocations in hir 2022-01-02 23:44:23 +01:00
Lukas Wirth
762a3b3030 Fix tool module classification not working correctly 2022-01-02 23:14:18 +01:00
Lukas Wirth
19d894cdec minor: Cleanup syntax highlighting 2022-01-02 22:23:05 +01:00
Lukas Wirth
22160c418b fix NameRefClass misclassifying proc-macros 2022-01-02 19:20:10 +01:00
Lukas Wirth
9eed85b171 fix syntactic highlighting for macros 2022-01-02 19:10:23 +01:00
Lukas Wirth
3a525c831f internal: Handle macro calls better in highlighting 2022-01-02 19:10:10 +01:00
Aleksey Kladov
d846afdeef check top level entry point invariants 2022-01-02 18:41:32 +03:00
Benjamin Coenen
df6fa50f92 feat(diagnostics): add new config to fill default expression
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-31 16:29:08 +01:00
hkalbasi
e6139cf47b show values of constants in hover 2021-12-23 17:53:46 +03:30
Heinenen
05abfc77f5 hide type inlay hints 2021-12-23 12:56:38 +01:00
Heinenen
d7dfe93fc3 hide type inlay hints for enum variant constructors and tuple struct constructors 2021-12-23 12:56:38 +01:00
Lukas Wirth
85ed5a3182 Make hover test not relient on minicore structure 2021-12-22 02:36:31 +01:00
Lukas Wirth
40d5c58a80 Fully render const item completions from hir 2021-12-21 16:35:51 +01:00
bors[bot]
d3aa2579cc
Merge #11069
11069: fix: Partially fix `ide_db::search` for crate roots r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10007
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 16:50:35 +00:00
Lukas Wirth
5206946674 fix: Partially fix ide_db::search for crate roots 2021-12-20 17:48:47 +01:00
bors[bot]
f46731a230
Merge #11028
11028: Bump MSRV (1.57) r=Veykril a=iDawer

This bumps MSRV on all crates to 1.57 except `la-arena`

#10986 requires >=1.57 

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
rainy-me
67cc6c1e16 feat: treat fn keyword inside function pointer type as primitive 2021-12-19 01:51:51 +09:00
Laurențiu Nicola
8ad7c0439c Remove needless clones 2021-12-17 17:35:10 +02:00
Lukas Wirth
d3e538638a fix: Don't duplicate attribute completions 2021-12-17 15:22:53 +01:00
iDawer
676744be6e Bump MSRV (1.57) 2021-12-16 01:56:12 +05:00
Lukas Wirth
04a7fbbddb Move out doc-links tests into a separate module 2021-12-14 12:10:43 +01:00
zhoufan
c3ad945d9b fixes broken tests 2021-12-14 15:57:58 +08:00
bors[bot]
3f550d2e38
Merge #11000
11000: fix: insert whitespaces into assoc items for assist when macro generated r=Veykril a=Veykril

This is obviously only a temporary hack which still produces ugly looking items, but as long as the syntax is valid one can at least have rustfmt fix the formatting again. 
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6588
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-13 15:43:12 +00:00
Lukas Wirth
749eeef3e7 fix: insert whitespaces into assoc items for assist when macro generated 2021-12-13 16:35:32 +01:00
Lukas Wirth
328419534d Move ws insert rendering for macro expansion into ide_db 2021-12-13 15:55:13 +01:00
bors[bot]
4f04d8477a
Merge #10965
10965: minor: Remove dead assists-related function r=Veykril a=lnicola

Unless I'm missing something, `assists_with_fixes` seems to be always used and ends up in the same code path.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-11 15:06:52 +00:00
bors[bot]
d03397fe11
Merge #10978
10978: internal: Only prime direct dependencies of the workspace crates r=jonas-schievink a=lnicola

This reduces the number of primed crates on `self` from 177 to 105.

```text
# baseline
  86521 me   20   0 2939M  562M 14320 S  0.0  0.9  0:07.10   37 rust-analyzer

# pr
  99947 me   20   0 2935M  549M 14424 S  0.0  0.9  0:07.10   37 rust-analyzer
```

The RAM usage seems to vary a lot, so I'm not sure the improvement shown above is real.

We also drop the topological sorting, although it might still make sense to do the dependencies before the workspace crates. But since it's only used to make the progress reporting a bit more fine, it probably doesn't matter too much.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-10 22:31:55 +00:00
Lukas Wirth
c81aa68afe Don't show trait flyimports for impl trait and placeholders 2021-12-10 19:18:21 +01:00
Laurențiu Nicola
d012a20f25 Only prime direct dependencies of the workspace crates 2021-12-10 16:24:07 +02:00
Laurențiu Nicola
f5968cfc84 Remove dead assists-related function 2021-12-08 16:55:25 +02:00
bors[bot]
b7afb6fc6c
Merge #10958
10958: internal: add "Shuffle Crate Graph" command r=jonas-schievink a=jonas-schievink

May be useful for debugging issues like https://github.com/rust-analyzer/rust-analyzer/issues/10084

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-12-07 15:44:05 +00:00
Jonas Schievink
deb5c1426d internal: add "Shuffle Crate Graph" command 2021-12-07 16:37:19 +01:00
Lukas Wirth
f781e599cc Adjust incorrect runnable tests 2021-12-07 15:42:54 +01:00
Lukas Wirth
e09d410dcd Simplify 2021-12-07 15:06:56 +01:00
Lukas Wirth
b66f181bc0 Fix some TryToNav impls not upmapping ranges out of macros 2021-12-07 15:02:22 +01:00
Lukas Wirth
9b4ca77572 fix: Add highlighting hack back for unresolved attributes 2021-12-05 11:59:07 +01:00
bors[bot]
6434ada19e
Merge #10930
10930: fix: Fix self keyword not being tagged as such in highlighting properly r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10575
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-04 18:08:11 +00:00
Lukas Wirth
b35a50cb10 fix: Fix self keyword not being tagged as such in highlighting properly 2021-12-04 19:07:18 +01:00
bors[bot]
372a7cf981
Merge #10929
10929: internal: Split up macro/attribute semantic tokens a bit more r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-04 17:33:16 +00:00
Lukas Wirth
3472105ad9 Update semantic token docs 2021-12-04 18:23:25 +01:00
Lukas Wirth
e4f2d0e3a8 Introduce SymbolKind::Derive 2021-12-04 18:18:09 +01:00
Lukas Wirth
642c1eb720 Introduce SymbolKind::Attribute 2021-12-04 18:01:22 +01:00
Laurențiu Nicola
b7368d34a6 Bump pulldown-cmark-to-cmark 2021-12-04 15:21:04 +02:00
bors[bot]
3f3289df2a
Merge #10915
10915: feat: Resolve builtin-attr and tools in ide layer r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-03 19:28:36 +00:00
Lukas Wirth
8da850b6d5 Improve hover message for inert attributes 2021-12-03 20:28:15 +01:00
Lukas Wirth
d174158abc Rename things: Tool -> ToolModule 2021-12-03 17:15:19 +01:00
Lukas Wirth
70b8331fd5 Basic hover for builtin-attr and tool modules 2021-12-03 17:10:56 +01:00
Lukas Wirth
db559e5049 Simplify 2021-12-03 17:07:06 +01:00
Lukas Wirth
d1677f3286 Remove syntax highlighting hack for builtin attrs 2021-12-03 16:54:34 +01:00
Lukas Wirth
e58af219a4 feat: Resolve builtin-attr and tools in ide layer 2021-12-03 16:32:17 +01:00
bors[bot]
b68cd6eda2
Merge #10891
10891: fix: emit trait names in moniker identifier r=Veykril a=tjdevries

Hi,

Not sure if this is the best fix for the problem, but I noticed that functions that part of a trait are not namespaced with the trait name, so this could lead to problems if you had a function and a trait-function both defined in the same module.

Thanks!

TJ

Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
2021-12-02 11:21:59 +00:00
TJ DeVries
6870bfd099 fixup: include more information for impls 2021-12-02 00:04:03 -05:00
TJ DeVries
d50f18fb65 fixup: properly handle all associated items 2021-12-01 11:43:52 -05:00
Jake Heinz
30b0464ed8 add a fixme: 2021-12-01 12:26:27 +00:00
Jake Heinz
ba92bb1ed9 simplify 2021-12-01 12:25:08 +00:00
Jake Heinz
d2480ecb9f ide: hack to make self not unresolved reference in async trait wrapped impl's 2021-12-01 12:17:20 +00:00
Jake Heinz
b357569d0f add test 2021-12-01 10:28:18 +00:00
TJ DeVries
09c7e22ec2 fix: emit trait names in moniker identifier 2021-11-30 11:16:11 -05:00
bors[bot]
2d0db312b5
Merge #10872
10872: ide_db: build symbol index from crate def map r=Veykril a=jhgg

fixes #4842, #10764

Is this looking correct? 👀 

- [x] build the symbol index based upon the CrateDefMap for the given crate in `crate_symbols`
   - [x] make it multi threaded again, and figure out how to cache each moduleid's symbol index in salsa.
   - [x] NavigationTarget for names in macros is wrong, need to figure out how to compute a text range in the original file id?
   - [x] cleanup some duped code
   - [x] collect macros from `ItemScope.declared_macros()` into symbol index.
        - [x] store declared macros in `ItemScope` so we can figure out where macros were defined for the index.  
   - [x] do something about `SymbolIndex::for_files` - ideally it should use the new module symbol index stuff. 
       - [x] delete `source_file_to_file_symbols` & co...
           - [x] figure out what to do about `library_symbols` 
           - [x] maybe... speed up the new `library_symbols` - the new impl is probably much slower, and definitely much less parallel. **deciding to do nothing here, we can optimize later if necerssary.** 
   - [x] fix failing test: `navigation_target::tests::test_nav_for_symbol` - notably the crate def map doesn't seem to find declarations inside function. 
       - [x] now a bunch of other tests are failing around auto_import & qualify_path handlers. :(
           - [x] need to assoc items in traits and impls
 

Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-30 14:07:39 +00:00
Jake Heinz
b0c7ff39b8 remove one need for semantics 2021-11-30 04:50:09 +00:00
bors[bot]
393cbd0982
Merge #10841
10841: Emit moniker in lsif r=Veykril a=HKalbasi

fix #10559 

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
Co-authored-by: HKalbasi <45197576+HKalbasi@users.noreply.github.com>
2021-11-29 11:13:39 +00:00
Jake Heinz
1280887561 do something with library_symbols 2021-11-29 09:36:00 +00:00
hkalbasi
df261c10b9 remove duplicate data from CrateOrigin 2021-11-29 11:10:39 +03:30