Commit Graph

1105 Commits

Author SHA1 Message Date
Laurențiu Nicola
f1bbc776c0 Fold trait declarations 2020-08-03 15:45:39 +03:00
Aleksey Kladov
bff8dd0949 Update grammar 2020-08-01 13:47:19 +02:00
David Lattimore
21d2cebcf1 SSR: Matching trait associated constants, types and functions
This fixes matching of things like `HashMap::default()` by resolving
`HashMap` instead of `default` (which resolves to `Default::default`).

Same for associated constants and types that are part of a trait
implementation.

However, we still don't support matching calls to trait methods.
2020-08-01 12:55:26 +10:00
Aleksey Kladov
22d295ceaa Rename DotDotPat -> RestPat 2020-07-31 21:45:29 +02:00
Aleksey Kladov
af53d5f4b0 Rename 2020-07-31 20:23:52 +02:00
Aleksey Kladov
9818108798 Rename BindPat -> IdentPat 2020-07-31 20:12:10 +02:00
Aleksey Kladov
14cb96ec0e Allign RecordPat with RecordExpr 2020-07-31 20:00:48 +02:00
Aleksey Kladov
91781c7ce8 Rename TypeArgList -> GenericArgList 2020-07-31 18:29:29 +02:00
Aleksey Kladov
633aace411 Rename LambdaExpr -> ClosureExpr 2020-07-31 17:08:58 +02:00
Aleksey Kladov
08ea2271e8 Rename TypeRef -> Type
The TypeRef name comes from IntelliJ days, where you often have both
type *syntax* as well as *semantical* representation of types in
scope. And naming both Type is confusing.

In rust-analyzer however, we use ast types as `ast::Type`, and have
many more semantic counterparts to ast types, so avoiding name clash
here is just confusing.
2020-07-31 12:14:37 +02:00
Aleksey Kladov
f95f425ae4 Use ty to access most TypeRefs 2020-07-30 21:02:55 +02:00
Aleksey Kladov
2e2642efcc Remove TypeAscriptionOwner 2020-07-30 20:51:43 +02:00
Aleksey Kladov
fcce07d2d1 Finalize attribute grammar 2020-07-30 20:21:32 +02:00
Aleksey Kladov
c5798c4d75 Finalize impl Grammar 2020-07-30 18:28:28 +02:00
Aleksey Kladov
c83467796b Finalize Trait grammar 2020-07-30 18:17:28 +02:00
Aleksey Kladov
ba71f05438 fmt 2020-07-30 18:10:07 +02:00
Aleksey Kladov
3cd4112bdc Finalize const&static grammar 2020-07-30 18:02:20 +02:00
Aleksey Kladov
1766aae145 Rename EnumVariant -> Variant 2020-07-30 17:56:53 +02:00
Aleksey Kladov
609680ef97 Rename EnumDef -> Enum 2020-07-30 17:52:53 +02:00
Aleksey Kladov
216a5344c8 Rename StructDef -> Struct 2020-07-30 17:50:40 +02:00
Aleksey Kladov
1ae4721c9c Finalize union grammar 2020-07-30 17:38:52 +02:00
Aleksey Kladov
0a9e3ccc26 Rename FieldDef -> Field 2020-07-30 16:49:13 +02:00
Aleksey Kladov
6f8aa75329 Rename RecordLit -> RecordExpr 2020-07-30 16:21:30 +02:00
Aleksey Kladov
28ef4c375a Rename TypeParamList -> GenericParamList 2020-07-30 15:36:21 +02:00
Aleksey Kladov
eb2f806344 Rename TypeAliasDef -> TypeAlias 2020-07-30 15:25:46 +02:00
Aleksey Kladov
1142112c70 Rename FnDef -> Fn 2020-07-30 15:16:05 +02:00
Aleksey Kladov
b1332670c7 Rename UseItem -> Use 2020-07-30 14:20:33 +02:00
Aleksey Kladov
2984da672e Split ItemList & AssocItemList 2020-07-30 11:50:56 +02:00
Aleksey Kladov
6636f56e79 Rename ModuleItem -> Item 2020-07-30 00:23:03 +02:00
Aleksey Kladov
ba585309ec Replace rand with oorandom 2020-07-29 19:49:10 +02:00
Aleksey Kladov
76202a2c73 Rename NomialDef -> AdtDef 2020-07-29 19:22:15 +02:00
bors[bot]
9a9ddcc297
Merge #5564
5564: SSR: Restrict to current selection if any r=davidlattimore a=davidlattimore

