Commit Graph

1986 Commits

Author SHA1 Message Date
Florian Diebold
3e4d41d1e4 Determine receiver for completion in a more robust way
Also rename a parameter.
2018-12-25 17:43:58 +01:00
Florian Diebold
3befd1a9e8 Cleanup 2018-12-25 15:44:10 +01:00
Florian Diebold
e5a8089b08 Add . to trigger characters 2018-12-25 15:27:15 +01:00
Florian Diebold
ab0b63992b Implement basic completion for fields 2018-12-25 15:27:15 +01:00
Florian Diebold
0d724ea572 Improve parsing of incomplete field accesses in preparation for field completion
We need to be able to get the receiver even if there is no field name yet, and
currently "a." wouldn't get parsed as a field name at all. This seems to help.
2018-12-25 15:16:42 +01:00
Florian Diebold
55c941cd9f Type field accesses 2018-12-25 15:16:42 +01:00
Florian Diebold
07a7285965 Collect field data for structs/enum variants 2018-12-25 15:16:42 +01:00
Florian Diebold
4cb7b0f2af Add AST definitions for struct/variant fields etc.
Fixes #117
2018-12-25 15:16:42 +01:00
Florian Diebold
6fcd38cc81 Infer result of struct literals, and recurse into their child expressions 2018-12-25 15:16:42 +01:00
Florian Diebold
4ff1618520 Do name resolution by namespace (types/values) 2018-12-25 15:16:42 +01:00
Florian Diebold
b5b68f2094 Add basic HIR and types for structs/enums 2018-12-25 15:16:42 +01:00
bors[bot]
5fb426cb9e Merge #331
331: Cancelled is not Copy r=matklad a=matklad

I'd love to have a backtrace in `Cancelled` to be able to debug "completion is always cancelled" problem. So it probably is a good idea to make `Cancelled` non Copy type, even if it is a ZST in prod.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-25 10:40:42 +00:00
Aleksey Kladov
8d49c098a5 cancelled is not Copy 2018-12-25 13:36:39 +03:00
bors[bot]
64046253a3 Merge #328
328: fix warning conversion r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-24 23:18:10 +00:00
Aleksey Kladov
21293d0533 fix warning conversion 2018-12-25 02:07:30 +03:00
bors[bot]
b65ba8f1d6 Merge #326
326: resolved #324: remove unnecessary braces in use statement. r=matklad a=gfreezy

Add inspection for unnecessary braces in use statement

Co-authored-by: gfreezy <gfreezy@gmail.com>
2018-12-24 18:39:31 +00:00
gfreezy
0fb8894fbe fix tests 2018-12-24 23:01:16 +08:00
gfreezy
29798c763c remove option from Diagnostic 2018-12-24 23:00:18 +08:00
gfreezy
70df097c89 keep severity to Error & WeakWarning 2018-12-24 22:48:46 +08:00
bors[bot]
67e768466f Merge #327
327: Beginnings of type inference r=flodiebold a=flodiebold

I was a bit bored, so I thought I'd try to start implementing the type system and see how far I come 😉  This is obviously still extremely WIP, only very basic stuff working, but I thought I'd post this now to get some feedback as to whether this approach makes sense at all.

There's no user-visible effect yet, but the type inference has tests similar to the ones for the parser. My next step will probably be to implement struct types, after which this could probably be used to complete fields.

I realize this may all get thrown away when/if the compiler query system gets usable, but I feel like there are lots of IDE features that could be implemented with somewhat working type inference in the meantime 😄 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2018-12-24 14:40:11 +00:00
Florian Diebold
4befde1eee Change inference tests to have one per file 2018-12-24 15:36:54 +01:00
Florian Diebold
655f5bc261 Rename a variable for consistency 2018-12-24 15:19:49 +01:00
Florian Diebold
76fb05d91d Clean up Ty a bit
Removing irrelevant comments copied from rustc etc.
2018-12-24 15:18:37 +01:00
bors[bot]
abe09eb5ed Merge #278
278: Add make_pub_crate code action to ra_editor r=matklad a=h-michael

implement #170

Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
2018-12-24 13:51:27 +00:00
bors[bot]
b052059f86 Merge #302
302: WIP: Support tracing lsp requests. r=DJMcNab a=DJMcNab

