Commit graph

1126 commits

Author SHA1 Message Date
Aleksey Kladov
1a860dba38 simplify 2018-12-28 20:45:58 +03:00
Aleksey Kladov
5299a35e3d extend selection works with macros 2018-12-28 20:33:39 +03:00
bors[bot]
7a268b9b96 Merge #350
350: Super simple macro support r=matklad a=matklad

Super simple support for macros, mostly for figuring out how to fit them into the current architecture. Expansion is hard-coded and string based (mid-term, we should try to copy-paste macro-by-example expander from rustc). 

Ideally, we should handle

* highlighting inside the macro (done)
* extend selection inside the macro 
* completion inside the macro
* indexing structs, produced by the macro

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-28 16:17:19 +00:00
Aleksey Kladov
13631a2955 ⬆️ salsa 2018-12-28 19:10:31 +03:00
Aleksey Kladov
b911ee542b move macro to a separate module 2018-12-28 18:21:30 +03:00
Aleksey Kladov
fd33c89207 switch to FileRange 2018-12-28 18:17:43 +03:00
Aleksey Kladov
02924174bb introduce FileRange 2018-12-28 18:17:43 +03:00
Aleksey Kladov
d7440a5f49 highlight macro idents 2018-12-28 18:17:43 +03:00
Aleksey Kladov
406505e096 super simplistic macro expansion 2018-12-28 16:59:58 +03:00
Aleksey Kladov
072028e679 add macro-call node 2018-12-28 13:27:30 +03:00
Aleksey Kladov
dc496d0516 move highlightning to a separate file 2018-12-28 13:14:39 +03:00
dependabot[bot]
626badc30a
Bump serde from 1.0.82 to 1.0.83
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.82 to 1.0.83.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.82...v1.0.83)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-28 06:08:30 +00:00
Aleksey Kladov
bc833216d7 simplify 2018-12-28 00:08:33 +03:00
Aleksey Kladov
58a631f39a dead code 2018-12-28 00:01:56 +03:00
Aleksey Kladov
dddbac6877 remove FnId 2018-12-27 23:51:44 +03:00
Aleksey Kladov
e066050671 use names everywhere 2018-12-27 21:21:10 +03:00
Aleksey Kladov
63f54d234f dont leak Name details in testing 2018-12-27 21:02:08 +03:00
Aleksey Kladov
a9f55029b9 introduce known names 2018-12-27 20:26:15 +03:00
Aleksey Kladov
d963042ca9 introduce hir::Name 2018-12-27 20:07:21 +03:00
Aleksey Kladov
e4de2c8d7f add function to completion ctx 2018-12-27 17:33:52 +03:00
bors[bot]
7a1ed6400d Merge #341
341: Bump languageserver-types from 0.53.0 to 0.53.1 r=matklad a=dependabot[bot]

