Commit graph

197 commits

Author SHA1 Message Date
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
Nick Spain
3f1b3df65b Move impls of ToNav that use source() to TryToNav 2021-01-02 21:53:52 +11:00
Nick Spain
c936e4b86f source_old -> source for cases that can be handled by simple bubbling 2021-01-02 21:53:52 +11:00
Nick Spain
14d0db0759 HasSource::source_old -> HasSource::source for places where proc-macros were special cased
In #6901 some special case handling for proc-macros was introduced to
prevent panicing as they have no AST. Now the new HasSource::source
method is used that returns an option.

Generally this was a pretty trivial change, the only thing of much
interest is that `hir::MacroDef` now implements `TryToNav` not `ToNav`
as this allows us to handle `HasSource::source` now returning an option.
2021-01-02 21:53:52 +11:00
Nick Spain
ea4708c444 Mark HasSource::source_old as deprecated but allow at all call sites 2021-01-02 21:53:51 +11:00
Nick Spain
27cadcd531 HasSource::source -> HasSource::source_old
To start migrating HasSource::source to return an Option.
2021-01-02 21:53:51 +11:00
Lukas Wirth
bbc0b41c37 Show lifetimes and labels on hover 2021-01-01 15:19:47 +01:00
Lukas Wirth
18bf2e5af5 Add ConstParams to the ide layer 2021-01-01 14:43:16 +01:00
Lukas Wirth
42e3f97c30 Support labels in reference search 2020-12-24 15:40:18 +01:00
Aleksey Kladov
f6ed16674c Align code_model name with ungrammar 2020-12-20 10:05:24 +03:00
Aleksey Kladov
ade2f5cd12 Reduce test verbosity 2020-12-18 21:26:47 +03:00
Aleksey Kladov
0e3581e823 NavTarget doesn't assume that it points to a symbol 2020-12-18 21:15:48 +03:00
Aleksey Kladov
55ba353b39 Don't expose SyntaxKind from IDE API
SyntaxKind is somewhat of an internal type, but IDE is using it to
basically specify an icon. Let's have a dedicated entity for this
instead.
2020-12-18 19:28:48 +03:00
bors[bot]
f4929fa9cc
Merge #6901
6901: Temp fixes panic caused by no ast for proc-macro r=maklad a=edwin0cheng

There are some panic when hover/goto definition for proc-macro. It is because in current design, we don't have `ast-node` for proc-macro and then it trigger [this](479d1f7eec/crates/hir/src/has_source.rs (L116)) line to panic.

This PR is a temp fix for all of these similar to bd4c352831/crates/completion/src/render/macro_.rs (L42)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-12-18 02:30:51 +00:00
Edwin Cheng
60a3785ac2 Temp fixes panic caused by no ast for proc-macro 2020-12-18 10:26:17 +08:00
Aleksey Kladov
2ae31e34b1 Rename ImplDef -> Impl
We used to have `Def` suffix for all symbols, but we moved off from
that. `FunctionDef` isn't better than `Function`. Looks like we've
forgot to change `Impl` though!
2020-12-17 14:36:15 +03:00
Lukas Wirth
55faa2daa3 Lifetime reference search 2020-12-16 22:21:01 +01:00
Lukas Wirth
37c5b82938 Don't highlight parent nodes of comments on hover 2020-12-11 16:00:52 +01:00
Lukas Wirth
da3b5e35a6 Test inner and outer doc comments in hover 2020-12-09 09:42:15 +01:00
Lukas Wirth
1caaa201fa Remove hir_def/docs.rs module 2020-12-07 19:58:17 +01:00
Lukas Wirth
93262c750e Don't insert blank lines between doc attributes 2020-12-07 16:10:46 +01:00
Lukas Wirth
9349d9ee48 Show type of Self on hover 2020-11-29 22:49:12 +01:00
Lukas Wirth
ee8afff714 Show type of self param on hover 2020-11-28 22:59:24 +01:00
bors[bot]
bf84e4958e
Merge #6331 #6342
6331: correct hover text for items with doc attribute with raw strings r=matklad a=JoshMcguigan

Fixes #6300 by improving the handling of raw string literals in attribute style doc comments.

This still has a bug where it could consume too many `"` at the start or end of the comment text, just as the original code had. Not sure if we want to fix that as part of this PR or not? If so, I think I'd prefer to add a unit test for either the `as_simple_key_value` function (I'm not exactly sure where this would belong / how to set this up) or create a `fn(&SmolStr) -> &SmolStr` to unit test by factoring out the `trim` operations from `as_simple_key_value`. Thoughts on this? 

6342: Shorter dependency chain r=matklad a=popzxc

Continuing implementing suggestions from the `Completion refactoring` zulip thread.

This PR does the following:

