Commit Graph

892 Commits

Author SHA1 Message Date
Aleksey Kladov
171c176833 Run cargo fix 2018-10-15 19:55:32 +03:00
Aleksey Kladov
6605dbaff3 Switch to beta 2018-10-15 19:54:37 +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
bors[bot]
e031b65f93 Merge #110
110: Signature help r=matklad a=kjeremy

@matklad Once this is in shape I would like to add tests. I think a separate PR should be done for returning documentation information and markdown.

Fixes #102 

Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
2018-10-15 16:41:57 +00:00
bors[bot]
8cec1d9861 Merge #112
112: brush up docs r=matklad a=matklad

@kjeremy @aochagavia @DJMcNab anything else significant to add here?

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-14 22:15:25 +00:00
Aleksey Kladov
b8a96dcf14 Apply review suggestions 2018-10-15 01:14:47 +03:00
Aleksey Kladov
f77fdbc9d2 brush up docs 2018-10-15 01:05:18 +03:00
Muhammad Mominul Huque
33b378797c
Show how to generate code with error message 2018-10-14 20:58:53 +06:00
Muhammad Mominul Huque
114e9a2d74
create cli.rs and make the tests passing 2018-10-14 20:32:57 +06:00
Adolfo Ochagavía
2bc9e9f327 Improve tests 2018-10-13 21:33:15 +02: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
c9909f42ba A FnDescriptor shouldn't exist without a name 2018-10-12 07:54:57 -04:00
Jeremy A. Kolb
3ac5199755 Regenerate 2018-10-12 07:43:37 -04:00
Adolfo Ochagavía
ee0a6bf053 Fold multiline comments 2018-10-12 08:59:12 +02: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]
2ba6f18586 Merge #122
122: Use rustc-hash crate r=matklad a=mominul

Replace std's HashMap, HashSet with FxHashMap and FxHashSet.

Closes #121 

Thanks!

Co-authored-by: Muhammad Mominul Huque <mominul2082@gmail.com>
2018-10-11 18:28:44 +00:00
Muhammad Mominul Huque
dc2b30e9b6
Replace HashMap, HashSet with FxHashMap and FxHashSet 2018-10-12 00:07:44 +06: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
6fe77db413 Remove smart multiline comment join 2018-10-11 17:16:12 +02:00
Adolfo Ochagavía
92f5ca64ae Add tests 2018-10-11 17:11:59 +02:00
Adolfo Ochagavía
5508c91b3e Remove nesting 2018-10-11 16:45:52 +02:00
Adolfo Ochagavía
f88e13f539 Use Comment wrapper 2018-10-11 16:25:35 +02:00
bors[bot]
9b155c8976 Merge #118
118: Remove error publishing through publishDecorations r=matklad a=aochagavia

The errors are already reported by `publishDiagnostics`

Closes #109 

Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
2018-10-11 09:18:33 +00:00
bors[bot]
7e55aaeeed Merge #120
120: Cleanup grammar generation r=matklad a=ReinierMaas

31c8ebb743/crates/ra_syntax/src/ast/generated.rs (L207-L210)
Needed an additional newline before the `pub fn`.

Removing `-` for #114.
Runnning `cargo gen-kinds` to update grammar.

Co-authored-by: Reinier Maas <reiniermaas@users.noreply.github.com>
Co-authored-by: Reinier Maas <reiniermaas@hotmail.com>
2018-10-10 15:54:57 +00: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
Adolfo Ochagavía
edd162bda8 Report errors only once 2018-10-10 16:59:46 +02:00
Adolfo Ochagavía
26d34cc443 Remove error publishing through publishDecorations 2018-10-10 16:49:32 +02:00
Adolfo Ochagavía
27a86cb7df Collapse comments upon join 2018-10-10 12:37:06 +02:00
bors[bot]
3c41087bf8 Merge #115
115: Format vscode extension and add npm run fix r=matklad a=aochagavia



Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
2018-10-09 21:37:31 +00:00
Adolfo Ochagavía
f2d719b24a Format vscode extension and add npm run fix 2018-10-09 22:56:22 +02:00
bors[bot]
31c8ebb743 Merge #106
106: Add on-enter handler r=matklad a=matklad

Now, typing doc comments is much more pleasant

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-09 16:52:48 +00:00
Aleksey Kladov
2b956fd3a8 Add on-enter handler
Now, typing doc comments is much more pleasant
2018-10-09 19:52:06 +03:00
bors[bot]
14baf11bd4 Merge #111
111: gate on tslint r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-09 16:36:29 +00:00
Aleksey Kladov
f4e7617466 gate on tslint 2018-10-09 19:10:35 +03:00
bors[bot]
434e30e19f Merge #107
107: Switch to absolute offsets for extend comment word r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-10-09 16:06:43 +00:00
Aleksey Kladov
b7bd456101 don't gate on appveyor 2018-10-09 19:06:05 +03:00
Aleksey Kladov
5d1dae83a1 Switch to absolute offsets for extend comment word 2018-10-09 18:53:35 +03:00
Aleksey Kladov
91f99920bd Fix link to appveyor's CI 2018-10-09 18:29:25 +03:00
Aleksey Kladov
82447ecace
Merge pull request #108 from rust-analyzer/readme
fix readme
2018-10-09 16:21:00 +03:00
Aleksey Kladov
f17296e1c1 fix readme 2018-10-09 16:18:54 +03:00
Aleksey Kladov
239213a3db Prepare gen_lsp_server for publishing 2018-10-09 12:55:23 +03:00
bors[bot]
c9798c0e6d Merge #104
104: Add vscode extension to CI r=aochagavia a=DJMcNab

Note that this testing is only done on travis - we are only running formatting and linting, so feature parity on appveyor is not required.

CC @aochagavia.

Fixes? #100

Co-authored-by: Daniel McNab <36049421+djmcnab@users.noreply.github.com>
2018-10-09 06:16:36 +00:00
Daniel McNab
e26071d96e Run prettier on all files 2018-10-08 22:38:33 +01:00
Daniel McNab
3a405b65d6 Add tslint and prettier to ci 2018-10-08 22:36:47 +01:00
bors[bot]
f4ad36e972 Merge #103
103: WIP: refactor vscode extension r=aochagavia a=aochagavia

Todo:

- [x] Add more comments, so other people can find their way in the codebase
- [x] Resolve remaining tslint suggestions
- [ ] Integrate with CI

@matklad The standard configuration of tslint forbids using `console.log` and `console.error`. Is there any reason we are using those or can I remove them? If they are used for debugging purposes I would prefer to remove them and rely on vscode's excellent debugger.

Co-authored-by: Adolfo Ochagavía <aochagavia92@gmail.com>
2018-10-08 19:39:52 +00:00
Adolfo Ochagavía
bbf38b9e72 Add some comments 2018-10-08 20:55:22 +02:00
Adolfo Ochagavía
62b1b05a0d Fix remaining tslint suggestions 2018-10-08 20:18:55 +02:00
Aleksey Kladov
a05e09e9c5 Attach comments smartly 2018-10-08 17:36:38 +03:00