The selection is also used to avoid unnecessary work, but only to the file level. Further restricting unnecessary work is left for later.

Co-authored-by: David Lattimore <dml@google.com>
2020-07-29 09:23:33 +00:00
David Lattimore
fcb6b166fb SSR: Rename position and lookup_context to resolve_context 2020-07-29 19:20:40 +10:00
David Lattimore
cf55806257 SSR: Restrict to current selection if any
The selection is also used to avoid unnecessary work, but only to the
file level. Further restricting unnecessary work is left for later.
2020-07-29 15:06:58 +10:00
Kirill Bulatov
bb1ae85ed0 Allow running more tests at once 2020-07-29 01:03:19 +03:00
Aleksey Kladov
aa09aa36e2 Fold multiline fn parameters 2020-07-27 13:42:36 +02:00
Emil Gardström
2b8dcc15ac add completion for rustc lints 2020-07-27 02:23:21 +02:00
Jonas Schievink
92a4ec80a0 Only display experimental diagnostics when enabled 2020-07-24 17:39:44 +02:00
Jonas Schievink
6f02befee4 Add a builder for DiagnosticSink 2020-07-24 16:30:12 +02:00
David Lattimore
3dac31fe80 SSR: Allow function calls to match method calls
This differs from how this used to work before I removed it in that:
a) It's only one direction. Function calls in the pattern can match
method calls in the code, but not the other way around.
b) We now check that the function call in the pattern resolves to the
same function as the method call in the code.

The lack of (b) was the reason I felt the need to remove the feature
before.
2020-07-24 21:34:00 +10:00
David Lattimore
757f755c29 SSR: Match paths based on what they resolve to
Also render template paths appropriately for their context.
2020-07-24 21:34:00 +10:00
David Lattimore
3975952601 SSR: Pass current file position through to SSR code.
In a subsequent commit, it will be used for resolving paths.
2020-07-24 21:34:00 +10:00
David Lattimore
a45682ed96 Move iteration over all files into the SSR crate
The methods `edits_for_file` and `find_matches_in_file` are replaced with just `edits` and `matches`. This simplifies the API a bit, but more importantly it makes it possible in a subsequent commit for SSR to decide to not search all files.
2020-07-24 21:34:00 +10:00
bors[bot]
8df105b8b2
Merge #5505
5505: Cleanup CFG API r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-23 14:55:22 +00:00
Aleksey Kladov
38e38d9b29 Cleanup CFG API 2020-07-23 16:53:12 +02:00
bors[bot]
7bada8a76d
Merge #5473
5473: Changes to rust-project.json r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-23 13:58:45 +00:00
Aleksey Kladov
b68ef1231d More Rustic API for Env 2020-07-21 17:17:21 +02:00
bors[bot]
9518e2f9d6
Merge #5451 #5463 #5465 #5466
5451: Highlight more cases of SyntaxKind when it is a punctuation r=matklad a=GrayJack

This maybe closes #5406
Closes  #5453

Separate what one expect to be a punctuation semantic token (like `,`, `;`, `(`, etc), and what is not (`&`, `::`, `+`, etc)

5463: Bump lexer r=matklad a=kjeremy

Since we're now on rust 1.45

5465: Bump chalk r=matklad a=kjeremy



