Commit Graph

4366 Commits

Author SHA1 Message Date
Omer Ben-Amram
5e4e713fc9 Merge branch 'refs/heads/master' into feature/granular-scopes 2019-12-14 17:29:30 +02:00
bors[bot]
77db617765
Merge #2554
2554: Add macros for known names and paths r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-14 14:08:08 +00:00
bors[bot]
7238037de4
Merge #2548
2548: Support setting cargo features and resolve `default` features by default r=matklad a=oxalica

Fixes #2524 


Co-authored-by: oxalica <oxalicc@pm.me>
2019-12-14 11:57:49 +00:00
Omer Ben-Amram
083010f633 removed type.alias 2019-12-14 13:29:42 +02:00
Omer Ben-Amram
67641d3f5f added decorations 2019-12-14 13:24:07 +02:00
kjeremy
03fe6b38b8 Remove some unwraps in add_new 2019-12-13 18:28:01 -05:00
Florian Diebold
f02fcc1644 Use path macro 2019-12-13 22:33:38 +01:00
Florian Diebold
6911bc89a7 Rename N! to name! 2019-12-13 22:33:38 +01:00
Florian Diebold
259c42f00e Add macros for known names and paths 2019-12-13 22:33:37 +01:00
kjeremy
a234b5a3ca LSP 3.15 supports the deprecated tag on completions 2019-12-13 16:08:47 -05:00
succcubbus
c82529a97f for goto and hover pick the token based on a priority 2019-12-13 22:00:05 +01:00
succcubbus
4f7da04c67 add tests for goto on tuple fields 2019-12-13 21:59:25 +01:00
succcubbus
6c133017a8 try both surrounding tokens for hover 2019-12-13 21:10:25 +01:00
bors[bot]
9c9f4635b4
Merge #2550
2550: Infer - and ! using std::ops::{Neg, Not} r=flodiebold a=kiljacken

Found some low hanging fruit while taking a cursory look at index inferring.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-13 19:49:01 +00:00
succcubbus
6c42eb1930 add failing test 2019-12-13 19:54:07 +01:00
succcubbus
f54fef85aa use find() instead of filter().next() 2019-12-13 19:54:02 +01:00
succcubbus
4df741ecb2 fix goto definition when inbetween tokens
fixes both goto_definition and goto_type_definition.
before, when running goto between some non-trivia token and an
identifier, goto would be attempted for the non-trivia token.
but this does not make sense for e.g. L_PAREN or COLONCOLON only for
IDENTs. now only IDENTs will be searched for in goto actions.
2019-12-13 19:20:02 +01:00
Omer Ben-Amram
30672c420e scopes resolution is more granular 2019-12-13 19:03:48 +02:00
Edwin Cheng
98f98cbb54 Refactor tt::Delimiter 2019-12-13 21:53:34 +08:00
Emil Lauridsen
7705209051 Correctly infer - and ! using std::ops::{Neg,Not} 2019-12-13 12:45:38 +01:00
Emil Lauridsen
95dc2de8e9 Add helper for resolving associated type of trait in infer 2019-12-13 12:45:37 +01:00
bors[bot]
16cf6bcf4b
Merge #2544
2544: Map first and last tokens in original_range r=matklad a=edwin0cheng

