Commit graph

338 commits

Author SHA1 Message Date
Laurențiu Nicola
cbc2ac5d09
Add core to STD_DEPS
See #731.
2019-02-03 17:35:42 +02:00
Florian Diebold
33ff7b56ff Use the new Resolver API in completion 2019-02-01 22:45:25 +01:00
Jeremy Kolb
76c0d0b94d format 2019-01-31 07:44:26 -05:00
Jeremy Kolb
57899d66fa Use "▶" for test code lens
I find that this makes code lenses stand out more.
2019-01-30 22:09:27 -05:00
bors[bot]
b704ce803b Merge #702
702: Go to Implementation r=matklad a=kjeremy

First half of #620

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-01-30 19:19:31 +00:00
Jeremy Kolb
b88ba007cc Pass Documentation up to LSP and add "rust" to our codeblocks there 2019-01-29 21:39:09 -05:00
Jeremy Kolb
3c17643b30 Go to Implementation for structs and enums 2019-01-29 19:13:02 -05:00
Aleksey Kladov
2ee08098a6 opt-in jemalloc 2019-01-28 15:52:21 +03:00
Aleksey Kladov
d1a67c1174 align command naming 2019-01-28 15:01:22 +03:00
Aleksey Kladov
7801f6b50f automatically collect garbage 2019-01-27 22:57:18 +03:00
DJMcNab
9fbbb8f609 Don't use the reserved error code 2019-01-26 20:58:50 +00:00
DJMcNab
d9456c3989 Return an lsp error 2019-01-26 20:43:51 +00:00
DJMcNab
632b0f2902 Use the correct working directory for cargo metadata and rustfmt 2019-01-26 20:16:15 +00:00
Andrea Pretto
27c071f702 Fold blocks of mod items.
Fixes #572
2019-01-26 00:31:14 +01:00
Aleksey Kladov
f6adb85b68 add gc request 2019-01-25 19:11:58 +03:00
Hrvoje Ban
4eff8ddb8b Fill in DocumentSymbol::detail 2019-01-24 19:05:26 +01:00
Hirokazu Hata
70a35379ab Fix target_selection_range type 2019-01-24 02:47:30 +09:00
Hirokazu Hata
76d52be1da Bumpup lsp-types to v0.55.0 2019-01-24 02:47:03 +09:00
Aleksey Kladov
0ba7e2eaeb ad status command 2019-01-23 01:24:53 +03:00
Jeremy Kolb
5d110c0ee2 Teach CompletionItem about documentation 2019-01-21 21:41:39 -05:00
bors[bot]
f133702f72 Merge #574
574: refactor completions to use TextEdit instead of InsertText r=matklad a=gfreezy

1. migrate from `insertText` to `TextEdit` from `CompleteItem`
2. use `insta` to test completions

Co-authored-by: gfreezy <gfreezy@gmail.com>
2019-01-20 18:27:23 +00:00
Aleksey Kladov
73836cdbbc extend selection expands macros and can totally panic 2019-01-20 21:05:01 +03:00
Aleksey Kladov
171f6e6d00 somewhat better name 2019-01-20 21:01:11 +03:00
Aleksey Kladov
1ec1bd8139 make matching brace consistent 2019-01-20 20:59:46 +03:00
gfreezy
2a43638052 use a combination of source_change and text_edit for CompleteItem 2019-01-20 12:02:00 +08:00
gfreezy
94d96b60f3 refactor to use remove_range and replace_range instead of TextEdit 2019-01-20 00:38:34 +08:00
gfreezy
d08e81cdd8 refactor completions to use TextEdit instead of InsertText 2019-01-19 22:02:50 +08:00
gfreezy
99e8499957 more idiomatic code 2019-01-19 15:36:58 +03:00
gfreezy
6ab6d1eaa0 fix comments 2019-01-19 15:36:58 +03:00
gfreezy
bc0f79f74a rename mod 2019-01-19 15:36:58 +03:00
Aleksey Kladov
b028472481 ⬆️ update rust 2019-01-19 15:36:58 +03:00
Aleksey Kladov
db43b44f71 update cargo_metadata 2019-01-14 16:15:25 +03:00
Aleksey Kladov
7e5ab9b78c switch to lsp-types 2019-01-14 14:32:03 +03:00
Aleksey Kladov
5498a202b6 target_selection_range is not nullable in the implementation 2019-01-13 22:42:42 +03:00
bors[bot]
0199572a3d Merge #517 #518
517: gracefully handle cycles in crate graph r=matklad a=matklad



