Commit graph

1543 commits

Author SHA1 Message Date
Josh Mcguigan
df58ab8963 update itertools version to 0.9.0 2020-03-23 16:22:46 -07:00
Aleksey Kladov
f8fd242199
Merge pull request #3686 from Veetaha/feature/hover-actual-type-params
ra_hir: add more privacy for Type
2020-03-23 14:06:54 +01:00
Aleksey Kladov
a2f7ca27c0
Merge pull request #3678 from edwin0cheng/refactor-rename
Fix rename argument in macro call
2020-03-23 14:06:40 +01:00
veetaha
e6691844db ra_hir: fix typo 2020-03-23 14:04:50 +02:00
veetaha
0fc21bd303 ra_hir: add more docs 2020-03-23 14:00:51 +02:00
veetaha
559aeb2932 ra_hir: add more privacy for Type 2020-03-23 02:01:07 +02:00
Edwin Cheng
af8c37cb57
Fix typo
Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-22 22:01:48 +08:00
veetaha
bfb6e3fd83 ra_hir: migrate some stuff to matches!() 2020-03-22 15:45:32 +02:00
Edwin Cheng
532e178f8e Add find_node_at_offset_with_descend 2020-03-22 19:52:14 +08:00
Aleksey Kladov
9faea2364d Use dyn Trait for working with databse
It improves compile time in `--release` mode quite a bit, it doesn't
really slow things down and, conceptually, it seems closer to what we
want the physical architecture to look like (we don't want to
monomorphise EVERYTHING in a single leaf crate).
2020-03-16 17:42:30 +01:00
Florian Diebold
d6195fa21f Fix completion of HashMap::new
The `ty` function in code_model returned the type with placeholders for type
parameters. That's nice for printing, but not good for completion, because
placeholders won't unify with anything else: So the type we got for `HashMap`
was `HashMap<K, V, T>`, which doesn't unify with `HashMap<?, ?, RandomState>`,
so the `new` method wasn't shown.

