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
memoryruins
5476c4faa3
Update smallvec dep to 1.0
2019-11-15 07:18:10 -05:00
Aleksey Kladov
c3f84960aa
Flatten expr module
2019-11-15 14:53:09 +03:00
Aleksey Kladov
2f6c0c314b
Move scope tests to hir_def
2019-11-15 14:47:26 +03:00
Aleksey Kladov
9167da66ac
Reduce visibility
2019-11-15 14:15:04 +03:00
Aleksey Kladov
5766ceab06
Add convenience method for testing
2019-11-15 13:16:30 +03:00
Aleksey Kladov
3564fbb7f5
Auto-upgrade some insta snapshots
2019-11-15 12:56:24 +03:00
Aleksey Kladov
487fc448c3
Reduce visibility
2019-11-15 12:24:30 +03:00
Geoffry Song
a68aefdc46
Move inclusive range check to validation
2019-11-15 01:04:45 -08:00
Aleksey Kladov
b80fa14a85
Use Local more
2019-11-15 12:00:36 +03:00
Geoffry Song
989cebc99c
Fix parsing of "postfix" range expressions.
...
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 .
2019-11-15 00:18:28 -08:00
bors[bot]
31d01efb06
Merge #2251
...
2251: Privatize modules r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 07:45:57 +00:00
Aleksey Kladov
a28907af8c
Privatize modules
2019-11-15 10:42:54 +03:00
Aleksey Kladov
9c7a2aef30
Refactor Module::from_source to properly descend from root file
2019-11-15 10:26:31 +03:00
bors[bot]
3ad11973ac
Merge #2165
...
2165: ra_assists: Add add_new assist r=matklad a=rep-nop
Adds a new assist to autogenerate a new fn based on the selected struct, excluding tuple structs and unions. The fn will inherit the same visibility as the struct and the assist will attempt to reuse any existing impl blocks that exist at the same level of struct.
Not marking this as closing #1644 since there's a part 2 of adding autocompletion for when someone starts typing `[pub ]fn new(...`
Co-authored-by: Wesley Norris <repnop@outlook.com>
2019-11-15 07:01:19 +00:00
bors[bot]
a6d080608d
Merge #2249
...
2249: Cleanup hover r=matklad a=kjeremy
Take advantage of classify_name to consolidate multiple hover paths. This isn't quite as clean as I want it to be (`no_fallback` bool is wonky). There's a relationship between `HoverResult` being empty and the range that is a little warty.
Also I noticed that HoverResults are always marked as exact and have been for quite a while... maybe that should be removed in another PR.
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-15 06:27:59 +00:00
Jeremy Kolb
89647f93c4
Cleanup hover
...
Take advantage of classify_name
2019-11-14 22:53:42 -05:00
kjeremy
50825a41d8
Renormalize line endings
2019-11-14 19:44:37 -05:00
kjeremy
fc9c2915c7
Even if jemalloc feature is used do not use it on msvc
...
Fixes #2233
2019-11-14 11:47:18 -05:00
Aleksey Kladov
1583ab1558
Move body queries to hir_def
2019-11-14 17:37:22 +03:00
Aleksey Kladov
ef02296b9f
Simplify parsing
2019-11-14 17:36:27 +03:00
Aleksey Kladov
f924ae3b86
Move scopes to hir_def
2019-11-14 11:56:13 +03:00
Aleksey Kladov
4efd345b09
Slightly better naming
2019-11-14 11:33:48 +03:00
Aleksey Kladov
da2ca01eba
Handle macro-generated expressions slightly less wrong
2019-11-14 10:30:30 +03:00
Aleksey Kladov
a73b7bb3f6
Move expansion to Expander
2019-11-14 10:04:39 +03:00
Aleksey Kladov
5c720b256f
Move parse_path to Expander
2019-11-14 09:58:39 +03:00
Aleksey Kladov
e7880db1d0
Expansion stack scaffold
2019-11-14 09:57:57 +03:00
Aleksey Kladov
c89010df2d
Add Expader::to_source
2019-11-14 09:57:57 +03:00
Aleksey Kladov
e7e85c60d2
Move original_file to Expander
2019-11-14 09:55:24 +03:00
Aleksey Kladov
8c8ef1432e
Rename MacroResolver -> Expander
2019-11-14 09:38:25 +03:00
Aleksey Kladov
b3175b7077
Move current file to MacroResolver
2019-11-14 09:37:33 +03:00
Aleksey Kladov
debf95eb1b
Reduce visibility
2019-11-14 09:24:39 +03:00
Aleksey Kladov
b8f62095d6
Normalize data
...
No need to store derivable info
2019-11-14 09:09:42 +03:00
Aleksey Kladov
4cea6bb6f1
Make make:: builders slightly more convenient
2019-11-13 11:59:18 +03:00
Aleksey Kladov
e177c65e36
Use strongly-typed ast building for early-return assist
2019-11-13 11:54:21 +03:00
Aleksey Kladov
2a69d584d6
Add a bit of types
2019-11-13 10:54:50 +03:00
Aleksey Kladov
018255efe3
Minor cleanup
2019-11-13 10:32:53 +03:00
Aleksey Kladov
70dd70b1fc
Reduce duplication between uncertain floats & ints
2019-11-13 09:56:33 +03:00
bors[bot]
3322d65add
Merge #2223
...
2223: Move expression lowering to hir_def r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-12 15:53:55 +00:00
Aleksey Kladov
fe5e74e083
Add helpful pointer to module docs
2019-11-12 18:53:26 +03:00
Aleksey Kladov
1c0a3a1a30
Drop obsolete comment
2019-11-12 18:51:37 +03:00
Aleksey Kladov
1a90ad5802
Move expression lowering to hir_def
2019-11-12 18:46:57 +03:00
bors[bot]
2549be750e
Merge #2217
...
2217: Implement FromStr for enum Edition r=matklad a=clemarescx
Just did this as I came across the comment in the code asking for implementing `std::str::FromStr` for `input::Edition`.
Not sure what was meant by "proper error handling" though, `panic!` with a descriptive message might not be it 😅
Co-authored-by: Metabaron <metabaron@tuta.io>
2019-11-12 15:30:36 +00:00
Aleksey Kladov
fe00db72b9
Remove owner from Body
2019-11-12 16:46:27 +03:00
Aleksey Kladov
30bf7e43db
Disallow regressing crate docs
2019-11-12 15:41:02 +03:00
Aleksey Kladov
d09e5a3d9e
Move definition of exprs to hir_def
2019-11-12 15:09:25 +03:00
Metabaron
dae087656a
Fix unused import
2019-11-12 12:01:13 +01:00
Metabaron
53b9c1c8d8
return Error instead of panicking in from_cargo_metadata
2019-11-12 12:01:13 +01:00
Metabaron
b69738590c
Implement FromStr for enum Edition
2019-11-12 12:01:13 +01:00
Aleksey Kladov
f5e1b0f97c
Minor refactoring
2019-11-12 12:07:47 +03:00
Aleksey Kladov
fc055281a5
Minor cleanup
2019-11-12 11:49:16 +03:00
Greg
088e5e1721
fix typo
2019-11-11 22:56:39 -05:00
Greg
eb72156094
Implement postfix completions feature flag
2019-11-11 22:55:10 -05:00
Aleksey Kladov
c5a18c44e5
Introduce hir::GenericParam
...
Unlike existing hir::GenericParams, this is a global ID.
2019-11-11 17:36:27 +03:00
Aleksey Kladov
ff609cc497
Don't reexport generics from HIR
2019-11-11 17:22:06 +03:00
bors[bot]
a599147b42
Merge #2200
...
2200: Add variables to HIR r=matklad a=matklad
Introduce a `hir::Variable`, which should cover locals, parameters and `self`. Unlike `PatId`, variable knows it's owner so it is self-contained, and should be more convenient to use from `ra_ide_api`.
The goal here is to hide more details about `Body` from hir, which should make it easier to move `Body` into `hir_def`. I don't think that `ra_ide_api` intrracts with bodies directly at the moment anyway, but the glue layer is based basically on `ast::BindPat`, which seems pretty brittle.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 11:48:02 +00:00
Aleksey Kladov
8b7f853cc1
Add hir::Local
2019-11-11 14:42:08 +03:00
bors[bot]
ef2a9aedb6
Merge #2205
...
2205: Implement bulitin line! macro r=matklad a=edwin0cheng
This PR implements bulitin macro `line!` and add basic infra-structure for other bulitin macros:
1. Extend `MacroDefId` to support builtin macros
2. Add a `quote!` macro for simple quasi quoting.
Note that for support others builtin macros, eager macro expansion have to be supported first, this PR not try to handle it. :)
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-11 10:53:24 +00:00
Edwin Cheng
4f7df2aac1
Add MacroDefKind
2019-11-11 18:48:16 +08:00
Aleksey Kladov
ef70925f5f
Refactor highlighting to use classify_name
2019-11-11 12:52:14 +03:00
Aleksey Kladov
4deba88c33
Introduce ToNav trait
2019-11-11 12:19:57 +03:00
Aleksey Kladov
5bb92c2d1a
impl fmt::Display for BuiltinType
2019-11-11 11:59:19 +03:00
bors[bot]
113d7e44b7
Merge #2203
...
2203: Hover for builtins r=matklad a=kjeremy
Fixes #2192
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-11 08:41:54 +00:00
Aleksey Kladov
1860f9ab43
Forbid visibility qualifiers in traits
2019-11-11 11:26:57 +03:00
Aleksey Kladov
ee876e7881
Make primitive tys public
2019-11-11 09:20:18 +03:00
Edwin Cheng
c4aa8b63bc
Add line macro and tests
2019-11-11 14:15:09 +08:00
Edwin Cheng
1637a8a590
Add quote macro
2019-11-11 14:14:39 +08:00
Edwin Cheng
c46768d13d
Add basic bultin macro infrastructure
2019-11-11 14:13:31 +08:00
Matthias Einwag
d634364462
Overwrite the prelude with one defined in a later dependency
...
This removes the special casing for the "core" prelude.
Whenever a later dependency also exports a prelude, it will replace
the formerly imported prelude. The utilized prelude then depends
purely on import order.
2019-11-10 13:15:47 -08:00
Jeremy Kolb
3188c1451a
Hover for builtins
2019-11-10 13:59:39 -05:00
Matthias Einwag
8baa05666c
Add tests for resolving types in core and std preludes
2019-11-09 17:38:08 -08:00
Matthias Einwag
799903ba16
Resolve core types
...
This adds support for completion and goto definition of
types defined within the "core" crate. The core crate is
added as a dependency to each crate in the project.
The core crate exported it's own prelude. This caused
now all crates to inherit the core crates prelude instead
of the std crates. In order to avoid the problem the
prelude resolution has been changed to overwrite
an already resolved prelude if this was set to a crate
named core - in order to pick a better prelude like std.
Fixes #2199
2019-11-09 15:22:19 -08:00
Wesley Norris
cbc6f94573
Add add_new assist
...
Adds a new assist to autogenerate a new fn based on the selected struct,
excluding tuple structs and unions. The fn will inherit the same
visibility as the struct and the assist will attempt to reuse any
existing impl blocks that exist at the same level of struct.
2019-11-09 10:56:36 -05:00
Aleksey Kladov
6294fd5ec9
Unfork struct and union ids
2019-11-09 15:34:00 +03:00
Aleksey Kladov
70f2a21b55
Remove typed macro parsing API
...
We do type-erasure on every path anyway, so it doesn't make much sense
to duplicate this function for every type
2019-11-09 13:14:10 +03:00
Aleksey Kladov
f6c40c09e0
Minor cleanup
2019-11-09 12:49:35 +03:00
bors[bot]
561bb979ce
Merge #2169
...
2169: MBE: Mapping spans for goto definition r=matklad a=edwin0cheng
Currently, go to definition gives the wrong span in MBE. This PR implement a mapping mechanism to fix it and it could be used for future MBE hygiene implementation.
The basic idea of the mapping is:
1. When expanding the macro, generated 2 `TokenMap` which maps the macro args and macro defs between tokens and input text-ranges.
2. Before converting generated `TokenTree` to `SyntaxNode`, generated a `ExpandedRangeMap` which is a mapping between token and output text-ranges.
3. Using these 3 mappings to construct an `ExpansionInfo` which can map between input text ranges and output text ranges.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-09 09:13:14 +00:00
Edwin Cheng
0a5ec69404
Remove map_ranges in RevTokenMap
2019-11-09 12:00:46 +08:00
Aleksey Kladov
c626a677e8
Touch up nameres doc comment
2019-11-09 00:23:19 +03:00
Aleksey Kladov
657340e078
Reduce visibility
2019-11-09 00:23:11 +03:00
Aleksey Kladov
53945841be
Extract path resolution submodule
2019-11-09 00:17:17 +03:00
Aleksey Kladov
785887b382
Simplify
...
There's only one call-site for the function, so it seems fine to
inline
2019-11-08 23:53:39 +03:00
Aleksey Kladov
dc5e5f610c
Reduce visibility
2019-11-08 23:47:52 +03:00
Edwin Cheng
d01e0abdb5
Refactor and simpfily
2019-11-09 04:26:28 +08:00
Edwin Cheng
62ed93db13
Refactor and add more comments
2019-11-08 10:19:41 +08:00
kjeremy
91b154fa05
Update crates
...
Removes nodrop and extra arrayvec
We have an extra crossbeam-queue and crossbeam-utils left but those should
drop once rayon accepts https://github.com/rayon-rs/rayon/pull/704
2019-11-07 13:05:12 -05:00
kjeremy
e670a99413
cargo xtask format with 1.39
2019-11-07 09:44:45 -05:00
bors[bot]
14e19c0df1
Merge #2179
...
2179: Use HirDatabase to compute `is_deprecated` r=matklad a=martskins
This PR fixes #2167 by introducing `attributes_query` and adding `fn attrs(&self, def: crate::AttrDef) -> Option<Arc<[Attr]>>;` to the `DefDatabase` trait.
I'm a little concerned about the two spots in `attributes_query` where code is repeated, but I couldn't figure out a way to avoid that, so.. I welcome suggestions 😄
Co-authored-by: Martin Asquino <martin.asquino@gmail.com>
2019-11-06 21:11:42 +00:00
Aleksey Kladov
b5349af05f
Cleanup complete_postfix
2019-11-06 14:50:03 +03:00
kjeremy
49aea4202b
Bump psm, console, indicatif
2019-11-05 10:38:50 -05:00
Edwin Cheng
568f3cff41
Fix formatting
2019-11-05 09:43:59 +08:00
Martin Asquino
cb3767f28a
HirDatabase stored attributes
2019-11-04 18:16:35 -03:00
Aleksey Kladov
93d9e8a06f
Reduce visibility
2019-11-04 23:37:35 +03:00
Aleksey Kladov
739babc391
Move Namespace enum closer to usage
2019-11-04 23:02:35 +03:00
Aleksey Kladov
50364bd478
Appease the linter by dummy doc comments
2019-11-04 22:33:21 +03:00
Aleksey Kladov
fd7819c3c0
Simplify
2019-11-04 22:29:51 +03:00
Aleksey Kladov
42370610ce
Restore assists tests
2019-11-04 22:28:47 +03:00
Aleksey Kladov
74d827bb80
Rename MockDatabase -> TestDB
...
Actually working rename is sooo useful!
2019-11-04 22:21:15 +03:00
Edwin Cheng
2a76bb5a0b
Refactor a bit
2019-11-05 03:20:54 +08:00
Aleksey Kladov
7649a8ebbe
remove dead code
2019-11-04 22:19:06 +03:00
Aleksey Kladov
24894aca31
Remove more duplication in test fixtures
2019-11-04 22:12:49 +03:00
Aleksey Kladov
dcdcc9e4c8
Remove some duplicated test functions
2019-11-04 22:04:51 +03:00
Aleksey Kladov
d04ecc8419
Reduce visibility
2019-11-04 21:42:25 +03:00
Edwin Cheng
604bdc6ffe
Use macro_rules shift to map text ranges
2019-11-05 02:09:16 +08:00
Edwin Cheng
7e28924012
Use ? and destructing to simplifed long code
2019-11-05 01:38:20 +08:00
Edwin Cheng
e6709f64af
Rename and fix typos
2019-11-05 01:38:20 +08:00
Edwin Cheng
d8b7ba201e
Add note for recurseive macro generated code
2019-11-05 01:38:20 +08:00
Edwin Cheng
1630a34c3f
Add tests
2019-11-05 01:38:20 +08:00
Edwin Cheng
e8741b9d75
Use new expansion feature in goto_definition
2019-11-05 01:38:20 +08:00
Edwin Cheng
67226ebc82
Remove dbg!
2019-11-05 01:38:20 +08:00
Edwin Cheng
d560219d06
Fixed bug in ExpandedRangeMap
2019-11-05 01:38:20 +08:00
Edwin Cheng
ae609d7953
Add parent_expansion to HirFileId
2019-11-05 01:38:20 +08:00
Edwin Cheng
159da285e9
Add macro_expansion_info in hir_expand
2019-11-05 01:38:20 +08:00
Edwin Cheng
9fd546bec2
Add map_id to TokenId
2019-11-05 01:38:20 +08:00
bors[bot]
d9fb01f803
Merge #2173
...
2173: MBE: Add TokenId shift in macro_rules r=matklad a=edwin0cheng
As discussed in #2169 , for fixing duplication TokenId during expansion :
> What we can do here is to re-number the tokens during expansion. Specifically:
> * when we create macro_rules, we note the highest id of the token we have as shift>
> * when we expand macro rules, if we need to output a token from definition, we just re-use its id
> * if we need to output a token from the argument, we increase its id by shift (so it's guaranteed to not to collide with anything from the definition)
> * finally, when we have a HirFileId of the expansion, we can look up the original value of shift and classify node to the arg/def by comparing it's id with shift.
>
This PR implement first 3 points of above solution.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-04 17:21:41 +00:00
Edwin Cheng
a5839662f4
Change to add 1 if non zero shift
2019-11-05 01:16:06 +08:00
Edwin Cheng
188a1412b9
Refactor and rename
2019-11-05 01:01:05 +08:00
Edwin Cheng
42661a3b27
Change Option<u32> to u32 for shift value
2019-11-05 00:33:19 +08:00
Edwin Cheng
63e42bb5bd
Change to better naming
2019-11-05 00:16:03 +08:00
Edwin Cheng
04af290d4e
Add TokenId Shif in macro_rules
2019-11-04 23:22:18 +08:00
bors[bot]
cc2d75d0f8
Merge #2172
...
2172: Use new text DSL instead of crate_graph! macro r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 10:30:09 +00:00
Aleksey Kladov
38b941db13
Cleanup unused marks
2019-11-04 13:29:07 +03:00
Aleksey Kladov
dfdb6321ac
Use new text DSL instead of crate_graph! macro
2019-11-04 13:25:42 +03:00
bors[bot]
fe6ba12a77
Merge #2149
...
2149: Handle IfLet in convert_to_guarded_return. r=matklad a=krk
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2124
I could not move the cursor position out of `let`:
`le<|>t` vs `let<|>`.
Also, please suggest extra test cases.
Co-authored-by: krk <keremkat@gmail.com>
2019-11-04 09:06:53 +00:00
Aleksey Kladov
3603d02134
Reexport relative_path from ra_db
2019-11-04 01:14:17 +03:00
Aleksey Kladov
8922a44395
Add small module-level docs
2019-11-04 00:23:14 +03:00
Aleksey Kladov
f0eb9cc6e6
Remove last traces of nameres from hir
2019-11-03 23:49:44 +03:00
Aleksey Kladov
73fcf9a2d6
Restore crate_def_map marks
2019-11-03 23:44:23 +03:00
Aleksey Kladov
6fba51c5fc
move crate_def_map tests to hir_def
2019-11-03 23:35:48 +03:00
Aleksey Kladov
0933d914a3
Introduce ra_db::fixture fixture module
...
The goal here is to share more testing infrastructure between crates.
2019-11-03 20:55:20 +03:00
Aleksey Kladov
ba2efca2bb
Move CrateDefMap to hir_def
2019-11-03 18:04:06 +03:00
bors[bot]
f9f1effd01
Merge #2160
...
2160: Set `deprecated` field on `CompletionItem`s r=matklad a=martskins
This PR aims to address #2042 by setting the deprecated field for completion items.
The setting the tags field for LSP 3.15 part still needs fixing, but that one is blocked due to lsp-types not being up to date with 3.15 yet.
Co-authored-by: Martin Asquino <martin.asquino@gmail.com>
2019-11-03 14:41:30 +00:00
Martin Asquino
ccf8817d18
Use bool
instead of Option<bool>
and print it's value only when true
2019-11-02 19:33:34 -03:00
Laurențiu Nicola
c7b7d7e666
Silence some warnings
2019-11-03 00:19:08 +02:00
Aleksey Kladov
13735d91a7
Move diagnostics to hir_expand
2019-11-02 23:42:38 +03:00
Martin Asquino
dc3848a6a3
Set deprecated
field on CompletionItem
s
2019-11-02 17:37:47 -03:00
Aleksey Kladov
b8533413cf
Move Source to hir_expand
2019-11-02 23:11:27 +03:00
Florian Diebold
c5e44b2084
Upgrade Chalk
2019-11-02 15:32:08 +01:00
Florian Diebold
8952380884
Change SourceAnalyzer method resoltion API
2019-11-01 20:01:21 +01:00
Florian Diebold
b29092ade3
Various review fixes
2019-11-01 19:57:08 +01:00
Florian Diebold
dc4066ebed
Add some doc comments
2019-11-01 19:57:08 +01:00
Florian Diebold
77c26c2bf1
Complete items on traits as well
2019-11-01 19:57:08 +01:00
Florian Diebold
79cb0a0dab
Complete trait assoc items
2019-11-01 19:57:08 +01:00
Florian Diebold
5da941897d
Add failing tests for trait assoc method completion
2019-11-01 19:57:08 +01:00
Florian Diebold
b0bf1deb7c
Refactor a bit
2019-11-01 19:57:08 +01:00
Florian Diebold
f4181deb0d
Don't do autoderef for path resolution
2019-11-01 19:57:08 +01:00
Florian Diebold
1173c3dab5
Refactor to unify with method resolution
2019-11-01 19:57:08 +01:00
Florian Diebold
c7cedea270
Record assoc item resolution
2019-11-01 19:57:08 +01:00
Florian Diebold
7b7133ec58
Insert type vars before doing assoc item resolution
2019-11-01 19:57:08 +01:00
Florian Diebold
44279ef1df
Add another unrelated, currently not working test
2019-11-01 19:57:08 +01:00
Florian Diebold
b634ba41e0
Get trait assoc item resolution mostly working
2019-11-01 19:57:08 +01:00
krk
bc14f500a0
Extract common parts of match arms in convert_to_guarded_return assist.
2019-11-01 18:34:42 +01:00
krk
91ab3f8760
Support paths other than "Some".
2019-11-01 18:18:58 +01:00
krk
1841a39f86
Remove variable pat.
2019-11-01 16:58:09 +01:00
bors[bot]
ed5212e1ac
Merge #2150
...
2150: Attach docs to statics r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-01 14:19:47 +00:00
kjeremy
dcc0a9cd7e
Attach docs to statics
2019-10-31 16:21:46 -04:00
krk
4a4d9f7a90
Handle IfLet in convert_to_guarded_return.
2019-10-31 21:10:58 +01:00
kjeremy
c46be83a34
Fixes #2143
2019-10-31 13:29:56 -04:00
Aleksey Kladov
09f9733ca6
move struct & enum data to hir_def
2019-10-31 16:40:36 +03:00
Aleksey Kladov
1602db7d7d
add ModuleDefId to hir_def
2019-10-31 11:23:30 +03:00
Aleksey Kladov
b20d37cb49
move builtin types to hir_def
2019-10-31 10:51:54 +03:00
Aleksey Kladov
6f4d5f7339
move mod_resolution to hir_def
2019-10-31 10:31:29 +03:00
kjeremy
4ad37df223
runnables => match_ast!
2019-10-30 16:09:16 -04:00
kjeremy
78f93c8033
traits => match_ast!
2019-10-30 16:08:59 -04:00
kjeremy
b205a0ced3
source_binder => match_ast!
2019-10-30 16:08:27 -04:00
kjeremy
4d17658940
Use match_ast! in FnCallNode::with_node
2019-10-30 14:39:05 -04:00
kjeremy
7ad55e976c
Document match_ast!
2019-10-30 14:38:45 -04:00
bors[bot]
eee55d4663
Merge #2129
...
2129: Some clippy fixes r=kjeremy a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-30 17:39:18 +00:00
kjeremy
b441b4e8ef
Some clippy fixes
2019-10-30 13:36:37 -04:00
Aleksey Kladov
cf4f7eb566
improve compile time a bit
2019-10-30 19:15:41 +03:00
Aleksey Kladov
ab559f170e
move hygiene to hir_expand
2019-10-30 19:10:53 +03:00
Aleksey Kladov
872ac566bf
push name down to hir_expand
2019-10-30 18:56:20 +03:00
Aleksey Kladov
b05d6e53fb
push either to hir_expand
2019-10-30 18:50:10 +03:00
Aleksey Kladov
0bc7d28518
refactor $crate handling
...
Introduce proper hygiene module, which should grow quite a bit
eventually.
2019-10-30 18:41:50 +03:00
Aleksey Kladov
e34e71c62d
remove forward pointer for attrs
2019-10-30 18:06:08 +03:00
Aleksey Kladov
c1ed9ccc4e
fix compilation
2019-10-30 18:04:24 +03:00
Aleksey Kladov
e5300ad3ba
remove forward pointer for type_ref
2019-10-30 17:43:14 +03:00
Aleksey Kladov
e564334320
remove forward pointer to Path
2019-10-30 17:43:14 +03:00
Aleksey Kladov
f8ddef875a
remove forward pointer for name
2019-10-30 17:43:14 +03:00
Aleksey Kladov
16e620c052
move raw_items to hir_def
2019-10-30 17:43:11 +03:00
Aleksey Kladov
c9cd6aa370
Move ids to hir_def crate
2019-10-30 13:11:38 +03:00
Aleksey Kladov
a136cc0653
introduce ra_hir_def
2019-10-30 12:27:54 +03:00
Aleksey Kladov
56bc874f1d
move ty interning to ty
2019-10-30 11:18:38 +03:00
bors[bot]
8046f5b24a
Merge #2125
...
2125: don't add macro braces in use items r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-30 07:40:23 +00:00
Aleksey Kladov
d7a7da8261
don't add macro braces in use items
2019-10-30 10:39:12 +03:00
kjeremy
3c140050ff
Profile all request handlers
2019-10-29 16:08:36 -04:00
kjeremy
4ca5d4c353
Add missing test for label
2019-10-29 15:25:31 -04:00
Florian Diebold
47cfdb4aa3
Don't add a space after the opening brace in autoimport
2019-10-29 18:14:15 +01:00
kjeremy
eb220a081b
Primitive signature help for mbe
2019-10-29 12:16:55 -04:00
bors[bot]
de16f94ada
Merge #2103
...
2103: Expand signature help r=matklad a=kjeremy
Signature help using call syntax with tuple structs and enum variants
Fixes #2102 .
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-29 13:48:26 +00:00
kjeremy
b915bf2d05
SigKind -> CallableKind
2019-10-29 09:46:55 -04:00
bors[bot]
e38cdf6e56
Merge #2114
...
2114: Move macro expansion to a separate crate r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-29 13:19:45 +00:00
Aleksey Kladov
bca708ba4c
cleanup
2019-10-29 16:19:08 +03:00
Aleksey Kladov
99b6ecfab0
switch expand to dyn Trait
2019-10-29 16:12:54 +03:00
Aleksey Kladov
3260639608
reduce visibility
2019-10-29 16:08:06 +03:00
Aleksey Kladov
1ec418c3b8
add doc comment
2019-10-29 16:03:29 +03:00
Aleksey Kladov
7de6eaa58a
remove not that useful indirection
2019-10-29 16:01:14 +03:00
Aleksey Kladov
b8b7969bfb
remove empty module
2019-10-29 15:53:25 +03:00
Aleksey Kladov
2a5254c106
reduce visibility
2019-10-29 15:25:46 +03:00
Aleksey Kladov
d095d9273e
remove unused query
2019-10-29 15:22:20 +03:00
Aleksey Kladov
858dd48af2
less generics
2019-10-29 15:20:08 +03:00
Aleksey Kladov
6bf7faf315
flatten hir_expand
2019-10-29 15:11:42 +03:00
Aleksey Kladov
dba767802d
make file id repr private again
2019-10-29 15:01:55 +03:00
Florian Diebold
632a22ae62
Upgrade Chalk, make use of TypeName::Error variant
2019-10-29 13:01:33 +01:00
Aleksey Kladov
5b803055b7
rename hir_def -> hir_expand
2019-10-29 14:59:55 +03:00
Aleksey Kladov
5413875644
move expansion-related code to a separate crate
2019-10-29 14:55:39 +03:00
Aleksey Kladov
77f90caf2d
start ra_hir_def crate
2019-10-29 11:15:51 +03:00
bors[bot]
120000609a
Merge #2111
...
2111: Fix autoimport not choosing the deepest use tree in some situations r=matklad a=flodiebold
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-10-28 19:32:52 +00:00
Florian Diebold
6d1b4ffa2e
Fix autoimport not choosing the deepest use tree in some situations
2019-10-28 19:08:56 +01:00
Aleksey Kladov
54d3e47318
weaken requirements of AstDef
2019-10-28 20:29:57 +03:00
kjeremy
01238a6fd7
Filter out non callable versions of Struct/EnumVariant
2019-10-28 10:48:40 -04:00
Jeremy Kolb
ddf25e9481
formatting
2019-10-28 08:42:17 -04:00
Aleksey Kladov
5a6db3ca29
fix parsing of for loops inside expressions
...
closes #2051
2019-10-28 15:41:34 +03:00
Jeremy Kolb
44f2805fee
Fix syntax
2019-10-28 08:32:23 -04:00
Jeremy Kolb
49e89772f6
Preliminary enum variant support
2019-10-28 08:32:22 -04:00
Jeremy Kolb
55d4b06a53
Add disciminant
2019-10-28 08:32:22 -04:00
Jeremy Kolb
5a59bc9fcb
WIP: Expand signature help
...
This is hacky but works for tuple structs. Proof of concept.
2019-10-28 08:32:22 -04:00
bors[bot]
02828520a7
Merge #2097
...
2097: Be more precise with function signatures r=matklad a=kjeremy
Finds the closest call expr.
Fixes #2093
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-10-28 11:53:16 +00:00
Jeremy Kolb
1438f38eb6
Preserve whitespace at the end of doc comments
...
Whitespace can have special meaning in markdown. For instance
ending a line with three spaces will render a new line.
Note that this behavior diverges from RLS.
Fixes #1997
2019-10-27 16:56:25 -04:00
bors[bot]
46b63c462d
Merge #2099
...
2099: Fix panic on raw string assist r=matklad a=aee11
Strings that do not contain two quotation marks would cause a slice indexing panic because `find_usual_string_range` would return a range that only contained a single quotation mark.
Panic example:
```
fn main() {
let s = "<|>
}
```
I noticed a lot of panics from the `make_raw_string` assist while working on another issue today.
Co-authored-by: Alexander Elís Ebenesersson <alex2789@gmail.com>
2019-10-27 19:20:01 +00:00
Alexander Elís Ebenesersson
17bd3e59f8
Fix panic on raw string assist
...
Strings that do not contain two quotation marks
would cause a slice indexing panic because code
was assuming `find_usual_string_range` would return
a string with two quotes, but it would incorrectly
also return text ranges containing only a single quote.
2019-10-28 03:00:28 +09:00
Jeremy Kolb
a0d55edc38
Be more precise with function signatures
...
Fixes #2093
2019-10-27 12:26:44 -04:00
Aleksey Kladov
ad3fe316c6
further simplify assists
2019-10-27 18:22:14 +03:00
Aleksey Kladov
b6fcacd96d
move all assists to use generated docs
2019-10-27 17:49:39 +03:00
Aleksey Kladov
cda6355de2
simplify AssistCtx API
...
We never actually use ability to create multiple actions out of a
single context
2019-10-27 17:35:37 +03:00
Aleksey Kladov
9e638c9f3e
simplify
2019-10-27 17:27:05 +03:00
bors[bot]
ad950830d0
Merge #2090
...
2090: move public stuff to top r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-27 14:13:09 +00:00
Aleksey Kladov
85c64ec7be
use new api for flip_trait_bound assist
2019-10-27 17:02:43 +03:00
Wesley Norris
fc2fc8528b
Add tests for the trait bound flip assist.
...
Co-authored-by: vlthr <vlthr@users.noreply.github.com>
2019-10-27 16:52:33 +03:00
Wesley Norris
3a64a85a52
Fixes #2054 .
...
This adds the `flip_trait_bound` assist which allows for the swapping of two trait bounds in a trait list that are next to each other.
2019-10-27 16:52:33 +03:00
Aleksey Kladov
be0f48f7cf
move public stuff to top
2019-10-27 16:48:20 +03:00
Aleksey Kladov
73532e900e
rename auto_import -> add_import
...
We are long way from auto imports at the moment
2019-10-27 16:46:49 +03:00
Alexander Elís Ebenesersson
3e7e3fdf16
extend selection in trait bound extends to plus
...
When multiple traits bounds are present, expanded selection
from a single trait bound will include the nearest plus sign
(and whitespace after) before including the whole trait bound.
2019-10-27 21:29:06 +09:00
Aleksey Kladov
8464c45086
remove relative_path_buf workaround
...
The upstream problem was fixed with the change to 1.0
2019-10-27 12:36:40 +03:00
Aleksey Kladov
da5528824a
document almost all assists
2019-10-27 12:23:22 +03:00
Aleksey Kladov
860bbd56ef
lightly document assist_ctx module
2019-10-27 12:04:06 +03:00
Aleksey Kladov
8118dc1bb9
use more consistent naming
...
I think this is the first time I use global rename for rust-analyzer
itself :-)
2019-10-27 11:53:09 +03:00
Aleksey Kladov
61349a3d18
extract assist helper for getting a specific token
2019-10-27 11:53:01 +03:00
Aleksey Kladov
3840324429
raw string assists work in macros
2019-10-27 11:49:13 +03:00
Aleksey Kladov
a490ba06fa
document some more assists
2019-10-27 11:26:46 +03:00
Aleksey Kladov
cf4720ffd5
use unicode bar for drawing the cursor
2019-10-26 21:22:40 +03:00
Aleksey Kladov
4a83aae098
support range selection in assist docs
2019-10-26 20:57:23 +03:00
Aleksey Kladov
431e4ff4ef
avoid TextEditorBuilder for simple edits
2019-10-26 20:09:56 +03:00
Aleksey Kladov
a5cbd8d5e8
check style for assist docs
2019-10-26 19:08:13 +03:00
Aleksey Kladov
4ef9b8d17a
use correct spacing for enum pattern
2019-10-26 18:03:55 +03:00
Aleksey Kladov
3126152a84
document a couple of assists
2019-10-26 17:37:55 +03:00
Aleksey Kladov
394e474479
add blank lines for readability
2019-10-26 17:27:47 +03:00
Florian Diebold
b342ee5616
Upgrade Chalk (without using its dyn/impl Trait support)
2019-10-26 15:11:39 +02:00
Aleksey Kladov
d385438bcc
generate more assists docs
2019-10-25 23:38:15 +03:00
bors[bot]
c48b467eff
Merge #2069
...
2069: auto-generate assists docs and tests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-25 11:50:06 +00:00
Aleksey Kladov
0dd35ff2b2
auto-generate assists docs and tests
2019-10-25 14:47:48 +03:00
bors[bot]
5f779f6c46
Merge #2066
...
2066: insert space after `->` r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-25 11:24:43 +00:00
Laurențiu Nicola
27a0cb3025
Specify working chalk revisions in manifest
2019-10-25 13:33:14 +03:00
Aleksey Kladov
d5cd8b5be2
disable the new typing handler for ->
...
It doesn't actually work with LSP
2019-10-25 13:03:57 +03:00
Aleksey Kladov
53e3bee0cf
insert space after ->
2019-10-25 12:41:34 +03:00
Aleksey Kladov
ea948e9fbb
refactor typing_handlers
2019-10-25 12:04:17 +03:00
Aleksey Kladov
6f00bb1cb0
introduce SingleFileChange
2019-10-25 11:49:38 +03:00
Aleksey Kladov
b112430ca7
move source change to a dedicated file
2019-10-25 11:30:50 +03:00
Aleksey Kladov
8d2fd59cfb
make typing infra slightly more extensible
2019-10-25 11:30:46 +03:00
Aleksey Kladov
dc65219ae1
document feature flags
2019-10-25 09:00:30 +03:00
kjeremy
64c1dd10b8
bump insta
2019-10-24 10:35:22 -04:00
bors[bot]
95cf5c86fa
Merge #2059
...
2059: for highlighting, search only the current file r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-24 11:17:03 +00:00
Aleksey Kladov
4529da906d
for highlighting, search only the current file
2019-10-24 14:16:36 +03:00
Aleksey Kladov
6d186ec3be
add search scope stuct
2019-10-24 13:41:25 +03:00
Aleksey Kladov
5750ee69ff
add --with-deps option to analysis-stats
2019-10-24 12:32:19 +03:00
Aleksey Kladov
ac1b7b07e7
add some profiling calls
2019-10-24 10:37:20 +03:00
Aleksey Kladov
418fbc8662
don't die if a sync task panics
2019-10-24 09:56:30 +03:00
Aleksey Kladov
baa968e71c
show unaccounted for time in profiling
2019-10-24 09:14:33 +03:00
Aleksey Kladov
b5f13d8d51
xtask: move codegen to a module
2019-10-23 18:57:18 +03:00
bors[bot]
edf4d8e555
Merge #2049
...
2049: add couple of profiling calls r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-23 15:44:40 +00:00
Aleksey Kladov
f5bf7f29b5
add couple of profiling calls
2019-10-23 18:26:43 +03:00
Aleksey Kladov
afc6ee251d
minor cleanup
2019-10-23 17:41:15 +03:00
Aleksey Kladov
68ea9bd1bf
restore assert
2019-10-23 11:31:16 +03:00
Ekaterina Babshukova
decfd28bd1
some fixes, add docs
2019-10-23 00:35:06 +03:00
Ekaterina Babshukova
b5a3ee93e2
support items that visible to the parent module
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
55e1910d00
classify module from declaration
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
93c179531b
fix highlighting
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
328be5721a
remove SearchScope
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
88ff88d318
use Lazy, some fixes
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
19fbf2c16b
remove unreachable!()
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
835173d065
replace trait by a bunch of functions
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
d26d0ada50
restructure a bit
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
0dd08b8023
classify definition of a function right
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
79e6b3b0d1
make handle_references
accept refs from other files
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
df8441b24e
some fixes, add tests
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
5b03773fbe
implement search of references
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
01853e8d6c
find scope for Declaration
item
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
121aa35f12
return Declaration from classify_name_ref
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
83f780eabf
return Declaration from classify_name
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
0b5d0a41fd
replace a chain of if let
by macro
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
d6ae1b5f0f
refactor name_ref_kind.rs
2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
11577288c2
initial classify_name
2019-10-22 23:47:31 +03:00