This PR try to fix the first part of the `original_range` : Try to map the first token and last token of a `SyntaxNode` , If success, return the union range of mapped tokens. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-13 10:21:19 +00:00
oxalica
af4eb26645
Support setting cargo features 2019-12-13 18:16:34 +08:00
Edwin Cheng
47f2b5d0d9 Map first and last node in original_range 2019-12-13 02:39:14 +08:00
Aleksey Kladov
332f2205b0 Correct obsolete comment 2019-12-12 17:17:57 +01:00
Aleksey Kladov
125559c14b Move use tree lowering to a separate module 2019-12-12 17:15:57 +01:00
bors[bot]
254c8efc5b
Merge #2540
2540: Dedupe from_source impls r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 14:51:02 +00:00
Aleksey Kladov
8e65b77387 Dedupe from_source impls 2019-12-12 15:50:16 +01:00
bors[bot]
c213c3b36b
Merge #2539
2539: Remove old location infra r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 14:20:02 +00:00
Aleksey Kladov
7a255a2f93 Remove old location infra 2019-12-12 15:19:07 +01:00
Aleksey Kladov
56710f119b Move enum&union to new loc 2019-12-12 15:11:57 +01:00
Aleksey Kladov
f135a8ea55 Move structs to new loc 2019-12-12 14:58:04 +01:00
Aleksey Kladov
63c192b34a Simplify from_source 2019-12-12 14:48:33 +01:00
Aleksey Kladov
82e9b24558 Move traits to the new loc 2019-12-12 14:36:14 +01:00
bors[bot]
d8dba7fbe5
Merge #2537
2537: Switch to the new location for impls r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 13:25:59 +00:00
Aleksey Kladov
7b0644d81e Switch to the new location for impls 2019-12-12 14:25:34 +01:00
bors[bot]
b2638fcd2c
Merge #2536
2536: Avoid recompiling serde r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 13:12:02 +00:00
Aleksey Kladov
b0739d5a26 Avoid recompiling serde 2019-12-12 14:11:06 +01:00
Jeremy Kolb
b4c8e5b9e9 Do not trigger signature help on close 2019-12-12 07:55:05 -05:00
Aleksey Kladov
6c6e6978eb Update lsp-types more 2019-12-11 18:34:36 +01:00
Aleksey Kladov
b0a4765059 Revert "Revert "Support LSP 3.15""
This reverts commit 1e0bf205ef.
2019-12-11 18:34:01 +01:00
Aleksey Kladov
1e0bf205ef Revert "Support LSP 3.15"
This reverts commit 712700d8e0.
2019-12-11 18:27:34 +01:00
Jeremy Kolb
fcccf8ec59 Support LSP 3.15
This merely upgrades our protocol support. It does not add any of the new features.
2019-12-11 09:11:55 -05:00
Gabriel Luo
20ccabc01d Fixed #2250
Tuple in type annotation expands correctly;
Expansion will prefer the following delimiter when possible. 
New regression tests added to verify the consistency between tuple expansion in type annotation and tuple expansion in rvalue.
2019-12-10 22:18:05 -05:00
Aleksey Kladov
d89996fd5b Build correct SourceAnalyzer for traits 2019-12-10 13:52:04 +01:00
Laurențiu Nicola
16df4d8fcb chore: bump deps and use mainline chalk 2019-12-09 22:35:47 +02:00
Aleksey Kladov
b683cbd93d Report correct original range in goto_definition 2019-12-09 19:46:35 +01:00
Aleksey Kladov
5a012fb9fd Implement ra_lsp_server --version 2019-12-09 16:11:46 +01:00
bors[bot]
6b1c2ee168
Merge #2500 #2505 #2506
2500: Fix format_args expansion & go to definition r=matklad a=flodiebold

The expansion of format_args wasn't yet correct enough to type-check. Also make macros in statement position expand to expressions for now, since it's not handled correctly in HIR lowering yet. This finally fixes go to definition within print macros, I think 🙂 

2505: Remove more dead code r=matklad a=matklad



2506: Remove one more Ty r=matklad a=matklad



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 16:53:21 +00:00
Aleksey Kladov
61c3887b70 Remove one more Ty 2019-12-08 17:50:43 +01:00
Aleksey Kladov
a1639d0d1e Remove more dead code 2019-12-08 17:45:14 +01:00
Aleksey Kladov
6805bb01e2 Cleanup module structure 2019-12-08 17:45:14 +01:00
bors[bot]
d0ad30ad97
Merge #2501 #2502 #2503
2501: Fix coercion from &Foo to an inference variable in a reference r=matklad a=flodiebold

We didn't try to unify within the reference, but we should.

2502: Delay legacy macro expansion r=matklad a=edwin0cheng

This PR make the following changes:

