Commit Graph

3946 Commits

Author SHA1 Message Date
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
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
Aleksey Kladov
3b7cf9226d Source-ify name_definition 2019-11-16 13:50:04 +03:00
Aleksey Kladov
272af56a5c Sourcify classify_name_ref 2019-11-16 13:33:25 +03:00
bors[bot]
d9d99369b2
Merge #2271
2271: Force passing Source when creating a SourceAnalyzer r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 23:12:59 +00:00
Aleksey Kladov
d898ecb8f2 Force passing Source when creating a SourceAnalyzer 2019-11-16 02:12:35 +03:00
bors[bot]
69f3b01dc5
Merge #2268
2268: Handle ast::MacroCall in classify_name and impl FromSource for MacroDef r=matklad a=kjeremy

Fixes #2260

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-15 22:36:10 +00:00
Aleksey Kladov
1c819fc8f6 Prepare SourceAnalyzer for macros 2019-11-16 01:31:40 +03:00
Aleksey Kladov
f36ac059f3 Reduce some duplication 2019-11-16 01:14:56 +03:00
kjeremy
06984ed116 Add a test that uses classify_name 2019-11-15 17:13:52 -05:00
Aleksey Kladov
892671926b Remove wrong clone 2019-11-16 01:00:00 +03:00
kjeremy
60fd260e7f Handle ast::MacroCall in classify_name and impl FromSource for MacroDef
Fixes #2260
2019-11-15 16:47:58 -05:00
Aleksey Kladov
0404e647e6 Prepare SourceAnalyzer for macros 2019-11-16 00:40:54 +03:00
Aleksey Kladov
bd8af6a413 Sourcify some more 2019-11-16 00:05:10 +03:00
bors[bot]
920848940a
Merge #2266
2266: Sourcify some things r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 20:25:53 +00:00
Aleksey Kladov
4c90b7e2ec Sourcify some things
If we want to support macros properly, we need to get rid of those
FileIds everywhere...
2019-11-15 23:24:56 +03:00
bors[bot]
86469d4195
Merge #2252
2252: Fix parsing of "postfix" range expressions. r=matklad a=goffrie

Right now they are handled in `postfix_dot_expr`, but that doesn't allow it to
correctly handle precedence. Integrate it more tightly with the Pratt parser
instead.

Also includes a drive-by fix for parsing `match .. {}`.

Fixes #2242.

Co-authored-by: Geoffry Song <goffrie@gmail.com>
2019-11-15 20:15:29 +00:00
Geoffry Song
5645c153e0 Attempt to implement typed accessors 2019-11-15 12:05:29 -08:00
Aleksey Kladov
20186cdf89 Fix add-new assist 2019-11-15 22:57:19 +03:00
Aleksey Kladov
b21829f7ed Remove old impls infrastructure 2019-11-15 21:35:03 +03:00
Aleksey Kladov
ea3540c1a8 Store impls in CrateDefMap 2019-11-15 21:19:32 +03:00
Aleksey Kladov
080dd31f84 Add ImplId 2019-11-15 21:19:32 +03:00
Aleksey Kladov
aeb5e061a8 Reduce visibility 2019-11-15 21:19:32 +03:00
memoryruins
a5f57f98ca Heed the advice of rustc's into_iter() warning 2019-11-15 07:18:10 -05:00