- Removes dependency of `completions` on `assists` by moving required functionality into `ide_db`.
- Moves completely `call_info` crate into `ide_db` as it looks like it fits perfect there.
- Adds a bunch of new tests and docs.
- Adds the re-export of `base_db` to the `ide_db` and removes direct dependency on `base_db` from other crates.

The last point is controversial, I guess, but I noticed that in places where `ide_db` is used, `base_db` is also *always* used. Thus I think the dependency on the `base_db` is implied by the fact of `ide_db` interfaces, and thus it makes sense to just provide `base_db` out of the box.


Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-10-24 19:08:12 +00:00
Igor Aleksanov
19cce08662 Re-export base_db from ide_db 2020-10-24 11:39:57 +03:00
Josh Mcguigan
4e76e884bd correct hover for items with doc attribute with raw strings 2020-10-23 19:36:30 -07:00
Jonas Schievink
3421b645e6 Emit better #[cfg] diagnostics 2020-10-22 19:19:18 +02:00
Aleksey Kladov
af4e75533f Rename declaration_name -> display_name
Declaration names sounds like a name of declaration -- something you
can use for analysis. It empathically isn't, and is just a label
displayed in various UI. It's important not to confuse the two, least
we accidentally mix semantics with UI (I believe, there's already a
case of this in the FamousDefs at least).
2020-10-20 15:38:11 +02:00
Aleksey Kladov
c5868a4879 Clarify the names one more time 2020-10-15 17:38:51 +02:00
Aleksey Kladov
56e67e3a39 More idiomatic classification API 2020-10-15 17:38:17 +02:00
Aleksey Kladov
fa3c449d8f Clarify NameClass names a bit 2020-10-15 17:37:36 +02:00
Vlad Shcherbina
e6fbb94edd Fix hover over field pattern shorthand
Instead of the information about the field, it now shows the information
about the local.

Fixes #6146
2020-10-14 21:22:00 +03:00
Zac Pullar-Strecker
3bd4fe96dc Remove methodowner & fix formatting 2020-10-08 15:50:48 +13:00
Zac Pullar-Strecker
8c32bdea36 Rename ide::link_rewrite -> ide::doc_links & tidy imports 2020-10-08 15:01:30 +13:00
bors[bot]
57735f2a32
Merge #6140
6140: honour hover.content_format client capability r=lnicola a=robinvd

This removes all markdown when the client does not support the markdown MarkupKind.

Otherwise the output on the editor will have some markdown boilerplate, making it less readable.

For example kak_lsp does not currently support markdown.
![image](https://user-images.githubusercontent.com/22073483/95112949-ef0ff080-0741-11eb-82a7-0594fa2cd736.png)

after:
![image](https://user-images.githubusercontent.com/22073483/95113089-2bdbe780-0742-11eb-94fa-bcfec6d7347a.png)



Co-authored-by: Robin van Dijk <robin@robinjint.nl>
2020-10-06 17:51:20 +00:00
Robin van Dijk
c3cc361294 honor content_format clientcap
This removes all markdown when the client does not support the markdown MarkupKind

Otherwise the output on the editor will have some markdown boilerplate, making it less readable
2020-10-05 19:27:29 +02:00
Kirill Bulatov
9d19e5b962 Properly name the field 2020-10-02 21:38:22 +03:00
Kirill Bulatov
cae2e859ff Add a dash test 2020-10-02 20:59:32 +03:00
Aleksey Kladov
b06259673f rename mock_analysis -> fixture 2020-10-02 17:49:44 +02:00
Aleksey Kladov
09348b2474 Get rid of MockAnalysis 2020-10-02 17:31:20 +02:00
flw
e73ee9dfa2
Add hover config linksInHover to suppress links 2020-09-29 19:47:18 +08:00
oxalica
529c369c9b
Fix type walking about type of async block 2020-09-12 01:08:50 +08:00
Aleksey Kladov
f8a59adf5e Tease apart orthogonal concerns in markdown link rewriting
`hir` should know nothing about URLs, markdown and html. It should
only be able to:

* resolve stringy path from documentation
* generate canonical stringy path for a def

In contrast, link rewriting should not care about semantics of paths
and names resolution, and should be concern only with text mangling
bits.
2020-08-26 20:24:00 +02:00
Aleksey Kladov
1c0ac2b9b4 Cleanup hover links tests 2020-08-26 18:36:16 +02:00
Zac Pullar-Strecker
7bbca7a1b3 Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links 2020-08-24 21:20:13 +12:00
Aleksey Kladov
b0fd3faf36 Switch to expect_test from crates.io 2020-08-21 13:19:31 +02:00
Benjamin Coenen
947a27b797 display correctly 'impl Trait<T> + Trait<T>' #4814
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-08-13 22:13:34 +02:00
Aleksey Kladov
1b0c7701cc Rename ra_ide -> ide 2020-08-13 17:58:27 +02:00
Renamed from crates/ra_ide/src/hover.rs (Browse further)