* Delay legacy macro expansion such that we concentrated all item collecting macro expansion in one place.
* Add `MacroDirective` to replace 3-tuples 
* After this refactoring, no macro is expanded recursively, hence we can remove the `MacroStackMonitor` and we handle the expansion limit by the fix-point loop count. 

2503: Code: check whether the LSP binary is in PATH r=matklad a=lnicola

I'm not really sure about the TS changes. I just made a couple of functions async and it seems to work.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-12-08 16:44:29 +00:00
Edwin Cheng
3a95d01d0c Delay legacy macro expansion 2019-12-08 20:33:42 +08:00
Florian Diebold
d0c9bb0abf Fix coercion from &Foo to an inference variable in a reference
We didn't try to unify within the reference, but we should.
2019-12-08 13:06:59 +01:00
Florian Diebold
5e096def15 Expand macros in blocks to expressions for now
Expanding to statements isn't handled properly yet and breaks things.
2019-12-08 13:03:13 +01:00
Florian Diebold
2223620313 Fix range in goto_through_format test 2019-12-08 13:02:52 +01:00
Florian Diebold
91f28e43a2 Fix expansion of format_args 2019-12-08 13:02:52 +01:00
bors[bot]
596e6db46c
Merge #2499
2499: Remove ty from code_model r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 11:52:43 +00:00
Aleksey Kladov
e2cc552076 Remove dead code 2019-12-08 12:51:25 +01:00
Aleksey Kladov
b37c6a746b Remove ty from code_model 2019-12-08 12:44:14 +01:00
Aleksey Kladov
b77d7c24aa Remove bodies from code_model 2019-12-08 12:27:21 +01:00
Aleksey Kladov
b017bae837 remove infer method from CodeModel 2019-12-08 12:26:53 +01:00
bors[bot]
7a6b6ed0a5
Merge #2498
2498: Drop some unused methods r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 11:24:44 +00:00
Aleksey Kladov
7aacf9a197 Drop some unused methods 2019-12-08 12:24:21 +01:00
Aleksey Kladov
200bda3daf Cleanup Field ty 2019-12-08 12:16:57 +01:00
Aleksey Kladov
08d3166c8b Cleanup Crate API 2019-12-08 12:02:53 +01:00
bors[bot]
b236f6aa49
Merge #2466
2466: Handle partial resolve cases r=matklad a=edwin0cheng

Another try to fix #2443 :

We resolve all imports every time in `DefCollector::collect` loop even it is resolved previously.  
This is because other unresolved imports and macros will bring in another `PerNs`, so we can only assume that it has been partially resolved.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-08 10:44:30 +00:00
Edwin Cheng
509fedd9d2 Remove MacroFileKind 2019-12-08 16:16:52 +08:00
Aleksey Kladov
6e2e60cbc9 Discover type parameters in more cases 2019-12-07 21:55:02 +01:00
Aleksey Kladov
88c5b1282a Rename GenericParam -> TypeParam
We don't have LifetimeParam yet, but they are planned!
2019-12-07 20:25:48 +01:00
Aleksey Kladov
f4f8b81474 Get the right analyzer for impls 2019-12-07 20:05:08 +01:00
Aleksey Kladov
7d2080a031 Classify name works for TypeParams 2019-12-07 19:52:09 +01:00
Aleksey Kladov
d1a01aa2f8 Gotodef for TypeParameters 2019-12-07 19:44:43 +01:00
Aleksey Kladov
1692f07393 ToNav for GenericParam 2019-12-07 19:44:43 +01:00
Aleksey Kladov
dda9587e75 Track source of type parameters 2019-12-07 19:44:43 +01:00
Aleksey Kladov
d75f768c13 Minor 2019-12-07 19:44:43 +01:00
Aleksey Kladov
decc4cb084 Show type hints for & patterns 2019-12-07 19:15:52 +01:00
Aleksey Kladov
6bd9fb8525
Merge pull request #2491 from matklad/skip-heavy-tests-by-default
Skip slow tests by default
2019-12-07 13:46:02 +01:00
Aleksey Kladov
8ec5f2fcdc Skip slow tests by default 2019-12-07 13:19:42 +01:00
Aleksey Kladov
29b5e1ec2a Reformat 2019-12-07 13:19:21 +01:00
Aleksey Kladov
d6c2b92409 Refactor parameter count tracking 2019-12-07 13:13:00 +01:00
Aleksey Kladov
8e9837df21 Remove idx and parent generics from generics
This makes `hir_def::GenericParams` flatter. The logic for
re-numbering the params is moved to hir instead.
2019-12-07 13:05:56 +01:00
Aleksey Kladov
30fefcc08c Store GenericParams in arena 2019-12-07 13:05:56 +01:00
Edwin Cheng
51f4fb448f Refactor resolve_imports logic 2019-12-07 19:24:15 +08:00
Florian Diebold
de08d30b80 Get rid of unwraps in add_new
Probably fixes #2464.
2019-12-07 11:54:26 +01:00
Edwin Cheng
e5997e1746 Push glob_imports only if non-exists 2019-12-07 09:50:21 +08:00
bors[bot]
431836f4a0
Merge #2489
2489: Implement `format_args` r=flodiebold a=flodiebold

