Commit graph

388 commits

Author SHA1 Message Date
Aleksey Kladov
1643d94a65 switch to TextRange::subrange 2018-10-30 21:26:55 +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
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
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