Commit graph

373 commits

Author SHA1 Message Date
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
Mara Bos
273d2f9123 Formatting. 2021-01-01 17:31:32 +01:00
Mara Bos
4833972067 Add support for Rust 2021. 2021-01-01 17:22:23 +01:00
Lukas Wirth
bbc0b41c37 Show lifetimes and labels on hover 2021-01-01 15:19:47 +01:00
bors[bot]
0e5fe47153
Merge #7080
7080: Implement ConstParams for HIR r=Veykril a=Veykril

r? @flodiebold 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-01 13:45:10 +00:00
Lukas Wirth
18bf2e5af5 Add ConstParams to the ide layer 2021-01-01 14:43:16 +01:00
kjeremy
dc1396eec7 Update crates 2020-12-30 10:39:50 -05:00
AdnoC
58c1949a7b test for new behavior 2020-12-29 22:52:47 -07:00
AdnoC
6eeec5d75f Smarter bracketed use diagnostic 2020-12-29 22:46:34 -07:00
Laurențiu Nicola
42c24ff25f Avoid a couple of allocations 2020-12-29 14:35:49 +02:00
Aleksey Kladov
2f22675537 Simplify assists resolution API
Assist vs UnresolvedAssist split doesn't really pull its weight. This
is especially bad if we want to include `Assist` as a field of
diagnostics, where we'd have to make the thing generic.
2020-12-26 14:11:42 +03:00
bors[bot]
14ee9f539c
Merge #7036
7036: Don't split path separators apart in doctest runnables r=Veykril a=Veykril

Fixes #7035

bors r+ 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-25 10:25:58 +00:00
Lukas Wirth
3ab4f3adbd Don't split path separators apart in doctest runnables 2020-12-25 11:22:11 +01:00
Aleksey Kladov
5d914834a9 Simplify more 2020-12-24 19:37:46 +03:00
Aleksey Kladov
29ed2e0e73 Simplify 2020-12-24 17:54:44 +03:00
bors[bot]
581419fd78
Merge #7030
7030: Support labels in reference search r=matklad a=Veykril

Implements general navigation for labels, goto def, rename and gives labels their own semantic highlighting class.

Fixes #6966

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-24 14:46:41 +00:00
Lukas Wirth
42e3f97c30 Support labels in reference search 2020-12-24 15:40:18 +01:00
Aleksey Kladov
33384d289e pit-of-success API for unresolved code actions 2020-12-24 15:32:29 +03:00
unexge
bfae2634b4 Prevent multiple incorrect case diagnostics in functions 2020-12-23 22:18:31 +03:00
Jeremy Kolb
4f989cfa08 Implement workspace/willRenameFiles for single-level file moves
Renames modules during file rename if they're in the same directory.
2020-12-23 07:47:31 -05:00
Jonas Schievink
26f604b907 Store invocation site for eager macros 2020-12-22 15:02:03 +01:00
bors[bot]
b98ee075ee
Merge #6746
6746: Feature/add assist extract module to file r=matklad a=sasurau4

Fix #6522 

## Screenshot

<img src="https://user-images.githubusercontent.com/13580199/102748269-33a44300-43a5-11eb-9e37-f5fcb8e62f73.gif" width=600 />


## TODO

- [x] Remove all TODO comment
- [x] Pass the doc test



Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2020-12-22 10:04:24 +00:00
Lukas Wirth
a4f34e2c8c Acquire original text range when searching for references 2020-12-21 17:28:47 +01:00
Daiki Ihara
2b4a7848a8 Update test diagnostics in ide 2020-12-21 15:55:40 +09:00
Daiki Ihara
7a2eebde22 Add initial_contents field for CreateFile 2020-12-21 15:55:40 +09:00
bors[bot]
eefbae7ed4
Merge #6921
6921: Higher-ranked trait bounds for where clauses r=flodiebold a=Veykril

There is a slight problem with this which is also noted in a FIXME now but `LifetimeParameters` of these ForLifetime where clauses allocate the lifetimes in the corresponding arena as if they were lifetimes of the item itself and not just the clause they belong to. I wasn't entirely sure what I could do about this but given nothing really uses lifetimes like that currently I figured it might be fine? Open to suggestions for that problem.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-20 11:47:01 +00:00
Aleksey Kladov
f6ed16674c Align code_model name with ungrammar 2020-12-20 10:05:24 +03:00
bjorn3
9fe85e1fdf Add test_rename_bind_pat 2020-12-19 19:55:44 +01:00
Aleksey Kladov
9f6d76da77 Make sure that HighlightModifier::ALL is synchronized with enum 2020-12-19 18:47:36 +03:00
Aleksey Kladov
113688cef0 Clarify the meaning of no-op highlight tag 2020-12-19 17:16:05 +03:00
Aleksey Kladov
a13947abe6 Use more Rustic highlighting specifiers
*Method* works for OO languages, but in rust we can also have
associated constants & types, so let's move this to a modifier.
2020-12-19 17:10:47 +03:00
Aleksey Kladov
c45221907a Deduplicate highlight tags and symbol kinds
Curiously, LSP uses different enums for those, and unsurprising and
annoyingly, there are things which exist in one but not in the other.

Let's not repeat the mistake and unify the two things
2020-12-18 23:04:26 +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
Aleksey Kladov
2465fa02b7 Cleaup imports
ide should re-export everything it needs.
2020-12-18 18:02:11 +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
Lukas Wirth
fa65d6ba85 Higher-ranked trait bounds for where clauses 2020-12-17 22:01:42 +01:00
Aleksey Kladov
c888f1de6f Rewrite doctest runnables
Handle more cases in a generic way without copy-pasting code.
2020-12-17 20:11:40 +03:00
Aleksey Kladov
0da1532ef2 Minor code style 2020-12-17 20:10:39 +03:00
Jonas Schievink
9231821c03 Make Attrs::from_attrs_owner private 2020-12-17 15:45:26 +01: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
dd496223f5 Node-ify lifetimes 2020-12-16 14:16:09 +01:00
Jonas Schievink
b238ddd21a Make macro def krate mandatory
Refactors builtin derive support to go through proper name resolution
2020-12-15 20:33:05 +01:00
Jonas Schievink
c1cb595382 Move to upstream macro_rules! model 2020-12-15 15:37:37 +01:00