This fixes a huge amount of type mismatches (because every format call was a type mismatch so far); I also hoped to get go to def working within `format!` etc., and the test says it should, but in practice it still doesn't seem to...

Also remove the `len` parameter from `Name::new_inline_ascii`, which I'm assuming was only there because of `const fn` limitations?

cc @edwin0cheng 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-06 20:59:51 +00:00
Florian Diebold
b2c01f446e Implement ancestors_with_macros in a better way 2019-12-06 21:53:31 +01:00
bors[bot]
f18b7e18c4
Merge #2484
2484: DynMap r=matklad a=matklad

Implement a `DynMap` a semi-dynamic, semi-static map, which helps to thread heterogeneously typed info in a uniform way. Totally inspired by df3bee3038/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java. 

@flodiebold wdyt? Seems like a potentially useful pattern for various source-map-like things.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-06 20:28:28 +00:00
Aleksey Kladov
8c86963d47 DynMap
This might, or might not help us to reduce boilerplate associated with
plumbing values from analysis to the IDE layer
2019-12-06 21:28:05 +01:00
Florian Diebold
c80dc0ad3a Make the goto_through_format test actually fail :( 2019-12-06 21:25:22 +01:00
Florian Diebold
4a99ef5c39 Builtin macros only use caller tokens 2019-12-06 21:25:22 +01:00
Florian Diebold
a565072dde Try to make go to definition work in format!
SourceAnalyzer didn't work properly within expression macro expansions because
it didn't find the enclosing function. Fix this by going up the expansion chain
to find ancestors. This makes the test work, but apparently in real usage it's
still not working.
2019-12-06 21:25:22 +01:00
Florian Diebold
eae425b10f Implement format_args more properly 2019-12-06 21:25:22 +01:00
Florian Diebold
3a5aa03e66 Remove unnecessary len parameter for Name::new_inline_ascii
I assume it was previously required because `len` was not const, but that
doesn't seem to be a problem anymore.
2019-12-06 21:25:22 +01:00
Florian Diebold
c5ffb0dc81 Add stub implementation of format_args{_nl} macros
Just enough to fix the huge amount of type mismatches they cause.
2019-12-06 21:25:22 +01:00
bors[bot]
d3702c02cd
Merge #2481
2481: Remove obsolete comment r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-06 20:03:44 +00:00
Edwin Cheng
76ff5b7c15 Add tests 2019-12-06 23:48:45 +08:00
Florian Diebold
f86fe3d891 Don't unify within a reference
If we are expecting a `&Foo` and get a `&something`, when checking the
`something`, we are *expecting* a `Foo`, but we shouldn't try to unify whatever
we get with that expectation, because it could actually be a `&Foo`, and `&&Foo`
coerces to `&Foo`. So this fixes quite a few false type mismatches.
2019-12-06 15:15:26 +01:00