EDIT: We need to work out a better way to handle settings before this can be merged. Help wanted

TODO: Debug why decorations are sent even when highlightingOn is disabled
This makes the log volume so high its impossible to work with anyway.
(Continuation of #84 [#99 only disabled using it, not making sure we don't send it]).

These logs can be used in https://microsoft.github.io/language-server-protocol/inspector/

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-24 13:47:27 +00:00
DJMcNab
ecab036d6f Add a very hacky workaround to not trace decorations requests 2018-12-24 13:43:08 +00:00
Hirokazu Hata
c14ca038da Add make_pub_crate code action to ra_editor 2018-12-24 11:03:59 +09:00
Florian Diebold
a1d0b5bc3c Prepare Ty::new for resolution 2018-12-23 17:49:30 +01:00
gfreezy
17b35a7f7d remove unnecessary braces in use statments 2018-12-24 00:40:36 +08:00
gfreezy
346638c809 add serverity to vscode diagnostics 2018-12-24 00:39:33 +08:00
Florian Diebold
c85748f5fb Type the return values of call expressions 2018-12-23 17:29:03 +01:00
Florian Diebold
ef67581104 Resolve paths to defs (functions currently) during type inference 2018-12-23 17:13:11 +01:00
gfreezy
000aacafda resolved #324: remove unnecessary braces in use statement. 2018-12-23 23:50:11 +08:00
Florian Diebold
93ffbf80c6 Make let statements kind of work 2018-12-23 14:01:50 +01:00
Florian Diebold
5d60937090 Remove unwraps 2018-12-23 13:48:04 +01:00
Florian Diebold
b4139d54fc Get rid of the terrible nesting in PathExpr inference 2018-12-23 13:48:04 +01:00
Florian Diebold
515c3bc59b Cleanup 2018-12-23 13:48:04 +01:00
Florian Diebold
7348f7883f Add testing infrastructure for type inference
- move dir_tests to test_utils for that.
2018-12-23 13:48:04 +01:00
Florian Diebold
3899898d75 Parse integer / float types 2018-12-23 13:48:04 +01:00
Florian Diebold
3ac605e687 Add beginnings of type infrastructure 2018-12-23 13:48:04 +01:00
DJMcNab
a0e8538129 Improve comment 2018-12-23 11:10:12 +00:00
bors[bot]
d77520fde3 Merge #310
310: When constructing a crate graph, detect and forbid cycles. r=matklad a=gfreezy

fixed #300

Co-authored-by: gfreezy <gfreezy@gmail.com>
2018-12-22 14:48:18 +00:00
gfreezy
c0add813e9 mark as visited on entry instead of left 2018-12-22 22:40:41 +08:00
bors[bot]
8fed875c90 Merge #323
323: workaround salsa/parking-log bug r=matklad a=matklad

https://github.com/salsa-rs/salsa/issues/99
https://github.com/Amanieu/parking_lot/issues/101

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-22 13:47:27 +00:00
Aleksey Kladov
724862a1a4 workaround salsa/parking-log bug
https://github.com/salsa-rs/salsa/issues/99
https://github.com/Amanieu/parking_lot/issues/101
2018-12-22 16:45:57 +03:00
bors[bot]
5a5402d4d4 Merge #322
322: Fix analyzer extension fail when there are enabled any VIM extension r=matklad a=max-frai

`type` command is allowed only once to be registered and it was built specially for vim mode.
So if user has vim extension enabled, rust-analyzer initialization failes on trying to register own `type` handler.

Unfortunatelly, there are no nice ways to check if command is already registered so the way is to wrap everything with try/catch and notify user about conflict.

Co-authored-by: frai <me@maxfrai.com>
2018-12-22 13:34:04 +00:00
frai
0f5d9a0322 Fix analyzer extension fail when there are enabled any VIM extension. 2018-12-22 15:26:18 +02:00
Aleksey Kladov
5c7e8f47a8 less chatty logging 2018-12-22 15:09:08 +03:00
bors[bot]
696246af7f Merge #321
321: More useful logging r=matklad a=matklad

Try not to log *huge* messages, to make logging more useful.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-22 09:47:54 +00:00
Aleksey Kladov
90f20f8c53 less verbose debug 2018-12-22 12:38:24 +03:00