Commit Graph

568 Commits

Author SHA1 Message Date
Jonas Schievink
b365b6119c Treat extern blocks as item containers 2021-12-07 17:31:26 +01:00
Lukas Wirth
89e1d19ec5 internal: Prefer resolution of inert attributes 2021-12-05 16:28:08 +01:00
Lukas Wirth
1f254dd855 feat: Enable flyimport completions for attributes 2021-12-05 15:57:28 +01: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
Jake Heinz
fec2d39f3c simplify?? 2021-12-01 09:23:42 +00:00
Jake Heinz
a1b2d25810 hir: resolve assoc trait type 2021-12-01 08:44:30 +00: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
f0bfe310a2 add a test 2021-11-29 10:36:22 +00:00
Jake Heinz
176f4da77a simplify work 2021-11-29 07:17:18 +00:00
Jake Heinz
1ed5699355 collect macros 2021-11-29 05:22:30 +00:00
Jake Heinz
d69e0dab56 cleanup the whole thing... 2021-11-29 03:54:52 +00:00
Jake Heinz
aecb9a378c traverse even more... 2021-11-29 02:07:16 +00:00
Jake Heinz
8850ea0b4f collect defs from body blocks 2021-11-29 01:09:39 +00:00
Jake Heinz
377162c0f8 container name? 2021-11-27 12:27:43 +00:00
Jake Heinz
a69af9daa3 sema parse_or_expand 2021-11-27 11:49:51 +00:00
Jake Heinz
0447be7589 wip 2021-11-27 11:25:05 +00:00
hkalbasi
30ed7fac27 Emit moniker in lsif 2021-11-22 21:29:05 +03:30
bors[bot]
55b7a06888
Merge #10820
10820: minor: Move incorrect case diagnostic things into their module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-20 16:26:50 +00:00
Lukas Wirth
69782f55de Move incorrect case diagnostic things into their module 2021-11-20 17:25:57 +01:00
Jake Heinz
7cbc6ae920 ide: hover omits unnamed where preds 2021-11-20 11:45:12 +00:00
bors[bot]
4c20d6879f
Merge #10807
10807: fix: Diagnose invalid derive attribute input r=Veykril a=Veykril

Doesn't yet diagnose incorrect syntax between the `(`, `)` braces as we discard those problems currently.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-19 12:20:13 +00:00
Lukas Wirth
ea03defeac fix: Diagnose invalid derive attribute input 2021-11-19 13:17:35 +01:00
bors[bot]
2fafe0e37c
Merge #10804
10804: fix: Diagnose using `derive` on non-adt items r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-19 11:34:22 +00:00
Lukas Wirth
6757910934 fix: Diagnose using derive on non-adt items 2021-11-19 12:10:55 +01:00
bors[bot]
bf8cf09967
Merge #10796
10796: ide: display static values in hover r=Veykril a=jhgg

Continuation from #10785 - does the same thing, but for `static`'s as well.

Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-18 09:48:10 +00:00
bors[bot]
b844d453b2
Merge #10795
10795: Remove unwrap in doc path resolution r=Veykril a=udoprog

I keep hitting this constantly in my project, and I haven't dug very deep into the root cause. But seeing as the project otherwise compiles it appears to be something unsupported is being incorrectly parsed in rust-analyzer which for other cases is handled by returning `None`.

Co-authored-by: John-John Tedro <udoprog@tedro.se>
2021-11-18 09:40:59 +00:00
Jake Heinz
e8d0989606 ide: display static values in hover 2021-11-18 06:00:51 +00:00
John-John Tedro
76e3feeeb5 Remove unwrap in doc path resolution 2021-11-18 05:20:53 +01:00
Jake
d5de7c21b2
Apply suggestions from code review
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-17 09:53:24 -08:00
Jake Heinz
312eafe916 maybe this is better?? 2021-11-17 07:02:49 +00:00
Jake Heinz
4fbc4b9356 hir: show const value in hover 2021-11-17 05:49:27 +00:00
bors[bot]
add6cccd4c
Merge #10781
10781: internal: Do not use reference search in `runnables::related_tests` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-16 20:51:09 +00:00
Lukas Wirth
366499c3be Do not use reference search in runnables::related_tests 2021-11-16 21:32:02 +01:00
Lukas Wirth
f2f89618b7 minor: Simplify 2021-11-16 19:28:32 +01:00
Lukas Wirth
5c0b895f69 Rename intern_macro -> intern_macro_call 2021-11-14 16:25:47 +01:00
bors[bot]
3b3063fb2d
Merge #10741
10741: internal: Flatten Definition::ModuleDef variant r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-10 23:19:44 +00:00
Lukas Wirth
7776aad166 internal: Flatten Definition::ModuleDef variant 2021-11-11 00:05:53 +01:00
Lukas Wirth
dea973089c Simplify 2021-11-10 18:26:18 +01:00
Lukas Wirth
26419c0379 Fix proc-macro attributes being shadowed by their functions in IDE layer 2021-11-08 14:49:50 +01:00
bors[bot]
726b4dd8bd
Merge #10704
10704: internal: Short-circuit `descend_into_macros_single` r=Veykril a=Veykril

There is no need to descend everything if all we are interested in is the first mapping.
This bring `descend_into_macros` timing in highlighting in `rust-analyzer/src/config.rs` from `154ms - descend_into_macros (2190 calls)` to `24ms - descend_into_macros (2190 calls)` since we use the single variant there(will regress once we want to highlight multiple namespaces again though).
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-05 15:06:37 +00:00
Lukas Wirth
4d768bede0 Short-circuit descend_into_macros_single 2021-11-05 16:03:45 +01:00
Lukas Wirth
addd93ed9a Don't search for root nodes unnecessarily 2021-11-05 15:52:10 +01:00
bors[bot]
274d9f90ae
Merge #10703
10703: internal: Don't check items for macro calls if they have no attributes r=Veykril a=Veykril

Turns out when highlighting we currently populate the Dynmaps of pretty much every item in a file, who would've known that would be so costly...
Shaves off 250 ms for the integrated benchmark on `rust-analyzer/src/config.rs`.

We are still looking at a heft `154ms - descend_into_macros (2190 calls)` but I feel like this is slowly nearing towards just call overhead.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-05 13:53:59 +00:00
Lukas Wirth
8dad1b9228 Don't check items for macro calls if they have no attributes 2021-11-05 14:50:10 +01:00
bors[bot]
d1e449e313
Merge #10701
10701: internal: Cache ast::MacroCalls to their expansions in Semantics::descend_into_macros_impl r=Veykril a=Veykril

Saves ~45ms when highlighting `rust-analyzer/src/config.rs` for me
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-05 13:26:56 +00:00