518: Add an explanatory message when we use the Query fallback r=matklad a=DJMcNab

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/269.

There is no good way to explain it for go_to_def, so I've just fallen back on to_vec.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2019-01-13 10:41:47 +00:00
Aleksey Kladov
77f67ca7e2 gracefully handle cycles in crate graph
rust-lang/rust has absolutely weird setup with rustc-workspace-shim,
which leads to real cycles.
2019-01-13 13:39:48 +03:00
Jeremy Kolb
5d273f10cd Add bench runnable and code lens 2019-01-12 18:40:54 -05:00
bors[bot]
eb931c0d9e Merge #505
505: Inherent methods r=matklad a=flodiebold

This adds resolution, type checking and completion for inherent methods.

The main open question here is the caching, I think. I'm not sure whether we should be caching method resolutions in a more fine grained way (currently we just build a hash map of types -> impl blocks, and iterate through all potential impl blocks when looking for a method).

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-01-12 21:18:14 +00:00
bors[bot]
e56072bfa3 Merge #500
500: Code lens support for running tests r=matklad a=kjeremy

Supports running individual and mod tests.

I feel like this kind of abuses the `Runnables` infrastructure but it works. Maybe later on down the line we should introduce a struct that is really just a tuple of binary, arguments, and environment and pass that back to the client instead. `run_single.ts` is just a paired down version of `runnables.ts` and there is duplication because I think run_single will probably change independent of runnables.

Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-01-12 18:56:11 +00:00
Jeremy Kolb
72d48b08fb Move CargoTargetSpec and friends to cargo_target_spec module 2019-01-12 13:00:58 -05:00
Florian Diebold
d0bdaa6c00 Complete inherent methods 2019-01-12 15:01:27 +01:00
Jeremy Kolb
f42f70b1d5 Switch hover to use MarkupContent
MarkedString is deprecated
2019-01-11 21:45:16 -05:00
Jeremy A. Kolb
faf0037635 Code lens support for running tests 2019-01-11 15:16:55 -05:00
Aleksey Kladov
f60153ee9e warn louder on mising sysroot 2019-01-11 20:55:56 +02:00
Aleksey Kladov
f193fbcbae actually produce missing def kinds 2019-01-11 21:02:12 +03:00
bors[bot]
aad1bf877e Merge #496
496: Include two element ranges into the nav. r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-11 15:35:41 +00:00
Aleksey Kladov
dda916bc4d fix tests 2019-01-11 18:32:22 +03:00
Aleksey Kladov
4089db1e0d prioritize event handing over indexing
If we index gazillion libraries simultaneously, we fill the threadpool
and so the main loop fails to turn, although there isn't really any
significant blocking inside the loop itself.
2019-01-11 17:08:49 +03:00
Aleksey Kladov
8a5f74a24f use location link in goto def 2019-01-11 16:06:22 +03:00
Aleksey Kladov
3aaf20bd6e return ref ranges from gotodef 2019-01-11 16:06:08 +03:00
Aleksey Kladov
d9e70e3160 fix on-type offset 2019-01-11 15:05:40 +03:00
Aleksey Kladov
66d7adf1cb force serde in ra_syntax 2019-01-11 13:21:18 +03:00
Aleksey Kladov
4bf6b91b9d minor 2019-01-11 00:51:34 +03:00
Aleksey Kladov
cd00158b1d wire sysroot into crate graph 2019-01-11 00:51:34 +03:00
Aleksey Kladov
e35374ec7c special case std 2019-01-11 00:51:34 +03:00
Aleksey Kladov
8852408bfb use arena for sysroot 2019-01-11 00:51:34 +03:00
Aleksey Kladov
66fba88534 split module 2019-01-11 00:51:34 +03:00
Aleksey Kladov
e8923713c5 add sysroot boilerplate 2019-01-11 00:51:34 +03:00
Aleksey Kladov
4196b65f21 dont depend on tools from lsp-server 2019-01-11 00:46:32 +03:00
Aleksey Kladov
cbeaa541aa switch CargoWorkspace to arena 2019-01-10 21:26:43 +03:00
Aleksey Kladov
ddf2a8a948 add completion detail 2019-01-09 19:40:11 +03:00
Marcus Klaas de Vries
0b8fbb4fad Fix typos in ARCHITECTURE.md and a number of crates
specifically: gen_lsp_server, ra_arena, ra_cli, ra_db, ra_hir
2019-01-09 01:17:09 +01:00
Marcus Klaas de Vries
f8261d611a Fix typo defenition -> definition 2019-01-08 23:38:51 +01:00
Aleksey Kladov
5b573deb20 fix usages after rename 2019-01-08 22:33:36 +03:00
Aleksey Kladov
f553837c1c upstream text-utils to text_unit 2019-01-08 21:50:04 +03:00
Aleksey Kladov
1b82084a5f dont depend on ra_editor directly 2019-01-08 21:01:41 +03:00
Aleksey Kladov
141ab166cf switch to newer cargo-metadata 2019-01-08 19:36:09 +03:00
Aleksey Kladov
256ec6e8d4 introduce CallInfo 2019-01-08 18:27:44 +03:00
Aleksey Kladov
d62ede8262 migrate ra_lsp_server to new rowan 2019-01-08 11:56:17 +03:00
Simon Vandel Sillesen
b0ffa98a00 add "." as a trigger char on type formatting 2019-01-06 09:56:00 +01:00
Simon Vandel Sillesen
2e52b27e71 refactor 2019-01-06 09:41:11 +01:00
Simon Vandel Sillesen
f99398d9d5 indent on typing dot. fixes #439 2019-01-06 00:58:03 +01:00
Aleksey Kladov
4551155073 introduce separate goto_defenition 2019-01-05 19:30:49 +03:00
Aleksey Kladov
3ad0037f90 move hover implementation to ra_analysis 2019-01-05 17:24:17 +03:00
bors[bot]
8d51b02362 Merge #414
414: textDocument/hover returns both type name and doc_text r=matklad a=h-michael

