Commit graph

6994 commits

Author SHA1 Message Date
Jeremy Kolb
9e71ff9636 Report macro calls as functions 2020-01-12 17:22:09 -05:00
bors[bot]
a05970da46
Merge #2788
2788: Fix file_structure()  to recognize macro_rules! r=flodiebold a=ruabmbua

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

Not sure what to do about classifying macro definitions. Maybe make all macro invocations a function invocation?

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-01-12 17:34:47 +00:00
Roland Ruckerbauer
20b8d283ae Remove hir usage from macro_rules! detection in structure_node() 2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
15c5426b54 Use hir .path() and .name() to differentiate
macro call and macro definition
2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
c6655c67d2 Added test for file_structure unidentified macro definition 2020-01-12 17:34:57 +01:00
Roland Ruckerbauer
db151763d4 Fix file_structure() to recognize macro_rules!
where first token != "macro_rules"
2020-01-12 17:34:57 +01:00
bors[bot]
d0b52e5d84
Merge #2814
2814: Update crates r=matklad a=kjeremy

Adds a new dependency on autocfg 1.0. There are pending PRs against indexmap, crossbeam and rand to bring them up.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-01-12 15:57:38 +00:00
bors[bot]
f7a7092d69
Merge #2712
2712: Supporting extend selection inside macro calls r=edwin0cheng a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-12 12:26:40 +00:00
Edwin Cheng
0593da9a36 Fix format 2020-01-12 20:25:58 +08:00
Edwin Cheng
384e1ced88 Use prev_token and next_token 2020-01-12 20:25:58 +08:00
Edwin Cheng
b7ab079211 Use indices first and last instead of min-max 2020-01-12 20:25:58 +08:00
Edwin Cheng
caed836e41 Use first and last token only 2020-01-12 20:25:58 +08:00
Edwin Cheng
b30e6a7b56 Handle extend selection in recursive macro 2020-01-12 20:25:58 +08:00
Edwin Cheng
07f4171b18 Minor fix 2020-01-12 20:25:58 +08:00
Edwin Cheng
4c4416543a Fix formatting 2020-01-12 20:25:58 +08:00
Edwin Cheng
83b2d78bbb Supporting extend selection inside macro calls 2020-01-12 20:25:58 +08:00
bors[bot]
8bb2a50ce6
Merge #2807
2807: Use attr location for builtin derive in goto-implementation r=matklad a=edwin0cheng

This PR is use attribute location for builtin derive in `ImplBlock`'s NavigationTarget such that the goto-implementation will goto to a correct position. 

Related to #2531

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-12 11:33:31 +00:00
Edwin Cheng
db5f73d261 Add test 2020-01-12 19:24:34 +08:00
bors[bot]
21be386db8
Merge #2809
2809: Qualify paths in 'fill match arms' assist r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-12 11:23:11 +00:00
Florian Diebold
2c11a9b42d Qualify paths in 'fill match arms' assist 2020-01-12 11:34:52 +01:00
Edwin Cheng
d7be1a4372 Use attr location for builtin macro goto-imp 2020-01-12 18:08:53 +08:00
Jeremy Kolb
38c3b02f96 Update crates 2020-01-11 20:16:35 -05:00
bors[bot]
86d2af9f7b
Merge #2803
2803: Fix various names, e.g. Iterator not resolving in core prelude r=matklad a=flodiebold

Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-11 23:00:37 +00:00
bors[bot]
bcfd297f49
Merge #2727
2727: Qualify paths in 'add impl members' r=flodiebold a=flodiebold

This makes the 'add impl members' assist qualify paths, so that they should resolve to the same thing as in the definition. To do that, it adds an algorithm that finds a path to refer to any item from any module (if possible), which is actually probably the more important part of this PR 😄 It handles visibility, reexports, renamed crates, prelude etc.; I think the only thing that's missing is support for local items. I'm not sure about the performance, since it takes into account every location where the target item has been `pub use`d, and then recursively goes up the module tree; there's probably potential for optimization by memoizing more, but I think the general shape of the algorithm is necessary to handle every case in Rust's module system.

~The 'find path' part is actually pretty complete, I think; I'm still working on the assist (hence the failing tests).~

Fixes #1943.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-01-11 22:42:39 +00:00
Florian Diebold
9dc1826cfa Fix various names, e.g. Iterator not resolving in core prelude
Basically, `Iterator` is re-exported via several steps, which happened to not be
resolved yet when we got to the prelude import, but since the name resolved to
the reexport from `core::iter` (just to no actual items), we gave up trying to
resolve it further.

Maybe part of the problem is that we can have
`PartialResolvedImport::Unresolved` or `PartialResolvedImport::Indeterminate`
with `None` in all namespaces, and handle them differently.

Fixes #2683.
2020-01-11 23:37:58 +01:00
Florian Diebold
ccb75f7c97 Use FxHashMap 2020-01-11 23:33:04 +01:00
Florian Diebold
4496e2a06a Apply review suggestions 2020-01-11 23:33:04 +01:00
Florian Diebold
15fc643e05 Fix ordering problem between qualifying paths and substituting params 2020-01-11 23:33:04 +01:00
Florian Diebold
12905e5b58 Some more refactoring 2020-01-11 23:33:04 +01:00
Florian Diebold
def124e932 Fix file ID when qualifying paths; add another failing test 2020-01-11 23:33:04 +01:00
Florian Diebold
4545f289a9 Handle type args 2020-01-11 23:33:04 +01:00
Florian Diebold
5cb1f71322 More failing tests 2020-01-11 23:33:04 +01:00
Florian Diebold
4d75430e91 Qualify some paths in 'add missing impl members' 2020-01-11 23:33:04 +01:00
Florian Diebold
460fa71c55 Use self 2020-01-11 23:33:04 +01:00
Florian Diebold
2906d188c2 Cleanup 2020-01-11 23:33:04 +01:00
Florian Diebold
38cd9f0c94 Handle cycles 2020-01-11 23:33:04 +01:00
Florian Diebold
b1325488ec Use query for importable locations 2020-01-11 23:33:04 +01:00
Florian Diebold
947eec7b87 Use super, don't use private imports 2020-01-11 23:33:04 +01:00
Florian Diebold
df9d3bd25e Use shortest path 2020-01-11 23:33:04 +01:00
Florian Diebold
1ea2b475a9 handle most cases 2020-01-11 23:33:04 +01:00
Florian Diebold
b62292e8f9 basics working 2020-01-11 23:33:04 +01:00
Florian Diebold
2c50f996b6 more WIP 2020-01-11 23:33:04 +01:00
Florian Diebold
22b412f1a9 find_path WIP 2020-01-11 23:33:04 +01:00
Florian Diebold
877fda04c5 Add test 2020-01-11 23:33:04 +01:00
bors[bot]
e90aa86fbf
Merge #2804
2804: Use lsp-seq-first in ra-emacs-lsp since that's more likely to exist r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-01-11 22:32:14 +00:00
Florian Diebold
c0b5d59bd6 Use lsp-seq-first in ra-emacs-lsp since that's more likely to exist 2020-01-11 23:31:16 +01:00
bors[bot]
2e09a96f82
Merge #2800
2800: Stick to defaulter release profile r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-11 21:15:50 +00:00
Aleksey Kladov
dde64aa744 Stick to defaulter release profile 2020-01-11 22:15:27 +01:00
Aleksey Kladov
af0059a4d1
Merge pull request #2798 from matklad/release-process
Tweak release workflow
2020-01-11 22:04:13 +01:00
Aleksey Kladov
7e1a25f149 Tweak release workflow 2020-01-11 21:50:32 +01:00