5466: Do not show default types in function and closure return values r=matklad a=SomeoneToIgnore

Avoid things like 
<img width="522" alt="image" src="https://user-images.githubusercontent.com/2690773/87985936-1bbe4f80-cae5-11ea-9b8a-5383d896c296.png">


Co-authored-by: GrayJack <gr41.j4ck@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-07-21 09:57:46 +00:00
GrayJack
5ca3855c06
On second thought, we want to preserve the textMate here where all punctuation that are from a Attr be highlited as Attribute 2020-07-20 23:37:31 -03:00
GrayJack
04d8dc4a10
# as Attribute
- Issue  #5453
2020-07-20 23:19:29 -03:00
GrayJack
462e0158da
@ as operator 2020-07-20 23:00:13 -03:00
Kirill Bulatov
54cc3fee45 Do not show default types in closures 2020-07-20 23:50:41 +03:00
bors[bot]
21b4e9178f
Merge #5440
5440: Minor perf tweaks per clippy r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-07-20 16:54:57 +00:00
GrayJack
a662228de4
Assingment semantic highlight 2020-07-20 12:36:23 -03:00
GrayJack
54ebb2ce30
Handle semantic highlight when STAR is part of the *{const, mut} 2020-07-20 11:21:40 -03:00
GrayJack
73bab32aef
Highlight more cases of SyntaxKind when it is a punctuation 2020-07-20 09:46:50 -03:00
Jeremy Kolb
17f4d27f12 Minor perf tweaks per clippy 2020-07-19 14:26:24 -04:00
Pascal Hertleif
5516476a86
Fix a typo in completion docs 2020-07-19 18:25:19 +02:00
bors[bot]
2777f8c295
Merge #5423
5423: Correctly resolve assoc. types in path bindings r=matklad a=jonas-schievink

Previously invoking goto def on `impl Iterator<Item<|> = ()>` would go to `Iterator`, not `Item`. This fixes that.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-07-17 17:02:28 +00:00
Aleksey Kladov
798f43da50 Fix out of bounds panic in active parameter 2020-07-17 15:44:37 +02:00
Jonas Schievink
cab360fe31 Correctly resolve assoc. types in path bindings 2020-07-17 14:58:49 +02:00
Aleksey Kladov
2c268b9a5f Move tests 2020-07-17 13:37:41 +02:00
bors[bot]
9b5ac1d82f
Merge #5417
5417: Mismatched arg count works for lambdas r=jonas-schievink a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-17 11:01:52 +00:00
Aleksey Kladov
d7548a36a7 Unclutter NavigationTarget API 2020-07-17 12:42:48 +02:00
Aleksey Kladov
393b7119bd Add test for fn pointers 2020-07-17 12:04:12 +02:00
Aleksey Kladov
371c5aec1c call_info works with closures 2020-07-17 12:04:10 +02:00
Aleksey Kladov
2729665235 Continue non-doc comments with trailing space 2020-07-17 11:20:28 +02:00
Aleksey Kladov
3823c2dc19 Remove FunctionSignature 2020-07-16 22:17:49 +02:00
Aleksey Kladov
a5ae8b8b92 Inlay hints use callables 2020-07-16 21:51:44 +02:00
Aleksey Kladov
edc0190f7a Rename 2020-07-16 21:33:11 +02:00
Aleksey Kladov
0265778e86 Don't use function signature for Display 2020-07-16 21:32:20 +02:00
Aleksey Kladov
6da22ed975 Redner self as param for call infor for assoc fn call 2020-07-16 18:24:26 +02:00
Aleksey Kladov
a4e9681c79 Better module structure 2020-07-16 18:13:43 +02:00
Aleksey Kladov
29832b8c3d Reduce visibility 2020-07-16 18:07:53 +02:00
Aleksey Kladov
ff0312fa32 Semantical call info 2020-07-16 18:03:04 +02:00
Aleksey Kladov
b5ce84b170 Align CallableDefId naming with other ids 2020-07-16 13:16:34 +02:00
Aleksey Kladov
1d6cf33663 Simplify 2020-07-16 11:37:26 +02:00
Aleksey Kladov
bb2613ed4d Move type 2020-07-16 10:29:21 +02:00
Aleksey Kladov
1d63b3efc9 simplify 2020-07-16 10:25:36 +02:00
Leander Tentrup
119e71d9ea Add new Punctuation highlight tag 2020-07-15 16:42:47 +02:00
Leander Tentrup
33832d43fc Highlight punctuation as HighlightTag::Operator 2020-07-15 16:40:38 +02:00
Aleksey Kladov
0908318171 Show fewer syntax errors 2020-07-15 16:06:04 +02:00
bors[bot]
6f3c8dc11d
Merge #5345
5345: Semantic Highlighting: Emit mutable modifier for 'self' when applicable r=matklad a=Veykril