Now we instead return `HashMap<{unknown}, {unknown}, {unknown}>`, which does
unify with the impl type. Maybe we should just expose this properly as variables
though, i.e. we'd return something like `exists<type, type, type> HashMap<?0,
?1, ?2>` (in Chalk notation). It'll make the API more complicated, but harder to
misuse. (And it would handle cases like `type TypeAlias<T> = HashMap<T, T>` more
correctly.)
2020-03-13 13:04:32 +01:00
Aleksey Kladov
680182d0a0 Restore cargo-fmt gating 2020-03-13 12:54:32 +01:00
Josh Mcguigan
7208498d54 fix issue 3444 2020-03-12 17:16:28 -07:00
Aleksey Kladov
100cbc57ce Simplify 2020-03-09 11:19:03 +01:00
Aleksey Kladov
0320ebdd10 Use Index for CrateGraph 2020-03-09 11:11:59 +01:00
bors[bot]
57c27f9139
Merge #3519
3519: Show mod path on hover r=matklad a=SomeoneToIgnore

Closes #1064

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-09 09:33:46 +00:00
Kirill Bulatov
e1aa96f2c5 Less abstract CrateData api 2020-03-09 11:26:46 +02:00
bors[bot]
beb4f49541
Merge #3513
3513: Completion in macros r=matklad a=flodiebold

I experimented a bit with completion in macros. It's kind of working, but there are a lot of rough edges.

 - I'm trying to expand the macro call with the inserted fake token. This requires some hacky additions on the HIR level to be able to do "hypothetical" expansions. There should probably be a nicer API for this, if we want to do it this way. I'm not sure whether it's worth it, because we still can't do a lot if the original macro call didn't expand in nearly the same way. E.g. if we have something like `println!("", x<|>)` the expansions will look the same and everything is fine; but in that case we could maybe have achieved the same result in a simpler way. If we have something like `m!(<|>)` where `m!()` doesn't even expand or expands to something very different, we don't really know what to do anyway.
 - Relatedly, there are a lot of cases where this doesn't work because either the original call or the hypothetical call doesn't expand. E.g. if we have `m!(x.<|>)` the original token tree doesn't parse as an expression; if we have `m!(match x { <|> })` the hypothetical token tree doesn't parse. It would be nice if we could have better error recovery in these cases.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-03-09 08:56:58 +00:00
Florian Diebold
05e1c7b197 Handle visibility for assoc item path completion as well 2020-03-08 15:15:46 +01:00
Florian Diebold
afdf08e964 Move hypothetical expansion to hir_expand 2020-03-08 11:10:48 +01:00
Florian Diebold
d9c77c5453 Handle visibility for path completion (not in all cases yet) 2020-03-08 10:51:40 +01:00
Florian Diebold
734e68da4c Handle visibility in method call completion 2020-03-07 23:03:56 +01:00
Kirill Bulatov
32f5276465 Show mod path in hover tooltip 2020-03-07 23:20:18 +02:00
Florian Diebold
24e98121d8 Try to complete within macros 2020-03-07 15:48:06 +01:00
Aleksey Kladov
9abf0d9659 Normalize waiting queries names 2020-03-07 00:18:04 +01:00
Florian Diebold
9ce30281f6 Don't reuse the Chalk solver
This slows down analysis-stats a bit (~5% in my measurement), but improves
incremental checking a lot because we can reuse trait solve results.
2020-03-06 23:04:14 +01:00
Aleksey Kladov
fb5891c433 Source map returns a result
cc #2236
2020-03-06 14:44:44 +01:00
Aleksey Kladov
7d873fcfa1 Move PathResolution 2020-03-05 11:08:31 +01:00
Aleksey Kladov
7b6716e50e Remove dead code 2020-03-05 11:06:23 +01:00
Aleksey Kladov
c21babc58b Minor cleanup 2020-03-04 14:39:51 +01:00
Aleksey Kladov
f57682c0b3 Remove old find refs infra 2020-03-04 14:25:22 +01:00
Aleksey Kladov
7d71cc72b5 Refactor reference search a bit 2020-03-03 18:22:52 +01:00
Aleksey Kladov
2716a1fa3f More principled approach for gotodef for field shorhand
Callers can now decide for themselves if they should prefer field or
local definition. By default, it's the local.
2020-03-02 19:00:38 +01:00
Aleksey Kladov
a1e1869554 Rename ast::ImplBlock -> ast::ImplDef 2020-02-29 21:33:15 +01:00
Aleksey Kladov
7f09083c6f Handle tuple fields as well 2020-02-29 18:35:45 +01:00
Aleksey Kladov
14ea21617a Minor 2020-02-29 18:34:34 +01:00
Aleksey Kladov
28332d9b63 Simplify SourceBinder 2020-02-29 18:32:18 +01:00
Aleksey Kladov
a6a623dfbb Small cleanup 2020-02-29 16:57:56 +01:00
Aleksey Kladov
e7c82eab21 Reduce visibility 2020-02-28 17:28:29 +01:00
bors[bot]
c692e07b4f
Merge #3367
3367: Fix highlighting of const patterns r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-28 15:56:07 +00:00
Aleksey Kladov
5ebfcb9cb7 Fix highlighting of const patterns 2020-02-28 16:38:36 +01:00
Edwin Cheng
7a5ff0f37c Simpilfy origin_range logic 2020-02-28 22:53:59 +08:00
Edwin Cheng
61fd6c6270 Use text_range::extend_to 2020-02-27 10:06:48 +08:00
Edwin Cheng
553254973e Skip trival token in original_range 2020-02-27 00:12:26 +08:00
Edwin Cheng
871dc2bd3c Remove duplicate comment 2020-02-26 20:55:11 +08:00
Edwin Cheng
ffdc740446 Add recursive support in original_range 2020-02-26 20:53:00 +08:00
Aleksey Kladov
ade0176c20 Remove dead code 2020-02-26 13:26:53 +01:00
Aleksey Kladov
09bc7ca74d Reduce visibility 2020-02-26 13:22:46 +01:00
Aleksey Kladov
c3a4c4429d Refactor primary IDE API
This introduces the new type -- Semantics.
Semantics maps SyntaxNodes to various semantic info, such as type,
name resolution or macro expansions.

To do so, Semantics maintains a HashMap which maps every node it saw
to the file from which the node originated. This is enough to get all
the necessary hir bits just from syntax.
2020-02-26 12:55:50 +01:00
Aleksey Kladov
86b66067f6 Don't store deriveable Module info in NameDefinition 2020-02-19 14:32:22 +01:00