Commit Graph

9784 Commits

Author SHA1 Message Date
Dániel Buga
789efede82 Add failing test case 2021-01-26 14:48:03 +01:00
Aleksey Kladov
2870e70163 Add config option to ignore directories 2021-01-26 16:45:54 +03:00
Aleksey Kladov
a733f65126 Allow non-absolute paths to rust source 2021-01-26 16:40:08 +03:00
bors[bot]
e0f2e1560f
Merge #7450
7450: Remove the need to manually sync config in package.json r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-26 13:24:04 +00:00
Aleksey Kladov
c04b561e7e Remove the need to manually sync config in package.json 2021-01-26 16:22:24 +03:00
bors[bot]
d0d2786d2d
Merge #7433
7433: Support Macro v2 in mbe r=jonas-schievink a=edwin0cheng

Added `mbe::MacroDef` for Macro v2.

cc @jonas-schievink 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-26 13:08:35 +00:00
bors[bot]
19dc5195d0
Merge #7393
7393: Document `paths` items r=matklad a=arnaudgolfouse



Co-authored-by: Arnaud <arnaud.golfouse@laposte.net>
2021-01-26 12:29:47 +00:00
bors[bot]
3a5cd6bbc6
Merge #7406
7406: if_let_match: don't assume happy path r=matklad a=bugadani

Closes #7392

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2021-01-26 12:12:45 +00:00
Lukas Wirth
d912444cac Shorten hir::TypeParam full_range in NavigationTarget 2021-01-26 01:01:00 +01:00
Edwin Cheng
ce4eeec1bf Support Macro v2 in mbe 2021-01-26 05:15:47 +08:00
Jonas Schievink
08253d5473 Traverse parent DefMap for super paths 2021-01-25 19:15:39 +01:00
Jonas Schievink
98a88ebb9e Intern block locations and handle them in ModuleId 2021-01-25 19:02:05 +01:00
vsrs
185cd736a6 Add RA_WAIT_DBG and docs 2021-01-25 17:46:03 +03:00
vsrs
8c843d1dac Add the ability to wait for a debugger. 2021-01-25 17:46:03 +03:00
vsrs
98d7512e93 Add stderr flush 2021-01-25 17:46:03 +03:00
vsrs
43fabfbe36 Add --no-buffering flag for the file logging. 2021-01-25 17:46:03 +03:00
bors[bot]
2c735ed734
Merge #7426
7426: Create all `ModuleId`s through a `DefMap` method r=jonas-schievink a=jonas-schievink