Bumps [languageserver-types](https://github.com/gluon-lang/languageserver-types) from 0.53.0 to 0.53.1.
<details>
<summary>Commits</summary>

- [`1a6c6c1`](1a6c6c18fc) (cargo-release) version 0.53.1
- [`5591192`](5591192047) Merge pull request [#88](https://github-redirect.dependabot.com/gluon-lang/languageserver-types/issues/88) from Xanewok/hover-clone
- [`c78120b`](c78120bf28) Add `Clone` impl for HoverContents and related
- See full diff in [compare view](https://github.com/gluon-lang/languageserver-types/compare/v0.53.0...v0.53.1)
</details>
<br />

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

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:38:15 +00:00
dependabot[bot]
74f342648d
Bump languageserver-types from 0.53.0 to 0.53.1
Bumps [languageserver-types](https://github.com/gluon-lang/languageserver-types) from 0.53.0 to 0.53.1.
- [Release notes](https://github.com/gluon-lang/languageserver-types/releases)
- [Changelog](https://github.com/gluon-lang/languageserver-types/blob/master/release.toml)
- [Commits](https://github.com/gluon-lang/languageserver-types/compare/v0.53.0...v0.53.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-27 13:15:04 +00: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
bors[bot]
e422c2e2f4 Merge #325
325: implement translate_offset_with_edit r=matklad a=vemoo

- Implement `translate_offset_with_edit` to resolve #105 
- Add proptest impls for text, offsets and edits and use them in tests for `translate_offset_with_edit` and `LineIndex`
- Added benchmark for `translate_offset_with_edit`

Co-authored-by: Bernardo <berublan@gmail.com>
2018-12-27 12:19:19 +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
Aleksey Kladov
8c2c1bf9eb check edits in diagnostics 2018-12-27 13:35:08 +03:00
bors[bot]
1d6dcef5c5 Merge #332
332: Struct types r=matklad a=flodiebold

Infer types for struct fields, and add basic field completions. There's also some code for enums, but I focused on getting structs working.

There's still ways to go before this becomes useful: There's no autoderef (or even reference types) and no inference for `self`, for example.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2018-12-27 10:08:34 +00:00
Aleksey Kladov
93996fecdc add cancelation module & cancelation backtraces 2018-12-27 13:03:32 +03:00
Aleksey Kladov
62c40b0e91 fix the test 2018-12-27 12:54:59 +03:00
Aleksey Kladov
4e2dffd798 expose make_pub_crate action 2018-12-27 12:35:40 +03:00
gfreezy
cd60998b9b fix use std::{self} 2018-12-27 00:51:27 +08:00
Florian Diebold
bc745a1396 Resolve field types lazily
I.e. not already when getting the HIR for the struct.
2018-12-25 21:40:33 +01:00
Bernardo
1cda43aafd test code and dependency cleanup 2018-12-25 21:26:36 +01: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
Bernardo
e9c186e48a change to TextEdit to avoid allocation and sort
rename newline to step where applicable
2018-12-25 20:49:18 +01:00
Florian Diebold
2870effd5c Implement reference / pointer types
- parse them
 - infer types of & and * expressions
2018-12-25 20:36:06 +01:00
Bernardo
863ed19946 remove benchmark and simplify tests 2018-12-25 20:14:27 +01:00
Bernardo
6b2da4e547 use new translate_offset_with_edit for TryConvWith
doc comments
2018-12-25 20:06:49 +01:00
Bernardo
aff0124b37 add line_index proptest 2018-12-25 20:03:14 +01:00
Bernardo
c886b72dab make criterion args work, small simplification 2018-12-25 20:03:14 +01:00
Bernardo
dc2afae991 fix arbitrary offset generation, col translation working 2018-12-25 20:03:14 +01:00
Bernardo
5c8525ce4a column translation implemented but not quite working yet 2018-12-25 20:03:14 +01:00
Bernardo
36f2b1f3b9 iterate over Steps which are either, newlines or multibyte chars 2018-12-25 20:03:14 +01:00
Bernardo
1c44ba0f04 simplify newline check with macro 2018-12-25 20:03:14 +01:00
Bernardo
d6312085a1 remove slower impl, add benchmarks 2018-12-25 20:03:14 +01:00
Bernardo
a005d2a614 final iteration, faster a bit simpler
the main thing is we iterate over inserted newlines at once for each edit
2018-12-25 19:59:02 +01:00
Bernardo
7299df8409 simplified version 2018-12-25 19:59:02 +01:00
Bernardo
8c9df62c1c move translate_offset_with_edit to ra_editor 2018-12-25 19:59:02 +01:00
Bernardo
881c29192d initial newline translation working
todo:
cleanup, simplify
handle columns
2018-12-25 19:55:05 +01:00
Bernardo
d951979159 test translate_offset_with_edit against simple impl for single edits 2018-12-25 19:49:55 +01:00
Bernardo
dee426e1b1 simplify and reduce number of values explored 2018-12-25 19:45:21 +01:00
Bernardo
3d98744c2a proptest strategies for TextUnit and AtomTextEdit 2018-12-25 19:45:21 +01:00
gfreezy
16996e9947 fix tests 2018-12-26 01:00:27 +08:00
Florian Diebold
b96d361239 Handle structs/enums with missing names a bit better 2018-12-25 17:55:50 +01:00
gfreezy
72eb9de747 add fix for removing unnecessary braces in use statements 2018-12-26 00:45:13 +08:00
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
Aleksey Kladov
8d49c098a5 cancelled is not Copy 2018-12-25 13:36:39 +03: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
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
Aleksey Kladov
5c7e8f47a8 less chatty logging 2018-12-22 15:09:08 +03:00
Aleksey Kladov
90f20f8c53 less verbose debug 2018-12-22 12:38:24 +03:00
Aleksey Kladov
94241cec04 less verbose debug for library data 2018-12-22 11:57:42 +03:00
Aleksey Kladov
2639997973 log times 2018-12-22 11:53:20 +03:00
Aleksey Kladov
49e746b010 completion uses hir scopes 2018-12-22 11:01:03 +03:00
gfreezy
0267df3815 not visit the same crateId only once 2018-12-22 15:30:58 +08:00
bors[bot]
4e4ca27eab Merge #319
319: Completion icons r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-21 23:28:47 +00:00
Aleksey Kladov
ea763c73b8 fix snippet icon 2018-12-22 02:28:09 +03:00
Aleksey Kladov
498e3a6846 binding icon 2018-12-22 02:24:59 +03:00
Aleksey Kladov
8e056ef042 debug pring 2018-12-22 02:23:25 +03:00
Aleksey Kladov
97cb463c9b moar icons 2018-12-22 02:20:14 +03: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
Aleksey Kladov
238b52358d more icons 2018-12-22 02:03:18 +03:00
DJMcNab
bb1ee2f13a Move the self handling from directly inside the loop 2018-12-21 23:01:16 +00:00
Aleksey Kladov
f1f2804c71 move completion items to conv 2018-12-22 01:59:32 +03: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
Aleksey Kladov
328d123f5b specify completion item kind 2018-12-22 01:42:26 +03:00
Aleksey Kladov
284e894069 cleanup 2018-12-22 01:42:26 +03:00
Aleksey Kladov
25dda42f37 introduce ComletionItemKind 2018-12-22 01:42:26 +03:00
Aleksey Kladov
ebb584ce66 rename completion kind 2018-12-22 01:42:26 +03: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
bors[bot]
184665ff9b Merge #315
315: Split completion into manageable components r=matklad a=matklad

The main idea here is to do completion in two phases:

* first, we figure out surrounding context
* then, we run a series of completers on the given context. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-21 22:04:32 +00:00
Aleksey Kladov
2ae87ffc9a cleanup 2018-12-22 01:03:58 +03:00
Aleksey Kladov
a8e04a7028 docs 2018-12-22 01:01:40 +03:00
Aleksey Kladov
200cc0a1e3 rename tests 2018-12-22 00:55:20 +03:00
Aleksey Kladov
ccca5aae43 scope-based copmletions on original file 2018-12-22 00:52:02 +03:00
Aleksey Kladov
2136e75c0b move path completion to a separate component 2018-12-21 23:04:56 +03:00
Aleksey Kladov
2351308d92 remove explicit serde_derive 2018-12-21 22:39:59 +03:00
Aleksey Kladov
67ac0a423f join lines collapses use_trees 2018-12-21 21:06:01 +03:00
Aleksey Kladov
cbe67339df more completion components 2018-12-21 20:55:00 +03:00
Aleksey Kladov
c2bf174e9c Start splitting completion into components 2018-12-21 20:25:29 +03:00
DJMcNab
bd5a358910 Fix where clauses using fully qualified path syntax 2018-12-21 17:20:38 +00:00
DJMcNab
380733d6d0 Undo the previous mistaken change and make publish_decorations optional
See https://github.com/Microsoft/language-server-protocol/issues/567
for motivations to not require `InitializationOptions`

TODO: Check if there are any other protocol extensions
which should be disabled if not implemented on the client
2018-12-21 17:00:31 +00:00
Aleksey Kladov
e086cc8db5 hide empty changes 2018-12-21 19:13:26 +03:00
Aleksey Kladov
12810b93c5 wip 2018-12-21 19:10:07 +03:00
Aleksey Kladov
9de3a45be6 add tests for pd 2018-12-21 18:53:00 +03:00
Aleksey Kladov
a5987bd715 show debug repr of literals 2018-12-21 18:49:52 +03:00
Aleksey Kladov
45232dfa68 organize completion tests better 2018-12-21 18:13:21 +03:00
gfreezy
66d15bb2da add #[cfg(test)] 2018-12-21 22:45:38 +08:00
gfreezy
77eaa208ed rename to dfs_find 2018-12-21 22:30:41 +08:00
gfreezy
792dabc0a6 When constructing a crate graph, detect and forbid cycles.
fixed #300
2018-12-21 22:27:04 +08:00
Aleksey Kladov
d4ef07b235 use completions in API 2018-12-21 15:50:07 +03:00
Aleksey Kladov
ba0072401c use Completions to collect completions 2018-12-21 15:46:01 +03:00
Aleksey Kladov
052e20162a docs 2018-12-21 15:34:11 +03:00
Aleksey Kladov
0ce82516c1 introduce Completions 2018-12-21 15:32:29 +03:00
Aleksey Kladov
4092b8d0b5 make compleion item details private 2018-12-21 15:19:46 +03:00
Aleksey Kladov
b5c5995bf1 use builder interface for completion item 2018-12-21 14:38:41 +03:00
Aleksey Kladov
b0ff6176ed flip params 2018-12-21 14:02:51 +03:00
Aleksey Kladov
74406ca8ea introduce completion_item module 2018-12-21 14:02:14 +03:00
bors[bot]
463e5af3f2 Merge #306
306: Finish weird exprs r=DJMcNab a=DJMcNab

Fix #290.

Note that I'm not certain my use of `p.nth(1) == Ident` is entirely consistent with `libsyntax` - in the original, [`is_union_item`](9622f9dc47/src/libsyntax/parse/parser.rs (L4593-L4596)) uses `t.is_ident() && !t.is_reserved_ident()`, whereas we effectively only do `is_ident`. However, I cannot find the definition of `is_reserved_ident` (even searching the rust repository only gives uses, no definitions), so this will have to do unless someone else can find it :|.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-21 10:04:00 +00:00
DJMcNab
9beee92500 Add comment about the source of the weird_exprs test 2018-12-21 10:03:02 +00:00
Aleksey Kladov
fd927ea3a9 use root-relative paths 2018-12-21 12:30:28 +03:00
Aleksey Kladov
b5b44659a4 edits use source-root API 2018-12-21 12:18:14 +03:00
Aleksey Kladov
0063f03e86 hide atom edits a bit 2018-12-21 11:52:32 +03:00
Aleksey Kladov
164d53b22f better debug impls 2018-12-21 11:49:18 +03:00
Aleksey Kladov
aa628f4749 fix SourceFileEdit name 2018-12-21 11:15:23 +03:00
Aleksey Kladov
b7d8bf1262 tweak canceled message 2018-12-21 11:08:43 +03:00
bors[bot]
f1fafeee02 Merge #305 #307
305: Fold curly blocks r=matklad a=matklad



307: ⬆️ 1.31.1 r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-20 19:58:10 +00:00
Aleksey Kladov
2956e81295 ⬆️ 1.31.1 2018-12-20 22:57:38 +03: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
Aleksey Kladov
23b040962f fold curly blocks 2018-12-20 22:43:06 +03:00
Aleksey Kladov
8d7e8a175e generalize folding tests
By using xml-like tags, we will be able to test nested foldings.
2018-12-20 22:30:30 +03: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
0ffba1e896 Fix broken test is deleted comment 2018-12-20 17:29:26 +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
84ff52390d Rename test_fail to test_err 2018-12-20 15:09:57 +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
bors[bot]
346456f59f Merge #301
301: Fix break in a condition r=matklad a=DJMcNab

The part of fixing #290.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-20 12:41:55 +00:00
DJMcNab
27e814e182 Simplify NO_BLOCK testing 2018-12-20 12:28:59 +00:00
DJMcNab
70e5fb98a0 Disable highlighting if disabled
This isn't working properly because we don't dynamically disable or enable it

TODO: work out why highlighting can be enabled mid session.

TODO: Improve settings handling
2018-12-20 12:16:44 +00:00
Aleksey Kladov
c96011833c extend comment 2018-12-20 14:35:37 +03:00
DJMcNab
5205c016e9 Fix ambiguity with if break
Brought up by #290
2018-12-20 11:35:02 +00:00
Aleksey Kladov
bb2bafb606 docs for input queries 2018-12-20 14:12:47 +03:00
bors[bot]
d8c6b8d999 Merge #297
297: Use ContentModified error code r=matklad a=matklad

25679c2e4b

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-20 09:23:27 +00:00
Aleksey Kladov
b2f2621c17 Use ContentModified error code
25679c2e4b
2018-12-20 12:20:28 +03:00
Aleksey Kladov
a084412f06 set symbol index as const 2018-12-20 12:15:38 +03:00
Aleksey Kladov
6782fe2a5b Treat 2018-12-20 12:15:38 +03:00
Aleksey Kladov
97812c192a Restore library symbols 2018-12-20 12:15:38 +03:00
Aleksey Kladov
2d4582bfc6 fixme comment 2018-12-20 12:15:38 +03:00
Aleksey Kladov
2caac99ef3 resolve paths across crates 2018-12-20 12:15:38 +03:00
Aleksey Kladov
590bd5f849 workaround across-crate resolve bugs 2018-12-20 12:15:38 +03:00
Aleksey Kladov
2fe41574a1 fix tests 2018-12-20 12:15:38 +03:00
Aleksey Kladov
e6465e7e2a index all local crates 2018-12-20 12:15:38 +03:00
Aleksey Kladov
51fec4ef84 fix the test 2018-12-20 12:15:38 +03:00
Aleksey Kladov
1b946ef8a6 File can be opened before the root is scanned 2018-12-20 12:15:38 +03:00
Aleksey Kladov
7b6bafa631 fix syc 2018-12-20 12:15:38 +03:00
Aleksey Kladov
a5ef8ad05b swtich lsp server to vfs 2018-12-20 12:15:38 +03:00
Aleksey Kladov
6a755ed83a remove more imports 2018-12-20 12:15:38 +03:00
Aleksey Kladov
79596abcaf dead import 2018-12-20 12:15:38 +03:00
Aleksey Kladov
26dcc70129 fix hir mock 2018-12-20 12:15:38 +03:00
Aleksey Kladov
18aac1df45 kill file resolver 2018-12-20 12:15:38 +03:00
Aleksey Kladov
85290bc134 switch analysis to vfs 2018-12-20 12:15:38 +03:00
Aleksey Kladov
815a0e5778 doc comment 2018-12-20 12:15:38 +03:00
Aleksey Kladov
d0bab735c8 add root & path info to remove event 2018-12-20 12:15:38 +03:00
Aleksey Kladov
b6ce7a6d34 make it compile 2018-12-20 12:15:38 +03:00
Aleksey Kladov
dea1a69e1c remove relpath from input 2018-12-20 12:15:38 +03:00
Aleksey Kladov
cb6205c09d use relpaths for module resolve 2018-12-20 12:15:38 +03:00
Aleksey Kladov
a422d480a1 implement vfs events handling 2018-12-20 12:15:38 +03:00
Aleksey Kladov
e69b05781f add io::Task 2018-12-20 12:15:23 +03:00
Aleksey Kladov
99561cf2f2 Add type alias 2018-12-20 12:15:23 +03:00
Aleksey Kladov
2ae05a6163 vfs crate scaffold 2018-12-20 12:15:23 +03:00
Aleksey Kladov
7509901fa0 wip 2018-12-20 12:15:23 +03:00
Jeremy A. Kolb
93cf39d968 Bump languageserver-types to 0.53.0 to support LSP 3.14.0
See: https://microsoft.github.io/language-server-protocol/specification#version_3_14_0
2018-12-19 17:32:44 -05:00
bors[bot]
ef1e107df1 Merge #273
273: Add a test to ensure that we can parse each file r=matklad a=DJMcNab

Note that this has a non-spurious failure in ra_analysis/src/mock_analysis.

Probably fixes #195.

If my understanding is correct, fixes #214 and fixes #225.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-19 21:22:00 +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
Aleksey Kladov
1c5ce7a868 File module source does not depend on syntax 2018-12-19 01:51:05 +03:00
Aleksey Kladov
d20d788571 disable gc for now 2018-12-19 01:10:03 +03:00
Aleksey Kladov
e7aa17b560 Gc syntax trees after every modification 2018-12-19 00:35:13 +03:00
Aleksey Kladov
d05790b947 Work around a bug
cc #288
2018-12-18 14:58:54 +03:00
Aleksey Kladov
193992fd14 move thread worker to a separate crate 2018-12-18 12:52:17 +03:00
Andrew Chin
8b1e667077 By default, log only to stderr, and not to disk.
This fixes a common problem when running under VS Code, the user
doesn't have permissions to create a `log` directory in the CWD.

The old behavior can be re-enabled by setting RA_INTERNAL_MODE=1
2018-12-17 17:22:30 -05: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
Aleksey Kladov
8d42deeac3 fix installation on windows 2018-12-17 11:26:41 +03: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
Bernardo
a062d844c2 use \b as word boundary 2018-12-09 15:50:56 +01:00
bors[bot]
3725276554 Merge #271
271: Implement format hook r=matklad a=DJMcNab

Tentatively: fixes #155.

However, this does add all changes in staged files, which might not be desirable. However, I think we can't solve that without explicit support in rustfmt for it, so it should be fine.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-09 12:44:58 +00:00
DJMcNab
cbce28a348 Reimplement format-hook using a rust binary 2018-12-09 12:27:13 +00:00
Aleksey Kladov
b9c17a6001 Answer canceled requests 2018-12-09 14:43:02 +03:00
Aleksey Kladov
5004cb928b verbose assertions in SourceFileItems 2018-12-09 14:21:54 +03:00
Aleksey Kladov
7784c7a701 resolve extern crates propertly 2018-12-09 13:49:54 +03:00
DJMcNab
279ff4927a Update hook to not add unstaged files 2018-12-09 10:37:04 +00:00
Aleksey Kladov
e89da32bb7 move tests to separate file 2018-12-09 13:33:16 +03:00
Aleksey Kladov
6a16d3fb0b WIP: resolve across crates 2018-12-09 13:33:16 +03:00
Aleksey Kladov
8b9ff46b37 make resolver fields private 2018-12-09 13:33:16 +03:00
Aleksey Kladov
74fe581061 return dependencies with names 2018-12-09 13:33:16 +03:00
Aleksey Kladov
961cae7e53 thread info about dep names 2018-12-09 13:33:16 +03:00
Aleksey Kladov
ca7e5905c1 more crate boilerplate 2018-12-09 13:33:16 +03:00
Aleksey Kladov
9c6c7ec2da hir::Crate boilerplate 2018-12-09 13:33:16 +03:00
Aleksey Kladov
9b1356464a propagate deps to CrateGraph 2018-12-09 13:33:16 +03:00
Aleksey Kladov
32c067f8c9 track deps in project model 2018-12-09 13:33:16 +03:00
DJMcNab
e823db0698 Implement and test format hook 2018-12-09 10:29:13 +00:00