implement #389

Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
2019-01-05 13:12:41 +00:00
Hirokazu Hata
341eb4ae87 Use both type_of and doc_text_for 2019-01-05 11:28:16 +09:00
Florian Diebold
fe6c4115f6 Rename ImplItem to ImplBlock
rustc uses the name ImplItem for items in impls, not the impl {} block itself,
which could lead to confusion.
2019-01-04 18:28:36 +01:00
Aleksey Kladov
291d578938 extract area to a crate 2019-01-04 16:58:10 +03:00
Bernardo
7d9e02e5a2 fix tests 2019-01-03 14:43:47 +01:00
Bernardo
3ab328b49a use lsp WorkspaceEdit instead of custom source_file_edits and file_system_edits 2019-01-03 14:20:15 +01:00
Hirokazu Hata
6ee7788513 Return type name when doc_text_for returns nothing 2019-01-03 21:15:23 +09:00
Aleksey Kladov
03ea6bcbff use LocalPtr in navigation target 2019-01-03 12:26:40 +03:00
Aleksey Kladov
830abe0c1b use navigation target in API 2019-01-02 17:09:39 +03:00
Aleksey Kladov
d25c89f760 introduce navigation target 2019-01-02 16:53:40 +03:00
bors[bot]
2a65020442 Merge #165
165: Make modules with tests runnable r=farodin91 a=farodin91

Fixes #154

I having problems to traverse the path to module. The main problem is that module_tree only supports `FileId` and not `Module` in files. Any idea?

I need to clean up the code a bit later.

Co-authored-by: Jan Jansen <farodin91@googlemail.com>
2018-12-31 14:15:34 +00:00
Jan Jansen
05daa86634 Make modules with tests runnable
Fixes #154
2018-12-31 15:00:04 +01:00
Aleksey Kladov
a3ee07ac14 fix icons in completion 2018-12-31 16:06:14 +03:00
bors[bot]
2746dacac0 Merge #385
385: Implement DocumentHighlight r=matklad a=DJMcNab

