Commit graph

197 commits

Author SHA1 Message Date
Lukas Wirth
bfe0fa009e Resolve derive attribute input macro paths in ide layer 2021-07-24 20:35:43 +02:00
Lukas Wirth
ef6fed052c Correctly classify Rename Names 2021-07-23 02:14:59 +02:00
Lukas Wirth
bb71ebb985 Move doc_links tests from hover to doc_links 2021-07-20 17:57:47 +02:00
Lukas Wirth
cb7b4a5d5b Some more fragment fixes 2021-07-20 17:03:39 +02:00
Lukas Wirth
e8f1abf5f7 Correctly generate link fragments for associated items 2021-07-20 16:01:27 +02:00
Lukas Wirth
97d63d67cd Resolve paths to assoc items for traits 2021-07-19 20:51:57 +02:00
Lukas Wirth
c41f1279a3 Inline name classification reference calls 2021-07-11 15:39:09 +02:00
Lukas Wirth
c65bb7f8b9 Explicitly check for reference locals or fields in Name classification 2021-07-11 15:04:40 +02:00
Aleksey Kladov
bbb053532e internal: remove one more needless extern crate 2021-07-11 15:48:49 +03:00
Aleksey Kladov
1171dc74e0 internal: remove unused param 2021-07-11 15:08:00 +03:00
bors[bot]
325140a165
Merge #9449
9449: feat: Emit test names in `Run test` runnables if they come from a macro expansion r=matklad a=Veykril

