Commit graph

246 commits

Author SHA1 Message Date
Aleksey Kladov
072028e679 add macro-call node 2018-12-28 13:27:30 +03:00
dependabot[bot]
4017966a0b
Bump parking_lot from 0.6.4 to 0.7.0
Bumps [parking_lot](https://github.com/Amanieu/parking_lot) from 0.6.4 to 0.7.0.
- [Release notes](https://github.com/Amanieu/parking_lot/releases)
- [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Amanieu/parking_lot/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-27 13:14:24 +00:00
bors[bot]
d8bfad9e92 Merge #343 #344
343: Bump arrayvec from 0.4.9 to 0.4.10 r=matklad a=dependabot[bot]

Bumps [arrayvec](https://github.com/bluss/arrayvec) from 0.4.9 to 0.4.10.
<details>
<summary>Commits</summary>

- [`21661fa`](21661facf8) 0.4.10
- [`06930d2`](06930d27ce) FIX: Remove unused Copy/Clone for MaybeUninit
- [`85d9a06`](85d9a06a62) FIX: Use repr(C) MaybeUninit after discussion with RalfJung
- See full diff in [compare view](https://github.com/bluss/arrayvec/compare/0.4.9...0.4.10)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=arrayvec&package-manager=cargo&previous-version=0.4.9&new-version=0.4.10)](https://dependabot.com/compatibility-score.html?dependency-name=arrayvec&package-manager=cargo&previous-version=0.4.9&new-version=0.4.10)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

**Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.

You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com).

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>

344: Bump itertools from 0.7.11 to 0.8.0 r=matklad a=dependabot[bot]

Bumps [itertools](https://github.com/bluss/rust-itertools) from 0.7.11 to 0.8.0.
<details>
<summary>Commits</summary>

- [`cd0602a`](cd0602addc) 0.8.0
- [`5a8f2fd`](5a8f2fd5ed) MAINT: Require Rust 1.24 as minimum version
- [`4986d92`](4986d92d7f) DOC: Minor edits to module docs
- [`01f15a0`](01f15a0910) Merge [#288](https://github-redirect.dependabot.com/bluss/rust-itertools/issues/288)
- [`883d40a`](883d40a6ef) map_into method
- [`3bf265d`](3bf265d5b7) Merge pull request [#321](https://github-redirect.dependabot.com/bluss/rust-itertools/issues/321) from JohnHeitmann/master
- [`e820996`](e820996f64) Document the trait extension behavior of Itertools a bit more clearly
- [`44c9654`](44c9654fdb) Merge pull request [#318](https://github-redirect.dependabot.com/bluss/rust-itertools/issues/318) from bluss/std-deprecations
- [`d2e254f`](d2e254f22f) API: Fix the mystery deprecation message for Step
- [`602f2f6`](602f2f675e) API: Deprecate .foreach() in favour of std's .for_each()
- Additional commits viewable in [compare view](https://github.com/bluss/rust-itertools/compare/0.7.11...0.8.0)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=itertools&package-manager=cargo&previous-version=0.7.11&new-version=0.8.0)](https://dependabot.com/compatibility-score.html?dependency-name=itertools&package-manager=cargo&previous-version=0.7.11&new-version=0.8.0)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

**Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.

You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com).

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>

Co-authored-by: dependabot[bot] <support@dependabot.com>
2018-12-27 13:06:30 +00:00
dependabot[bot]
a400444e33
Bump itertools from 0.7.11 to 0.8.0
Bumps [itertools](https://github.com/bluss/rust-itertools) from 0.7.11 to 0.8.0.
- [Release notes](https://github.com/bluss/rust-itertools/releases)
- [Commits](https://github.com/bluss/rust-itertools/compare/0.7.11...0.8.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-27 12:32:23 +00:00
dependabot[bot]
6fb53caea5
Bump arrayvec from 0.4.9 to 0.4.10
Bumps [arrayvec](https://github.com/bluss/arrayvec) from 0.4.9 to 0.4.10.
- [Release notes](https://github.com/bluss/arrayvec/releases)
- [Commits](https://github.com/bluss/arrayvec/compare/0.4.9...0.4.10)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-27 12:32:18 +00:00
Aleksey Kladov
49b0fe20ab fix suffix ranges 2018-12-27 15:10:30 +03:00
Aleksey Kladov
a912b261d3 dump validation errors 2018-12-27 15:07:51 +03:00
Aleksey Kladov
359e70d1b2 support literal suffixes 2018-12-27 15:03:18 +03:00
Aleksey Kladov
73ded3c63c dedupe literal parsers 2018-12-27 14:42:46 +03:00
Florian Diebold
cdca397061 Add a hir::TypeRef as an intermediate between ast::TypeRef and ty::Ty 2018-12-25 21:14:13 +01:00
Florian Diebold
2870effd5c Implement reference / pointer types
- parse them
 - infer types of & and * expressions
2018-12-25 20:36:06 +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
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
ef67581104 Resolve paths to defs (functions currently) during type inference 2018-12-23 17:13:11 +01:00
Florian Diebold
93ffbf80c6 Make let statements kind of work 2018-12-23 14:01:50 +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
bors[bot]
e4d0930d9c Merge #316
316: Fix handling of nested self in paths r=matklad a=DJMcNab

See https://github.com/rust-analyzer/rust-analyzer/issues/231#issuecomment-442449505.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-21 23:19:14 +00:00
DJMcNab
1dffbe5c37 Remove TODO on self_hosting_parsing
This improving this code is not a good use of people-time, and this
might be the most performant approach nonwithstanding
an api for this use case being added to walkdir
2018-12-21 22:44:31 +00:00
DJMcNab
4dbf71d332 Remove uneeded todo in lexer 2018-12-21 22:41:09 +00:00
DJMcNab
d8d60215da Fix handling of nested self in paths 2018-12-21 22:29:59 +00:00
DJMcNab
bd5a358910 Fix where clauses using fully qualified path syntax 2018-12-21 17:20:38 +00:00
Aleksey Kladov
a5987bd715 show debug repr of literals 2018-12-21 18:49:52 +03:00
DJMcNab
9beee92500 Add comment about the source of the weird_exprs test 2018-12-21 10:03:02 +00:00
DJMcNab
da6be9fdda Add weird_exprs test 2018-12-20 19:47:29 +00:00
DJMcNab
55ebe449c9 Fix parsing of contextual_keyword union 2018-12-20 19:46:03 +00:00
DJMcNab
a349db7178 Run gen-tests 2018-12-20 19:10:37 +00:00
DJMcNab
1d1950336f Use a better way of skipping SEMIs 2018-12-20 19:07:11 +00:00
DJMcNab
dc1c64f5b9 Support a blank expression before a semicolon 2018-12-20 19:07:11 +00:00
DJMcNab
134fe4f566 Fix the tests and fix the precommit hook 2018-12-20 16:45:54 +00:00
DJMcNab
466885aa5b Fix missing DOTDOTEQs 2018-12-20 16:22:13 +00:00
DJMcNab
f35151afed Don't require a command before EQ in a where clause 2018-12-20 15:50:42 +00:00
DJMcNab
63ca8bc91a Change parser tests dir to inline/ok and inline/err 2018-12-20 15:09:22 +00:00
DJMcNab
e2a7e94518 Ensure that the parser tests pass or fail correctly 2018-12-20 13:33:00 +00:00
DJMcNab
27e814e182 Simplify NO_BLOCK testing 2018-12-20 12:28:59 +00:00
DJMcNab
5205c016e9 Fix ambiguity with if break
Brought up by #290
2018-12-20 11:35:02 +00:00
DJMcNab
a3b842fb8b Add tests and only traverse in the crates directory 2018-12-19 21:19:32 +00:00
DJMcNab
db67741430 Move is_block to lower in the call tree 2018-12-19 20:55:24 +00:00
DJMcNab
def0a95d35 Revert "Revert to f6f7c5"
This approach is correct, but it needs an addition to Restrictions too

This reverts commit ad00d0c8a5f64142e6636e8b048204c8f8982f4a.
2018-12-19 20:12:18 +00:00
DJMcNab
4dce66ad31 Fix handling of structs in match arms 2018-12-19 20:12:18 +00:00
DJMcNab
cd8e33fb7e Revert to f6f7c5 2018-12-19 20:12:18 +00:00
DJMcNab
7a8560ba38 Fix expression parsing by bailing out upon a macro block being found
TODO: Fix this when the block like macro is in expression position

E.g. `test(test!{})` currently parses
2018-12-19 20:12:18 +00:00
DJMcNab
97e70bf50f Possibly fix #225 2018-12-19 20:12:18 +00:00
DJMcNab
29bf389034 Actually fix at_ts doc comment (committed wrong file :P) 2018-12-19 20:12:18 +00:00
DJMcNab
012537bd6c Fix at_ts doc comment 2018-12-19 20:12:18 +00:00
DJMcNab
20bbe0127c Fix parsing of inclusive ranges (#214)
I'm not certain that this is correct, so extra eyes would be good
2018-12-19 20:12:18 +00:00
DJMcNab
0b77eec922 Add a test to ensure that we can parse each file
Note that this has a non-spurious failure in ra_analysis/src/mock_analysis
2018-12-19 20:12:18 +00:00
Roland Ruckerbauer
d0f1334226 Fixed cast expression parsing in ra_syntax.
The cast expression expected any type via types::type_() function,
but the language spec does only allow TypeNoBounds (types without direct extra bounds
via `+`).

**Example:**

```rust
fn test() {
	6i8 as i32 + 5;
}
```

This fails, because the types::type_() function which should parse the type after the
as keyword is greedy, and takes all plus sign after path types as extra.

My proposed fix is to replace the not implemented `type_no_plus()` just calls (`type_()`)
function, which is used at several places. The replacement is `type_with_bounds_cond(p: &mut Parser, allow_bounds: bool)`, which passes the condition to relevant sub-parsers.

This function is then called by `type_()` and the new public `type_no_bounds()`.
2018-12-17 17:26:24 +01:00
Bernardo
0527e3b283 rename Edit to TextEdit and AtomEdit to AtomTextEdit 2018-12-11 19:07:17 +01:00
Bernardo
7344d28768 extract AtomEdit and Edit into new ra_text_edit crate 2018-12-10 22:09:12 +01:00
Aleksey Kladov
4cbc902fcc grand module rename 2018-12-08 19:30:35 +03:00
DJMcNab
f88e0700e6 Add a better text for hover and stop duplicating work done in approximatelly_resolve_symbol 2018-12-08 19:28:10 +03:00
DJMcNab
89cf7d8743 Clarify and correct comment about multi_byte_tokens 2018-12-08 19:28:10 +03:00
Florian Diebold
1dfd06fc8a Use json comparison code from cargo for heavy tests 2018-12-06 21:32:15 +01:00
Aleksey Kladov
28ddecf6c9 modernize even more 2018-12-06 21:16:37 +03:00
Aleksey Kladov
1761a7d213 modernize some files 2018-12-06 20:49:36 +03:00
bors[bot]
25cf2349ab Merge #256
256: Improve/add use_item documentation r=matklad a=DJMcNab

Adds some documentation to use_item explaining all code paths (use imports are hard, especially with the ongoing discussion of anchored v. uniform paths - see https://github.com/rust-lang/rust/issues/55618 for what appears to be the latest developments)

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-06 17:30:36 +00:00
DJMcNab
455ef940fe Update use path test 2018-12-05 22:08:00 +00:00
DJMcNab
5da245ec33 Fix a copy and pasting typo 2018-12-05 21:46:43 +00:00
DJMcNab
0a82d768c4 Improve/add the use_item documentation 2018-12-05 21:43:40 +00:00
Aleksey Kladov
ebc4e75253 switch back to the latest beta 2018-11-24 21:52:49 +03:00
Aleksey Kladov
edeec6a414 Complete paths after :: 2018-11-21 18:34:20 +03:00
Aleksey Kladov
bcdcfa9df2 Some import resolution boilerplate 2018-11-20 19:24:58 +03:00
Adolfo Ochagavía
c96bfe7e2d Split string lexing and run rustfmt 2018-11-11 21:00:31 +01:00
Adolfo Ochagavía
30cd4d5acb Validate byte string literals 2018-11-11 20:41:43 +01:00
Adolfo Ochagavía
c258b4fdb0 Add validator for byte 2018-11-11 20:27:00 +01:00
Adolfo Ochagavía
3b4c02c19e Validate string literals 2018-11-09 14:52:17 +01:00
Aleksey Kladov
6d253b58da Complete paths in use trees 2018-11-07 21:38:41 +03:00
Aleksey Kladov
2ed1514df3 rename ROOT -> SOURCE_FILE 2018-11-07 18:42:36 +03:00
Aleksey Kladov
f8b36bbc3b Rename File -> SourceFileNode 2018-11-07 18:42:36 +03:00
Jeremy A. Kolb
6df71da81f Add some more DocCommentsOwner 2018-11-07 18:24:55 +03:00
bors[bot]
2e2445444a Merge #207
207: Finish implementing char validation r=aochagavia a=aochagavia

The only thing missing right now are good integration tests (and maybe more descriptive error messages)

Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-11-07 11:09:40 +00:00
Adolfo Ochagavía
433a806191 Fix backslash escape 2018-11-07 12:04:26 +01:00
Adolfo Ochagavía
3b2ba59526 Use ArrayString instead of hand rolled data structure 2018-11-07 11:58:34 +01:00
Adolfo Ochagavía
e37ba706cc cargo format 2018-11-07 11:41:42 +01:00
Adolfo Ochagavía
94796e6447 Add lots of tests 2018-11-07 11:35:33 +01:00
Adolfo Ochagavía
fdb9f06880 Store hex digits in a stack-allocated buffer 2018-11-07 10:40:58 +01:00
Aleksey Kladov
8eaf7952ae ra_syntax::File is just RootNode 2018-11-06 23:26:26 +03:00
Aleksey Kladov
7f88fe8790 Add a pinch of comments 2018-11-06 22:06:58 +03:00
Aleksey Kladov
a5301e94d5 Generalize Owned nodes 2018-11-06 21:52:00 +03:00
Aleksey Kladov
ec131b6c7b grammar: fix where clause parsing
closes #205
2018-11-06 21:19:32 +03:00
Aleksey Kladov
dafe747dcc upstream basic tree algorithms to rowan 2018-11-06 20:56:32 +03:00
Adolfo Ochagavía
c56db92d1f Finish implementing char validation 2018-11-06 17:07:27 +01:00
bors[bot]
f605f6e70a Merge #188
188: Introduce `SyntaxErrorKind` and `TextRange` to `SyntaxError` r=matklad a=aochagavia



Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-11-05 21:32:25 +00:00
Adolfo Ochagavía
59405bfe4a cargo format 2018-11-05 22:29:33 +01:00
Adolfo Ochagavía
fda8ddc5fe Introduce Location and make SyntaxError fields private 2018-11-05 18:38:34 +01:00
Aleksey Kladov
43665eb166 bring back testutils 2018-11-05 15:56:07 +03:00
Aleksey Kladov
8e8f52e80a add description 2018-11-05 15:52:22 +03:00
Aleksey Kladov
80e50cae00 Switch ra_syntax to 2015 edition 2018-11-05 15:47:59 +03:00
Aleksey Kladov
6502bd2c96 reduce code duplication 2018-11-05 11:39:51 +03:00
Aleksey Kladov
9010cb9839 grammar: for predicates in where
closes #191
2018-11-05 11:24:08 +03:00
Adolfo Ochagavía
3b42ddae60 Introduce SyntaxErrorKind and TextRange in SyntaxError 2018-11-04 21:16:38 +01:00
Adolfo Ochagavía
9b5bbab104 Add character literal parsing and validation 2018-11-04 15:17:24 +01:00
Aleksey Kladov
cca5f862de Don't order import alphabetical
alphabetical ordering is no more consistent, and much less useful then
the ordering which arises naturally when you add import.
2018-11-01 16:18:53 +03:00
Aleksey Kladov
d685a9b564 Use From to get an owned AST 2018-11-01 13:41:20 +03:00
Jeremy A. Kolb
61580f3cb8 Remove DOC_COMMENT
Closes #166
2018-10-31 17:38:18 -04:00
Aleksey Kladov
6be50f7d5d Reformat all 2018-10-31 23:41:43 +03:00
Jeremy A. Kolb
d2bcd1a386 ast::DocCommentsOwner which represents a documentation comment owner 2018-10-31 15:08:37 -04:00
Aleksey Kladov
b67295134b Move FnDescriptors to analyzer 2018-10-31 10:56:31 +03:00
Aleksey Kladov
3068af79ff Introduce owned ast nodes
ast::FooNode is an owned 'static counterpart to ast::Foo<'a>
2018-10-31 10:29:32 +03:00
Aleksey Kladov
1643d94a65 switch to TextRange::subrange 2018-10-30 21:26:55 +03:00
Aleksey Kladov
950e8b8182 introduce syntax-ptr 2018-10-30 21:23:23 +03:00
Aleksey Kladov
69d07df201 Complete crate:: paths 2018-10-24 18:37:25 +03:00
Alan Du
a5da770ec6 Fix function calls 2018-10-17 19:42:23 -04:00
Alan Du
fc8024de51 clippy: type_complexity 2018-10-17 19:42:23 -04:00
Alan Du
4e8ea94e2b Remove Copy trait on LeafAtOffset
Because it's a stateful iterator, it's easier to explicitly clone it
when necesary.

Fixes clippy:clone_on_copy
2018-10-17 19:42:23 -04:00
Alan Du
d493a4476c clippy: Use if lets and remove redundant returns 2018-10-17 19:42:23 -04:00
Aleksey Kladov
00cdde2c52 Update rowan 2018-10-17 19:52:25 +03:00
Aleksey Kladov
2f4a248f80 rename gen-kinds to gen-syntax 2018-10-16 21:17:19 +03:00
Jeremy A. Kolb
61f3a438d3 Cargo Format
Run `cargo fmt` and ignore generated files
2018-10-16 09:41:10 -04:00
Aleksey Kladov
d8aee31a60 start salsa migration 2018-10-15 21:19:49 +03:00
Aleksey Kladov
9a98d8e99a regenerate 2018-10-15 20:54:07 +03:00
Aleksey Kladov
376639c70f Parse crate paths in expressions 2018-10-15 20:52:56 +03:00
Aleksey Kladov
9434920648 switch base crates to 2018 2018-10-15 20:00:54 +03:00
Aleksey Kladov
171c176833 Run cargo fix 2018-10-15 19:55:32 +03:00
bors[bot]
a230b438e0 Merge #127
127: Improve folding r=matklad a=aochagavia

I was messing around with adding support for multiline comments in folding and ended up changing a bunch of other things. 

First of all, I am not convinced of folding groups of successive items. For instance, I don't see why it is worthwhile to be able to fold something like the following:

```rust
use foo;
use bar;
```

Furthermore, this causes problems if you want to fold a multiline import:

```rust
use foo::{
  quux
};
use bar;
```

The problem is that now there are two possible folds at the same position: we could fold the first use or we could fold the import group. IMO, the only place where folding groups makes sense is when folding comments. Therefore I have **removed folding import groups in favor of folding multiline imports**.

Regarding folding comments, I made it a bit more robust by requiring that comments can only be folded if they have the same flavor. So if you have a bunch of `//` comments followed by `//!` comments, you will get two separate fold groups instead of a single one.

Finally, I rewrote the API in such a way that it should be trivial to add new folds. You only need to:

* Create a new FoldKind
* Add it to the `fold_kind` function that converts from `SyntaxKind` to `FoldKind`

Fixes #113 

Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-10-15 16:48:17 +00:00
Adolfo Ochagavía
c5069eeef5 Only fold groups of similar comments 2018-10-13 15:37:44 +02:00
Adolfo Ochagavía
4b3737510b Cleanup fold code and split logic to fold single elements 2018-10-12 19:20:58 +02:00
Jeremy A. Kolb
3ac5199755 Regenerate 2018-10-12 07:43:37 -04:00
Jeremy A. Kolb
f8a2b53304 Language Server: textDocument/signatureHelp
Implements a pretty barebones function signature help mechanism in
the language server.

Users can use `Analysis::resolve_callback()` to get basic information
about a call site.

Fixes #102
2018-10-11 16:40:46 -04:00
bors[bot]
77e9bf9b5f Merge #116
116: Collapse comments upon join r=matklad a=aochagavia

Todo:

- [x] Write tests
- [x] Resolve fixmes
- [x] Implement `comment_start_length` using the parser

I left a bunch of questions as fixmes. Can someone take a look at them? Also, I would love to use the parser to calculate the length of the leading characters in a comment (`//`, `///`, `//!`, `/*`), so any hints are greatly appreciated.

Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
Co-authored-by: Adolfo Ochagavía <github@adolfo.ochagavia.xyz>
2018-10-11 15:43:34 +00:00
Adolfo Ochagavía
f88e13f539 Use Comment wrapper 2018-10-11 16:25:35 +02:00
Reinier Maas
6abecf76e5 Update crates/ra_syntax/src/ast/generated.rs
effect of running cargo gen-kinds
2018-10-10 17:26:01 +02:00
Reinier Maas
c579b47b4a
Update generated.rs.tera
Removing `-` for #114
2018-10-10 17:18:21 +02:00
Aleksey Kladov
a05e09e9c5 Attach comments smartly 2018-10-08 17:36:38 +03:00
Aleksey Kladov
b642e6c645 replace loop with iterators 2018-10-08 15:46:14 +03:00
Aleksey Kladov
86a7ac2d31 Simplify event processing 2018-10-08 15:44:00 +03:00
Daniel McNab
80eefcbc05 Add cargo gen-kinds documentation 2018-10-04 21:43:58 +01:00
bors[bot]
7a025ad201 Merge #93
93: Support leading pipe in match arms r=matklad a=DJMcNab

This adds support for match arms of the form:
```rust
<...>
| X | Y => <...>,
| X => <...>,
| 1..2 => <...>,
etc
```

# Implementation discussion

This just naïvely 'eats' a leading pipe if one is available. The equivalent line in the reference `libsyntax` is in [`parse_arm`](441519536c/src/libsyntax/parse/parser.rs (L3552)).

As noted in the comment linked above, this feature was formally introduced as a result of rust-lang/rfcs#1925. This feature is in active use in the [`rust-analyzer` codebase](c87fcb4ea5/crates/ra_syntax/src/syntax_kinds/generated.rs (L231))

I have added some tests for this feature, but maybe more would be required

EDIT: Always looking for feedback - is this PR description over-engineered?

Co-authored-by: Daniel McNab <36049421+djmcnab@users.noreply.github.com>
2018-10-04 07:02:19 +00:00
Daniel McNab
a55ef9b3ed Support leading pipe in match arms 2018-10-03 21:47:03 +01:00
Aleksey Kladov
1a2a8dec14 Make siblings an inherent method 2018-10-02 18:14:33 +03:00
Aleksey Kladov
d323c81d5c make ancestors and descendants inherent 2018-10-02 18:02:57 +03:00
Aleksey Kladov
dccaa5e45e use aliases 2018-10-02 17:50:56 +03:00
Aleksey Kladov
a261a1836b Move to rowan for syntax tree impl 2018-10-02 17:09:23 +03:00
Aleksey Kladov
baaf027da0 support 2018 paths 2018-09-29 14:53:23 +03:00
csmoe
8b710e9535 generate testsuite for impl_type 2018-09-26 16:53:16 +08:00
csmoe
edf1cc3582 parse impl type 2018-09-25 22:21:16 +08:00
csmoe
cacb32d88a reject impl keyword in impl header 2018-09-24 11:44:43 +08:00
csmoe
e446316585 add test for impl recovery 2018-09-24 11:44:43 +08:00
Aleksey Kladov
d6c7030aeb Add emacs function for extend shirnk selection 2018-09-19 00:46:10 +03:00
Aleksey Kladov
b5021411a8 rename all things 2018-09-16 13:07:39 +03:00