This PR implements emitting the mutable modifier for the self keyword when applicable for semantic highlighting as mentioned in #5041. The rendered highlighting test html file:
![firefox_5lbsFNBqsT](https://user-images.githubusercontent.com/3757771/87346245-a5a07280-c551-11ea-9051-e5901255f8c9.png)
As you can see it does not emit the modifier when `self` is not used in a mutable context even if it is declared mutably in the enclosing function. I'm not sure if this is actually something wanted or not.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-07-15 10:00:10 +00:00
Aleksey Kladov
fac1b0def1 Off by one error when determining the active param
closes #3615
2020-07-15 10:14:23 +02:00
Aleksey Kladov
1f411f87ea Refactor CallInfo tests 2020-07-15 10:09:10 +02:00
Jonas Schievink
2163ceb7ef Fix classify_name_ref on multi-path macro calls 2020-07-14 17:23:33 +02:00
Aleksey Kladov
f7f4ea633b Don't duplicate parens in patterns 2020-07-14 13:51:43 +02:00
Aleksey Kladov
f823386db8 Add mark 2020-07-14 13:46:29 +02:00
Yuki Okushi
6f423466d1
Add a license field to all the crates 2020-07-14 10:57:26 +09:00
Lukas Wirth
91b35d8827 Semantic Highlighting: Emit mutable modifier for 'self' when applicable 2020-07-13 21:39:01 +02:00
Aleksei Trifonov
e78d468b22 Fix ignore attribute autocompletion 2020-07-12 11:17:15 +03:00
Aleksey Kladov
b34cdf7bf4 Implementations lens for unions
closes #4728
2020-07-11 22:53:31 +02:00
Aleksey Kladov
e1d6b7f7c4 Use dedicated semantic highlight tag for parameters
closes #5106
2020-07-11 14:51:41 +02:00
Aleksey Kladov
8c4919c9fd Fix goto definition for type alias type parameters
closes https://github.com/rust-analyzer/rust-analyzer/issues/5042
2020-07-11 12:45:30 +02:00
bors[bot]
6c1546c3a4
Merge #4996
4996: Correctly generate new struct field in file containing struct def r=matklad a=TimoFreiberg

WIP because the test doesn't pass.
Testing the fix by hand looked good, although quickfixes seem to not support setting the editor cursor yet, which i think we want for "generate missing defs from usage" fixes.


Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-07-11 09:51:31 +00:00
Aleksey Kladov
a36ff4a100 Speed up completion 2020-07-11 01:26:24 +02:00
Timo Freiberg
43079ba80d Correctly generate new struct field in file containing struct def 2020-07-10 19:16:41 +02:00
Aleksey Kladov
3558736582 Better name 2020-07-10 17:56:55 +02:00
Aleksey Kladov
2d20c8f218 Don't add braces after struct
Unit structs are a thing
2020-07-10 17:42:18 +02:00
Aleksey Kladov
e4983daa5e Better complete expression keywords 2020-07-10 17:41:43 +02:00