Fixes #8964
Before:
![Code_D1Tu5Iuh5I](https://user-images.githubusercontent.com/3757771/124174685-f552b380-daac-11eb-9086-c97db014b77c.png)
After:
![image](https://user-images.githubusercontent.com/3757771/124174493-bb81ad00-daac-11eb-96c7-3de6545a62e1.png)

Basically when a macro emits more than one test we name the test functions/modules name in the runnable instead to not emit a bunch of equally named `Run Test` annotations which don't really tell much.

Note that the `Run fibonacci_test Tests` line is below the attributes due to the fact that the function name span is being reused for the generated module in rstest's expansion.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-11 09:37:33 +00:00
Lukas Wirth
f1b3446844 Emit test name in Run test runnables if it comes from a macro expansion 2021-07-09 14:35:42 +02:00
Aleksey Kladov
0db4f3f6a4 internal: ensure consistent passing for config params
We pass "context" parametes first, so configs should be on the left.
"Bigger" context wins, so configs goes after db.
2021-07-06 00:00:39 +03:00
Lukas Wirth
a7d61ddba4 Add cov_mark 2021-07-02 19:34:49 +02:00
Lukas Wirth
f640f2dbb4 Fix incorrect guard for NameRefClass attribute resolution 2021-07-02 15:17:21 +02:00
bors[bot]
0331d19f42
Merge #9451
9451: minor: Add `goto_type_action` for field hovers r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-01 19:52:14 +00:00
Lukas Wirth
81762024b5 Add goto_type_action for field hovers 2021-07-01 21:51:26 +02:00
Lukas Wirth
b8507ca98d Don't add test runnables for outline modules in the wrong file 2021-06-30 19:08:13 +02:00
Lukas Wirth
9957220dfe Fix NameRef::classify path resolution inside attributes 2021-06-28 19:07:23 +02:00
Lukas Wirth
f615efdfc3 Factor out pick_best_token ide pattern into ide_db 2021-06-22 17:50:15 +02:00
Lukas Wirth
65d683df36 Collapse documentation and markdown config settings into an enum 2021-06-21 21:57:01 +02:00
Lukas Wirth
99c95b8fa1 Split hover actions config into its own config struct 2021-06-21 21:47:54 +02:00
bors[bot]
25bf451c84
Merge #9264
9264: feat: Make documentation on hover configurable r=Veykril a=Veykril

This also implements deprecation support for config options as this renames `hoverActions_linksInHover` to `hover_linksInHover`.

Fixes #9232

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 14:15:49 +00:00
bors[bot]
3843bd02a0
Merge #9328
9328: internal: Update deps r=lnicola a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-06-20 03:22:13 +00:00
Aleksey Kladov
89a0e58393 internal: use minicore deref more 2021-06-18 22:47:02 +03:00
Aleksey Kladov
15c4b3fa7f internal: add Copy to minicore 2021-06-18 22:10:52 +03:00
kjeremy
e0e694620c Update test 2021-06-18 14:36:12 -04:00
Aleksey Kladov
66673eae2b internal: retire famous_defs_fixture
This is now done declaratively via `minicore`.
2021-06-18 00:42:32 +03:00
Aleksey Kladov
ebb591a570 internal: add derive and ord support to minicore 2021-06-18 00:30:22 +03:00
Aleksey Kladov
ca99aaa053 internal: add From to minicore 2021-06-17 21:04:12 +03:00
Aleksey Kladov
08c220ab2c internal: add default to minicore 2021-06-17 20:49:49 +03:00
Aleksey Kladov
8a4d9bb80a internal: add fn to minicore 2021-06-16 12:15:45 +03:00
Aleksey Kladov
7cbcbccc78 internal: switch some tests to minicore 2021-06-15 23:11:53 +03:00
Aleksey Kladov
3f4ad44082 internal: document that we don't #[ignore] tests 2021-06-15 11:46:47 +03:00
Lukas Wirth
c7c2eb8b08 typo 2021-06-14 18:01:38 +02:00
Lukas Wirth
9043c5db86 Don't ignore hover documentation setting for keyword hovers 2021-06-14 15:31:14 +02:00
Lukas Wirth
a93d166f0f Make documentation on hover configurable 2021-06-14 15:25:10 +02:00
Maan2003
75370312fb
clippy::redundant_closure 2021-06-13 09:29:36 +05:30
Maan2003
705f7e6e26
clippy::clone_on_copy 2021-06-13 09:27:19 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
Jonas Schievink
1d6eef1350 Update ungrammar 2021-06-11 18:34:30 +02:00
bors[bot]
98395f29a4
Merge #9138
9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes https://github.com/rust-analyzer/rust-analyzer/issues/8857, fixes https://github.com/rust-analyzer/rust-analyzer/issues/3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

We also generate the default lints(and lint groups 🎉) instead now by invoking `rustc -W help` and parsing the output from that.


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-04 17:45:37 +00:00
Lukas Wirth
0c89f38378 Replace - with _ in generated lint names 2021-06-04 19:10:52 +02:00
Lukas Wirth
343df88ac7 Generate default lint completions 2021-06-04 18:35:19 +02:00
Lukas Wirth
5d17b6a687 Implement hover for lints 2021-06-04 17:03:18 +02:00
Lukas Wirth
07394316ff Add function references hover action 2021-06-04 15:54:55 +02:00
Lukas Tobias Wirth
da74c66947 Correctly resolve crate name in use paths when import shadows itself 2021-05-23 19:37:01 +02:00
bors[bot]
c2be91dcd8
Merge #8245
8245: Properly resolve intra doc links in hover and goto_definition r=matklad a=Veykril

Unfortunately involves a bit of weird workarounds due to pulldown_cmark's incorrect lifetimes on `BrokenLinkCallback`... I should probably open an issue there asking for the fixes to be pushed to a release since they already exist in the repo for quite some time it seems.

Fixes #8258, Fixes #8238

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-05 12:30:20 +00:00
Jonas Schievink
7ceaba21df Only populate prelude for crate-level DefMaps 2021-04-02 19:00:26 +02:00
Lukas Wirth
9fe10a9606 Resolve associated types with type anchors 2021-04-01 21:52:07 +02:00
Lukas Wirth
444f6caaba Resolve associated types 2021-04-01 21:31:25 +02:00
bors[bot]
55d7d71590
Merge #8267
8267: Adding gifs and screenshots for features in manual r=matklad a=MozarellaMan

For #6539

This includes most of gif or screenshot examples of most items in the "Features" header. With the exceptions of:

- **On Typing Assists** - couldn't get it to work for a demo, I'm probably missing something?
- **Structural search and replace** - looked to be already a visual example of the feature
- **Workspace symbol** - wasn't sure how best to show this, all of the examples maybe? Also wasn't sure of the best code example to show it off
- **Semantic Syntax Highlighting** - seemed obvious enough to not need a screenshot, but I could easily add this

All the gifs/pngs are hosted in this [comment](https://github.com/rust-analyzer/rust-analyzer/issues/6539#issuecomment-809574840). Please let me know if any of them aren't suitable (and why) and I'll improve it! Or if you don't like the theme/font

Co-authored-by: Ayomide Bamidele <48062697+MozarellaMan@users.noreply.github.com>
2021-03-31 10:01:56 +00:00
Ayomide Bamidele
276022682b Gifs and screenshots for features in manual 2021-03-31 00:08:10 +01:00
bors[bot]
fd7c454d51
Merge #8186
8186: Lower traits to `TraitRef` instead of `TypeRef` r=matklad a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-30 16:45:05 +00:00
Lukas Wirth
bb56b7a75c Use new new docs string source mapping in goto_def and hover 2021-03-30 18:27:16 +02:00
Lukas Wirth
9df78ec4a4 Properly resolve intra doc links in hover and goto_definition 2021-03-30 14:03:32 +02:00
ivan770
4fcba8b1bf
Fix code style 2021-03-30 12:58:41 +02:00
Lukas Wirth
c2a63b97a8 Rename target_ty to self_ty 2021-03-29 17:47:47 +02:00
Edwin Cheng
eedadd7024 Add support for doc on hover for macro 2.0 2021-03-27 14:57:11 +08:00
Lukas Wirth
8b0d0bd9c7 Show item info when hovering intra doc links 2021-03-23 19:57:04 +01:00
Jonas Schievink
c05a1a6e37 Store an AstId for procedural macros 2021-03-18 16:11:18 +01:00
Lukas Wirth
5734b347dd Fix incorrect newline emission in Attrs::docs 2021-03-17 17:00:08 +01:00
Lukas Wirth
ec824a92d0 Better handling of block doc comments 2021-03-17 14:48:57 +01:00
Lukas Wirth
4d1e1daa31 Implement HirDisplay for some more types 2021-03-16 16:36:34 +01:00
bors[bot]
c49b5b7468
Merge #7498
7498: Clone for update r=matklad a=matklad

rowan counterpart https://github.com/rust-analyzer/rowan/pull/93

#6857

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-16 13:14:48 +00:00
Aleksey Kladov
f5a81ec468 Upgrade rowan
Notably, new rowan comes with support for mutable syntax trees.
2021-03-16 16:10:49 +03:00
oxalica
455b418263
Update tests 2021-03-16 01:24:26 +08:00
oxalica
87171238c6
Use hir formatter more 2021-03-16 01:04:33 +08:00
oxalica
ef416e0154
Impl HirDisplay for function hover message 2021-03-16 01:04:20 +08:00
oxalica
ef48d1ca3b
Add test for hover of macro expanded function 2021-03-16 01:01:24 +08:00
Lukas Wirth
814d617d34 Show whether a binding is mutable or not on hover 2021-03-09 17:18:50 +01:00
Laurențiu Nicola
fc9eed4836 Use upstream cov-mark 2021-03-08 22:19:44 +02:00
Lukas Wirth
8d305680e6 Show docs on hover for keywords and primitives 2021-03-02 14:41:01 +01:00
Lukas Wirth
ca7cd41a48 Fix lowering trailing self paths in UseTrees 2021-02-28 23:44:49 +01:00
Lukas Wirth
9e5192d917 Don't lower TypeBound::Lifetime as GenericPredicate::Error 2021-02-20 19:08:20 +01:00
Lukas Wirth
51dda8ea8e Show hover info of the definition of ConstReference patterns instead of its type 2021-02-17 14:14:58 +01:00
Jonas Schievink
216dc856c5 Wrap BuiltinType in code model 2021-02-11 19:52:33 +01:00
Lukas Wirth
999e020da2 Return inner attributes of outline mod declarations in attrs_query 2021-01-31 19:53:01 +01:00
Daiki Ihara
f5b97e52c9 Fix broken link in intra-doc 2021-01-22 20:06:45 +09:00
Jonas Schievink
82146737ac Treat BlockExpr as a potential module origin 2021-01-20 20:05:48 +01:00
bors[bot]
8935106b39
Merge #7321
7321: Support runnables in macros r=matklad a=edwin0cheng

fixes  #4771

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-19 09:27:45 +00:00
Edwin Cheng
8b03b58ad7 Support runnables in macros 2021-01-19 16:58:11 +08:00
Lukas Wirth
98718e0544 Wrap remaining self/super/crate in Name{Ref} 2021-01-15 22:18:43 +01:00
Lukas Wirth
cb863390f2 Handle self/super/crate in PathSegment as NameRef 2021-01-15 19:21:23 +01:00
bors[bot]
8ad325a806
Merge #7051 #7219 #7245 #7246
7051: Check dbg! macro in tidy_test r=matklad a=edwin0cheng

Same as `check_todo` but for dbg! macro

r? @matklad 

7219: Refactor rename name checking r=matklad a=Veykril

Improves the user facing error messages a bit and prevents renaming to `_` when the name is referenced as this would change source to not compile anymore since `_` is only a pattern, not a proper identifier.

7245: Encourage gifs r=matklad a=matklad

bors r+
🤖

7246: Unfreeze cargo_metadata r=matklad a=kjeremy

It now pulls in a newer version of semver-parser.

This does add a dependency on `cargo-platform` in the interest of correctness.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-11 13:37:28 +00:00
bors[bot]
607b9ea160
Merge #7218
7218: Fix typos r=Veykril a=regexident

Apart from the very last commit on this PR (which fixes a public type's name) all changes are non-breaking.

Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-01-10 18:16:29 +00:00
bors[bot]
dcbb77cb6c
Merge #7206 #7231
7206: Use hir::GenericParam in ide_db::Definition instead of relisting all 3 r=Veykril a=Veykril

Basically just this:
```diff
 pub enum Definition {
     Macro(MacroDef),
     Field(Field),
     ModuleDef(ModuleDef),
     SelfType(Impl),
     Local(Local),
-    TypeParam(TypeParam),
-    LifetimeParam(LifetimeParam),
-    ConstParam(ConstParam),
+    GenericParam(GenericParam),
     Label(Label),
 }
```

7231: Cleaner API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-10 11:45:59 +00:00
Lukas Wirth
b795128dde Use hir::GenericParam in ide_db::Definition instead of relisting all 3 2021-01-10 12:33:47 +01:00
Aleksey Kladov
3a6ae42eac Cleanup 2021-01-10 14:24:01 +03:00
Lukas Wirth
919a1d7b27 Refactor rename name checking 2021-01-09 16:59:00 +01:00
Vincent Esche
21f8239ac8 Fixed typos in code comments 2021-01-09 15:41:29 +01:00
Kevaundray Wedderburn
72b9a4fbd3 Change <|> to $0 - Rebase 2021-01-07 12:09:23 +00:00
Aleksey Kladov
c8ace3a295 Remove some stale deprecations 2021-01-07 13:54:18 +03:00
Aleksey Kladov
f7a15b5cd1 More maintainable config
Rather than eagerly converting JSON, we losslessly keep it as is, and
change the shape of user-submitted data at the last moment.

This also allows us to remove a bunch of wrong Defaults
2021-01-06 15:39:28 +03:00
Lukas Wirth
54b9b03ca2 Show GotoTypeAction for TypeParam 2021-01-04 15:54:45 +01:00
Lukas Wirth
bd47e140b6 Show GotoTypeAction for ConstParam 2021-01-04 15:19:09 +01:00
Lukas Wirth
cd6426afe5 Show implementations when hovering over SelfType 2021-01-04 14:57:59 +01:00
Lukas Wirth
5804b3fae8 Fix HoverAction::Implementation typo 2021-01-04 14:38:08 +01:00
Lukas Wirth
0ae0909a16 Implement hover for ConstParam 2021-01-04 14:18:31 +01:00
Lukas Wirth
47900dd3bc Impl hovering for TypeParams 2021-01-04 12:24:47 +01:00