Fixes #80.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-31 12:37:05 +00:00
DJMcNab
be75e547ce Use TryConv for conversion 2018-12-31 12:17:05 +00:00
DJMcNab
79941a9e70 Implement DocumentHighlight 2018-12-31 11:08:44 +00:00
dependabot[bot]
96ecd73a5c
Bump serde_json from 1.0.33 to 1.0.34
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.33 to 1.0.34.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.33...v1.0.34)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-31 09:48:16 +00:00
dependabot[bot]
51ce71686a
Bump failure from 0.1.3 to 0.1.4
Bumps [failure](https://github.com/rust-lang-nursery/failure) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/rust-lang-nursery/failure/releases)
- [Changelog](https://github.com/rust-lang-nursery/failure/blob/master/RELEASES.md)
- [Commits](https://github.com/rust-lang-nursery/failure/compare/0.1.3...0.1.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-31 08:53:49 +00:00
dependabot[bot]
2d9428b54a
Bump failure_derive from 0.1.3 to 0.1.4
Bumps [failure_derive](https://github.com/withoutboats/failure_derive) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/withoutboats/failure_derive/releases)
- [Commits](https://github.com/withoutboats/failure_derive/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-12-31 05:36:03 +00:00
Aleksey Kladov
0a8d085619 remove backtraces from Cancelled
Hopefully we won't need them for debugging. If we do need them, it
should be easy to add back.
2018-12-31 00:38:50 +03:00
bors[bot]
acc61cc284 Merge #375
375: Move renames into ra_analysis and rename the correct range r=DJMcNab a=DJMcNab

Fixes #230. Supersedes #235.

TODO: add some tests for this

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2018-12-30 20:43:58 +00:00
bors[bot]
f9b58454a4 Merge #378
378: migrate-to-tempdir r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2018-12-30 20:33:32 +00:00
Aleksey Kladov
f0edb93df2 ⬆️ tempdir 2018-12-30 23:33:04 +03:00
Aleksey Kladov
c2c10b9014 ⬆️ crossbeam
closes #189
2018-12-30 23:23:31 +03:00
DJMcNab
c402b007a3 Move renames into ra_analysis 2018-12-30 18:14:55 +00:00
Aleksey Kladov
0e90e0436a remove runtime dependency on tools 2018-12-30 15:28:54 +03:00
Aleksander Vognild Burkow
0cb270e75d Simplify failure bail code 2018-12-30 00:21:15 +01:00
Aleksander Vognild Burkow
ed47c93afe Install rustfmt in rustfmt test 2018-12-29 23:38:26 +01:00
Aleksander Vognild Burkow
09c20c8fcf Add better error message for Command failure 2018-12-29 23:38:26 +01:00
Aleksander Vognild Burkow
8b24f158f7 Add support for formatting entire document with rustfmt
Attempting to format a document when rustfmt isn't installed will result
in an error being returned to the frontend. An alternative
implementation would be returning zero replacements.
2018-12-29 21:57:46 +01:00
Aleksey Kladov
11122e29b7 completion for enum variants 2018-12-28 21:07:47 +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
fd33c89207 switch to FileRange 2018-12-28 18:17:43 +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
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
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
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
Bernardo
e9c186e48a change to TextEdit to avoid allocation and sort
rename newline to step where applicable
2018-12-25 20:49:18 +01:00
Bernardo
6b2da4e547 use new translate_offset_with_edit for TryConvWith
doc comments
2018-12-25 20:06:49 +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
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
4ff1618520 Do name resolution by namespace (types/values) 2018-12-25 15:16:42 +01: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
29798c763c remove option from Diagnostic 2018-12-24 23:00:18 +08: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
gfreezy
346638c809 add serverity to vscode diagnostics 2018-12-24 00:39:33 +08:00
DJMcNab
a0e8538129 Improve comment 2018-12-23 11:10:12 +00: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
2639997973 log times 2018-12-22 11:53:20 +03:00
Aleksey Kladov
498e3a6846 binding icon 2018-12-22 02:24:59 +03:00
Aleksey Kladov
97cb463c9b moar icons 2018-12-22 02:20:14 +03:00
Aleksey Kladov
238b52358d more icons 2018-12-22 02:03:18 +03:00
Aleksey Kladov
f1f2804c71 move completion items to conv 2018-12-22 01:59:32 +03:00
Aleksey Kladov
2351308d92 remove explicit serde_derive 2018-12-21 22:39:59 +03: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
4092b8d0b5 make compleion item details private 2018-12-21 15:19:46 +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
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
Aleksey Kladov
23b040962f fold curly blocks 2018-12-20 22:43:06 +03: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
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
2fe41574a1 fix tests 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
a422d480a1 implement vfs events handling 2018-12-20 12:15:38 +03:00