`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-25 14:22:24 +00:00
Jonas Schievink
5c241b0766 Create all ModuleIds through a DefMap method
`ModuleId` needs to be able to represent blocks, and only the
associated `DefMap` will know how to construct that `ModuleId`
2021-01-25 15:21:33 +01:00
Laurențiu Nicola
5ed5a542fb Derive Default on ItemTree 2021-01-25 14:12:53 +02:00
bors[bot]
a6a5b02f4c
Merge #7422
7422: Disallow non-boolean literals in concat! r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-25 11:35:37 +00:00
Laurențiu Nicola
4e92681aba Disallow non-boolean literals in concat! 2021-01-25 13:31:03 +02:00
bors[bot]
83231dd987
Merge #7409 #7421
7409: Add References CodeLens. r=matklad a=vsrs

Closes #5836

7421: Fix RA_LOG example in dev docs r=lnicola a=lnicola

bors r+

Co-authored-by: vsrs <vit@conrlab.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-25 11:18:58 +00:00
Laurențiu Nicola
ee8c678870 Unquote strings and handle boolean literals in concat! 2021-01-25 13:02:57 +02:00
Aleksey Kladov
1df711b95c ⬆️ rowan 2021-01-25 12:32:35 +03:00
bors[bot]
3ab8d7a9ae
Merge #7414
7414: Add validation for mutable const items r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-24 01:18:58 +00:00
Lukas Wirth
70d43c3faf Add validation for mutable const items 2021-01-24 02:17:41 +01:00
Lukas Wirth
a872ebf81f Support unions in symbol search 2021-01-24 01:32:52 +01:00
vsrs
3618c4e0d3 Add References code lens.
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
Phil Ellison
db6dda94a3 Remove use of SourceFileEdit 2021-01-23 07:54:45 +00:00
Phil Ellison
65a5ea581d Update tests to register the required standard library types 2021-01-23 07:40:25 +00:00
Phil Ellison
7c691f51f9 Fix test names 2021-01-23 07:40:25 +00:00
Phil Ellison
8c7ccdc29d Identify methods using functions ids rather than string names 2021-01-23 07:40:25 +00:00
Phil Ellison
920e57bd15 cargo fmt 2021-01-23 07:40:25 +00:00
Phil Ellison
e62e4ed148 Address review comments 2021-01-23 07:40:25 +00:00
Phil Ellison
449ced4d21 cargo fmt 2021-01-23 07:40:25 +00:00
Phil Ellison
1ff860b93c Implement fix, add tests 2021-01-23 07:40:25 +00:00
Phil Ellison
1316422a7c Add diagnostic for filter_map followed by next 2021-01-23 07:40:24 +00:00
bors[bot]
eab5db20ed
Merge #7391
7391: Fix error when using "extern crate self as" r=kazatsuyu a=kazatsuyu

Fix #6957

Co-authored-by: kazatsuyu <shirayama.kazatsuyu@gmail.com>
2021-01-23 04:04:09 +00:00
Dániel Buga
5728d7186e Deduplicate variant matching 2021-01-22 23:39:43 +01:00
Dániel Buga
24f0cd8293 replace_if_let_with_match: don't assume sad pattern 2021-01-22 23:29:51 +01:00
bors[bot]
f301da3c3d
Merge #7399
7399: Make `ModuleId`'s `krate` field private and audit uses r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-22 17:11:48 +00:00
Jonas Schievink
3de8f57c51 Make ModuleId's krate field private 2021-01-22 18:09:55 +01:00
Aleksey Kladov
738d9cdfde stave off zombies 2021-01-22 19:50:56 +03:00
Aleksey Kladov
96197e0873 Normalize tests 2021-01-22 19:15:34 +03:00
Aleksey Kladov
a40f78f92a More useful fn detail in completion
Detail should be rendered as shtort one line, just dumping fn header
there is not useful, despite the fact that TS does this.

The fact that this is a function should be indicated by the icon, the
same goes for pub/const/async etc qualitfiers

name is already present in the lable (and arg list should be a part of
that, as in idea)

But the return type is the small genuinerlly useful bit of info we can show here
2021-01-22 19:15:34 +03:00
Aleksey Kladov
02a17cdffc Make assertion failures more annoying for maintainers 2021-01-22 19:13:21 +03:00
bors[bot]
b16add934d
Merge #7310 #7395
7310: Add assist: add lifetime to type r=matklad a=bnjjj

close #7200 

7395: Obtain `ModuleId`'s `DefMap` through a method r=jonas-schievink a=jonas-schievink

Once `ModuleId` can represent modules inside block expressions, this will be required in order to obtain the correct `DefMap`. Otherwise existing code might use a `LocalModuleId` from the wrong `DefMap` and cause a panic.

bors r+

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-22 15:45:50 +00:00
Jonas Schievink
ce29730bc7 Obtain ModuleId's DefMap through a method 2021-01-22 16:33:58 +01:00
bors[bot]
0c37b3a0fc
Merge #7353
7353: Add LifetimeParam and ConstParam to CompletionItemKind r=matklad a=Veykril

Adds `LifetimeParam` and `ConstParam` to `CompletionItemKind` and maps them both to `TypeParam` in the protocol conversion as there are no equivalents, so nothing really changes there.
`ConstParam` could be mapped to `Const` I guess but I'm split on whether that would be better?

Additions were solely inspired by (the single) test output for const params.

Also sorts the variants of `CompletionItemKind` and its to_proto match.



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-22 15:31:47 +00:00
kazatsuyu
90d6740e32 Add mark::check! and mark::hit! 2021-01-23 00:11:37 +09:00
Arnaud
1fc56ea224 Document paths items 2021-01-22 15:38:33 +01:00
kazatsuyu
0fb4544403 cargo fmt 2021-01-22 22:52:04 +09:00
kazatsuyu
e52589e3a7 Fix error when using "extern crate self as" 2021-01-22 22:28:45 +09:00
bors[bot]
c050e972a3
Merge #7386
7386: Handle box with allocator r=flodiebold a=tweksteen

In 1.49.0, the definition of Box was modified to support an optional
Allocator[1]. Adapt the parsing of the `box` keyword to supply the
expected number of parameters to the constructor.

[1] f288cd2e17

Fixes: #6956 


Co-authored-by: Thiébaud Weksteen <tweek@google.com>
2021-01-22 13:14:40 +00:00
Thiébaud Weksteen
be0691b02b Handle box with allocator
In 1.49.0, the definition of Box was modified to support an optional
Allocator[1]. Adapt the parsing of the `box` keyword to supply the
expected number of parameters to the constructor.

[1] f288cd2e17
2021-01-22 13:50:23 +01:00
bors[bot]
1b96c79ab5
Merge #7348
7348: Fix broken link in intra-doc r=edwin0cheng a=sasurau4

Fix #5546 
The intra-doc link doesn't work fine for trait associated method.

Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2021-01-22 12:29:42 +00:00
bors[bot]
3cd994d8a5
Merge #7389
7389: Remove approximate goto def r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-22 12:14:23 +00:00
Aleksey Kladov
f67a2eedf5 Cleanup tests 2021-01-22 15:13:18 +03:00
Aleksey Kladov
2c786f1b98 Remove index based fallback for goto def
We are so precise that the fallback creates more confusion, when you can
goto def on an unresolved reference.
2021-01-22 15:11:29 +03:00
Edwin Cheng
eb2cb6b01f Use AbsPath 2021-01-22 19:51:14 +08:00
bors[bot]
6403b530bb
Merge #7387
7387: Refactor build script specific data r=edwin0cheng a=edwin0cheng

It refactors for separating logic for build script specific data. 

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-22 11:15:22 +00:00
Edwin Cheng
6bdb6786ba Refactor build script data 2021-01-22 19:11:01 +08:00
Daiki Ihara
f5b97e52c9 Fix broken link in intra-doc 2021-01-22 20:06:45 +09:00
Jonas Schievink
8916b0c6cb Remove unused field 2021-01-21 21:12:26 +01:00
Jonas Schievink
4d19607057 Add test for path resolution bug 2021-01-21 20:35:36 +01:00
Jonas Schievink
3f4f253028
Revert "Make use of block_def_map in body lowering" 2021-01-21 19:04:31 +01:00
bors[bot]
e76d8c1d9a
Merge #7378
7378: Include `countme` crate to count important data structures. r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-21 17:46:44 +00:00
Jonas Schievink
cdb0e25aaa Make use of block_def_map in body lowering
Removes the `local_scope` hack from `Expander` in favor of tracking the
`DefMap` in use during body lowering
2021-01-21 18:05:52 +01:00
Aleksey Kladov
e5c5c0a040 Include countme crate to count important data structures. 2021-01-21 19:30:52 +03:00
Jonas Schievink
d157a03e93 Remove unnecessary annotations from tests 2021-01-21 17:19:46 +01:00
Jonas Schievink
4e603b7947 Add test for nameres in nested blocks 2021-01-21 16:42:56 +01:00
bors[bot]
47a70aadce
Merge #7375
7375: Add support for running name resolution in block expressions r=jonas-schievink a=jonas-schievink

This adds a `block_def_map` query that runs the name resolution algorithm on a block expression, and returns a `DefMap` that stores links to the parent `DefMap` (either the containing block or the crate-level `DefMap`). Blocks with no inner items return the parent's `DefMap` as-is, to avoid creating unnecessarily long `DefMap` chains.

Path resolution is updated to recurse into the parent `DefMap` after looking up a path in the original `DefMap`.

I've added a few new tests for this, but outside of those this isn't used yet.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-21 15:28:40 +00:00
Jonas Schievink
ec4a1dc297 Add test that merges inner and outer names 2021-01-21 16:23:50 +01:00
Jonas Schievink
d62c9c6c63 Fix lowering with multiple block expressions 2021-01-21 16:23:22 +01:00
bors[bot]
323138f32e
Merge #7372
7372: Up lexer r=kjeremy a=kjeremy

No real changes here.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-21 14:32:57 +00:00
kjeremy
f006517857 Up lexer 2021-01-21 09:31:06 -05:00
Jonas Schievink
f8f44cfb9b Fall back to parent DefMaps when resolving paths 2021-01-21 15:24:15 +01:00
Jonas Schievink
896dfacfc4 Add name resolution query for block expressions 2021-01-21 15:22:17 +01:00
bors[bot]
cde22aba1c
Merge #7371
7371: Change directory before running rustfmt to respect rustfmt.toml r=matklad a=lnicola

Fixes #6973

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-01-21 14:15:14 +00:00
Laurențiu Nicola
c067ca505a chdir to file before rustfmt 2021-01-21 15:58:17 +02:00
bors[bot]
64a92e2328
Merge #7368
7368: Clarify enabled features and defined features in PackageData r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-21 11:30:38 +00:00
Edwin Cheng
ac3ec18f4b Added defined_features in PackageData 2021-01-21 19:12:19 +08:00
Benjamin Coenen
06f1c8f5a1 Add assist: add lifetime to type #7200
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-01-21 09:53:24 +01:00
Laurențiu Nicola
e42dfd7a40 Bump chalk 2021-01-21 10:29:19 +02:00
Jonas Schievink
82146737ac Treat BlockExpr as a potential module origin 2021-01-20 20:05:48 +01:00
Lukas Wirth
08b822b259 Update completions test output 2021-01-20 18:46:22 +01:00
Lukas Wirth
f2cb7dbcb7 Partially unify SymbolKind and CompletionItemKind 2021-01-20 18:39:46 +01:00
bors[bot]
7d5ed18c42
Merge #7365
7365: chalk 0.49.0 r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 17:35:15 +00:00
kjeremy
1e0b163860 chalk 0.49.0 2021-01-20 12:31:03 -05:00
Jonas Schievink
5f319ca7ee DefMap: hide remaining crate-visible fields 2021-01-20 18:17:48 +01:00
bors[bot]
e62533c3ec
Merge #7359
7359: ItemTree: store a mapping from blocks to inner items r=jonas-schievink a=jonas-schievink

To do name resolution within block expressions, we need to know which inner items are located inside each block expression. This adds such a mapping to `ItemTree`, replacing the previous one, which was seemingly unused other than to access all the inner items.

This also assigns `AstId`s to block expressions, which is needed to store the mapping in salsa.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-01-20 16:09:22 +00:00
Jonas Schievink
0587b99fde Make public DefMap fields private 2021-01-20 15:41:18 +01:00
Lukas Wirth
563a175fdb Move SymbolKind to ide_db 2021-01-20 15:25:34 +01:00
Jonas Schievink
c5ed2284b5 Create a mapping from blocks to inner items 2021-01-20 15:00:28 +01:00
bors[bot]
de5aabd48b
Merge #7350
7350: Update pico-args r=matklad a=kjeremy

Should maintain existing behavior

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 12:28:10 +00:00
Aleksey Kladov
74f8201586 Avoid intermediate collections 2021-01-20 14:49:29 +03:00
Aleksey Kladov
724059569b Don't show runnable suggestions for other files
It't be actually great to have these once we have run anything dialog,
but for run the thing at point it makes sense to show a limited set.
2021-01-20 14:30:50 +03:00
Aleksey Kladov
3429b32ad1 ⬆️ rowan
It now stores text inline with tokens
2021-01-20 14:04:53 +03:00
Aleksey Kladov
46b4f89c92 . 2021-01-20 01:56:11 +03:00
Lukas Wirth
83e49200d8 Add LifetimeParam and ConstParam to CompletionItemKind 2021-01-19 20:25:29 +01:00