Commit graph

3968 commits

Author SHA1 Message Date
Aleksey Kladov
111891dc2d Move constants to new ID
This allows us to get rid of trait item index
2019-11-20 18:41:23 +03:00
Aleksey Kladov
ee95a35664 Don't duplicate ContainerId type 2019-11-20 17:50:02 +03:00
Aleksey Kladov
64c21ed195 Switch type aliases to new sources 2019-11-20 17:43:03 +03:00
bors[bot]
b7a36b5443
Merge #2326
2326: Remove duplicate tests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 13:43:34 +00:00
Aleksey Kladov
3888487ca8 Remove duplicate tests 2019-11-20 16:40:25 +03:00
Edwin Cheng
0a9c80053f Fix expand macro 2019-11-20 21:33:01 +08:00
Aleksey Kladov
cebeedc66f Next gen IDs for functions
The current system with AstIds has two primaraly drawbacks:

* It is possible to manufacture IDs out of thin air.
  For example, it's possible to create IDs for items which are not
  considered in CrateDefMap due to cfg. Or it is possible to mixup
  structs and unions, because they share ID space.

* Getting the ID of a parent requires a secondary index.

Instead, the plan is to pursue the more traditional approach, where
each items stores the id of the parent declaration. This makes
`FromSource` more awkward, but also more correct: now, to get from an
AST to HIR, we first do this recursively for the parent item, and the
just search the children of the parent for the matching def
2019-11-20 16:22:58 +03:00
Aleksey Kladov
06fa3d8389 Move traits to hir_def 2019-11-20 14:22:38 +03:00
Aleksey Kladov
51baaf298d Rename with_ast -> with_value 2019-11-20 13:09:21 +03:00
Aleksey Kladov
e1a6e38767 Move Generics to hir_def 2019-11-20 12:34:48 +03:00
Aleksey Kladov
0e771915fa Allow non-path default type parameters 2019-11-20 11:46:44 +03:00
Aleksey Kladov
36e3fc9d54 Rename Source::ast -> Source::value 2019-11-20 09:42:30 +03:00
Aleksey Kladov
eec68e6f45
Merge pull request #2297 from kiljacken/master
Add fancy truncation of type hints.
2019-11-20 08:38:25 +03:00
Aleksey Kladov
83a8430e0a ⬆️ rowan 2019-11-19 21:13:36 +03:00
Edwin Cheng
e290171397 Add shot doc for expand_macro module 2019-11-20 01:12:56 +08:00
Emil Lauridsen
bf5ac4fe39 Add test for inlay hint truncation 2019-11-19 17:40:38 +01:00
Emil Lauridsen
dadad36bb9 Move type inlay hint truncation to language server
This commit implements a general truncation framework for HirFormatter
that keeps track of how much has been output so far. This information
can then be used to perform truncation inside the language server,
instead of relying on the client.

Initial support is implemented for truncating types hints using the
maxInlayHintLength server config option. The existing solution in the
VSCode extension has been removed in favor of letting the server
truncate type hints.
2019-11-19 17:23:50 +01:00
Edwin Cheng
80fe467ce8 Improve insert_whitespaces 2019-11-20 00:12:48 +08:00
Edwin Cheng
4012da07fd Change return type of expand_macro 2019-11-19 22:56:48 +08:00
Edwin Cheng
94c63d2802 Change to use Expansion::file_id and reordering 2019-11-19 22:56:28 +08:00
Edwin Cheng
ae49a22b5c Rebase 2019-11-19 21:49:06 +08:00
Edwin Cheng
3ccd05fedc Add recursive expand in vscode 2019-11-19 21:49:06 +08:00
Edwin Cheng
f24bba74d0 Fixed a bug for string lit in quote 2019-11-19 12:15:20 +08:00
bors[bot]
c24ee09904
Merge #2309
2309: Goto type def through macros r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-18 20:04:36 +00:00
kjeremy
e939f740b3 Goto type def through macros 2019-11-18 14:57:42 -05:00
bors[bot]
c8fb5b491a
Merge #2307
2307: Support hover through macro r=matklad a=kjeremy

Allows hover to work through macros like `match_ast!`.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-18 19:57:06 +00:00
kjeremy
90f6f6080e Fix test 2019-11-18 14:20:14 -05:00
DJMcNab
27ce1e822b Remove the custom impl of AttrsOwner for ImplItem
The default impl should have the same behaviour, and it can be generated
by codegen.
See also `ModuleItem` and `NominalDef`
2019-11-18 18:13:56 +00:00
kjeremy
b2cc593381 Support hover through macro 2019-11-18 11:58:42 -05:00
kjeremy
a22cb1daa7 Use Source<&ast::Name> in classify_name 2019-11-18 10:47:19 -05:00
Aleksey Kladov
2b6f1ab0e2 Collapse TokenMap and RevTokenMap 2019-11-18 16:08:41 +03:00
Aleksey Kladov
b79d678923 Token-based reverse-mapping 2019-11-18 15:08:39 +03:00
Aleksey Kladov
5e8c22dbf3 More sources 2019-11-18 14:36:11 +03:00
Aleksey Kladov
9fcd98e956 Add ra_ide_api::expand
This module should handle all tricky bits with mapping macro-expanded
HirFileId to original files the user actually can see in the editor
2019-11-18 14:23:24 +03:00
Aleksey Kladov
6d8ca870b3 More Source 2019-11-18 14:07:13 +03:00
Aleksey Kladov
9df3d2e775 Publicise GenericParams
See https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Exposing.20GenericParam.2Ename
2019-11-18 10:35:33 +03:00
Aleksey Kladov
fd52d721e1 More correct expansion mapping
We can't really map arbitrary ranges, we only can map tokens
2019-11-17 20:15:55 +03:00
Aleksey Kladov
c8f858d043 Make shift an implementation detail of mbe 2019-11-17 19:11:43 +03:00
bors[bot]
64dac40a86
Merge #2287
2287: Disable doctests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-17 15:45:30 +00:00
Aleksey Kladov
7e2f4b30db Disable doctests 2019-11-17 18:35:05 +03:00
Aleksey Kladov
6a70bff451 Don't store shift redundantly 2019-11-17 18:22:34 +03:00
Edwin Cheng
977cf381ce Add bound check 2019-11-17 13:18:42 +08:00
Aleksey Kladov
5b54a93fe7 Add ast for plain and raw string literals 2019-11-16 22:50:41 +03:00
Aleksey Kladov
42604c673d Better factoring of macro expansion machinery in goto def 2019-11-16 22:18:07 +03:00
Aleksey Kladov
2eaa8c94a8 Goto definition works inside macros 2019-11-16 17:00:54 +03:00
bors[bot]
786cae520a
Merge #2276
2276: Source-ify name_definition r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-16 13:50:34 +00:00
Florian Diebold
ee190388ab Upgrade Chalk again 2019-11-16 13:25:54 +01:00
Florian Diebold
351c29d859 Fix handling of the binders in dyn/impl Trait
We need to be more careful now when substituting bound variables (previously, we
didn't have anything that used bound variables except Chalk, so it was not a
problem).

This is obviously quite ad-hoc; Chalk has more infrastructure for handling this
in a principled way, which we maybe should adopt.
2019-11-16 13:25:54 +01:00
Florian Diebold
9c2a9a9a06 Use Chalk's dyn/impl trait support 2019-11-16 13:11:29 +01:00
Florian Diebold
e21b82e035 Upgrade Chalk
Associated type values (in impls) are now a separate entity in Chalk, so we have
to intern separate IDs for them.
2019-11-16 13:11:29 +01:00