Commit Graph

445 Commits

Author SHA1 Message Date
kjeremy
f8f136e990 Bump cargo_metadata, ena, flexi_logger 2019-06-20 15:09:39 -04:00
Aleksey Kladov
b0be4207d0 reuse AnalysisHost in batch analysis 2019-06-15 16:29:23 +03:00
Aleksey Kladov
24703acf26 re-enable backtraces on panic 2019-06-15 12:58:17 +03:00
Muhammad Mominul Huque
ebb40c7f87
cargo format 2019-06-15 13:37:15 +06:00
Muhammad Mominul Huque
9709bd39ca
Get rid of failure: ra_lsp_server & ra_project_model 2019-06-15 02:42:56 +06:00
Aleksey Kladov
d32e15cae6 Temp fix for slow onEnter issue
The issue was windows specific -- cancellation caused collection of
bracktraces at some point, and that was slow on windows.

The proper fix here is to make sure that we don't collect bracktraces
unnecessary (which we currently do due to failure), but, as a
temporary fix, let's just not force their collection in the first
place!
2019-06-13 21:29:44 +03:00
Aleksey Kladov
fed52706de make LRU cache configurable 2019-06-12 13:36:24 +03:00
Aleksey Kladov
33026c654e make Docs handing more ideomatic 2019-06-08 14:16:05 +03:00
Alan Du
b28ca32db2 Fix clippy::or_fun_call 2019-06-04 18:05:07 -04:00
Alan Du
40424d4222 Fix clippy::identity_conversion 2019-06-04 18:05:07 -04:00
Alan Du
7bcd8d6290 Fix clippy::unused_mut 2019-06-04 18:05:07 -04:00
Alan Du
6095e3fe19 Fix clippy::unnecessary_mut_passed 2019-06-04 18:05:07 -04:00
Alan Du
ecd420636e Fix clippy::single_match 2019-06-04 18:05:07 -04:00
Aleksey Kladov
bf801953a3 rename 2019-06-01 10:31:40 +03:00
Aleksey Kladov
678a458543 move subs inside 2019-06-01 10:24:43 +03:00
Aleksey Kladov
78e17f65cf use sync queries for join lines and friends 2019-05-31 20:53:00 +03:00
Aleksey Kladov
c6537c3280 add sync requests 2019-05-31 20:50:16 +03:00
Aleksey Kladov
9697d8afad cleanup 2019-05-31 20:42:53 +03:00
Aleksey Kladov
15efd58274 cleanup 2019-05-31 20:30:14 +03:00
Aleksey Kladov
2d773a46c9 simplify 2019-05-31 20:23:56 +03:00
Aleksey Kladov
e1bda6aeda move completed requests to a separate file 2019-05-31 20:14:54 +03:00
Aleksey Kladov
838915c9a2 simplify 2019-05-31 19:24:33 +03:00
Aleksey Kladov
8bb02859e8 introduce constant 2019-05-31 19:20:22 +03:00
Aleksey Kladov
0e542936be minor 2019-05-31 19:17:46 +03:00
Aleksey Kladov
b6a854e161 update ra_ide_api to use builtins 2019-05-30 16:10:07 +03:00
Aleksey Kladov
18ed351747 ⬆️ parking_lot 2019-05-30 12:02:30 +03:00
Aleksey Kladov
9304cb0263 bump timeout for CI 2019-05-29 22:14:06 +03:00
Aleksey Kladov
a9373c4220 less noisy status 2019-05-29 21:07:38 +03:00
Aleksey Kladov
5c410385fc optimization: cancel backlog in onEnter 2019-05-29 16:05:14 +03:00
Aleksey Kladov
2c9a1cb3dd add latest requests to status page 2019-05-29 15:47:46 +03:00
Aleksey Kladov
e45c350a3b log the actual time of requests 2019-05-29 14:59:01 +03:00
Aleksey Kladov
118a2113c1 trigger garbage collection *after* requests, not before 2019-05-29 14:37:04 +03:00
Aleksey Kladov
6a1e3e59cb more perf logging 2019-05-29 14:34:21 +03:00
Aleksey Kladov
a6f1b171bc silnce profiling in tests 2019-05-29 10:33:47 +03:00
bors[bot]
b2bf41b2ba Merge #1334
1334: check for cancellation during macro expansion r=matklad a=matklad

closes #1331

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-27 11:45:41 +00:00
Aleksey Kladov
a2845bb1f5 check cancellation when expanding macros 2019-05-27 14:41:14 +03:00
Aleksey Kladov
cf214ac4e7 enable profiling in tests 2019-05-27 14:20:11 +03:00
Pascal Hertleif
4ac338b608
rename stray id field 2019-05-27 11:26:35 +02:00
Pascal Hertleif
5abcca516d
make it build again 2019-05-27 11:26:35 +02:00
Pascal Hertleif
5bf3e949e8
Semantic highlighting spike
Very simple approach: For each identifier, set the hash of the range
where it's defined as its 'id' and use it in the VSCode extension to
generate unique colors.

Thus, the generated colors are per-file. They are also quite fragile,
and I'm not entirely sure why. Looks like we need to make sure the
same ranges aren't overwritten by a later request?
2019-05-27 11:26:33 +02:00
Aleksey Kladov
ce040aa907 add profile calls to real-time requests 2019-05-27 11:48:23 +03:00
Lenard Pratt
8198e13c26 Added local macro goto 2019-05-04 17:39:51 +01:00
kjeremy
7125192c1e Basic resolution for ADT 2019-04-23 14:32:47 -04:00
Aleksey Kladov
47672726d8 ⬆️ lsp 2019-04-21 15:17:22 +03:00
Aleksey Kladov
fa12ed2b8f switch to official extend selection API 2019-04-21 12:13:48 +03:00
Aleksey Kladov
f75feb6724 cleanup cancellation
Now that we explicitelly exit the reading loop on exit notification,
we can assume that the sender is always alive
2019-04-17 11:47:38 +03:00
Aleksey Kladov
c4a5aa45dc add a couple of profiling points 2019-04-15 01:10:07 +03:00
Aleksey Kladov
5b7012318c filter by time 2019-04-15 01:10:07 +03:00
Aleksey Kladov
b228947b68 cleanup syntax 2019-04-15 01:10:07 +03:00
Aleksey Kladov
30a4099ea7 switch to modern paths 2019-04-15 01:10:07 +03:00
Roberto Vidal
c2dfc8a229 Modifies runnables test to use multi-workspace root 2019-04-14 10:04:38 +02:00
Roberto Vidal
7c7cfc5f04 Sends cwd info for runnables and code lenses 2019-04-14 10:04:38 +02:00
Roberto Vidal
3507bcb97a Adds support for multiple editor workspaces on initialization
This is a quick, partial fix for #1104
2019-04-14 10:04:38 +02:00
Ville Penttinen
0e49abb7fb Refactor CallInfo function signatures to new FunctionSignature type
This is used by CallInfo to create a pretty printed function signature that can
be used with completions and other places as well.
2019-04-09 14:45:04 +03:00
Edwin Cheng
ce3d78335d Remove checking file exists 2019-04-07 18:26:02 +08:00
Edwin Cheng
e92740c28b fix formatting 2019-04-07 12:46:45 +08:00
Edwin Cheng
333feb3869 Add warning when open file outside workspace 2019-04-07 01:20:33 +08:00
Sergey Parilin
9b73f80959 PR issuse resolved 2019-04-02 17:52:04 +03:00
Ville Penttinen
c6d6e6c625 Move actual include logic to ProjectRoot
This way the two IncludeRustFiles implementations can simply call the
ProjectRoots' methods, so that the include logic is in one place.
2019-03-21 10:43:47 +02:00
Ville Penttinen
e32462c6d5 Improve filtering of file roots
`ProjectWorkspace::to_roots` now returns a new `ProjectRoot` which contains
information regarding whether or not the given path is part of the current
workspace or an external dependency. This information can then be used in
`ra_batch` and `ra_lsp_server` to implement more advanced filtering. This allows
us to filter some unnecessary folders from external dependencies such as tests,
examples and benches.
2019-03-20 11:55:38 +02:00
Ville Penttinen
e70e2361b6 Upgrade ra_vfs to use new Filtering
Currently this matches the previous filtering, meaning all roots are filtered
using the same rules.
2019-03-18 20:53:08 +02:00
kjeremy
31b69e685d LSP: Support EnumMember and Field 2019-03-11 13:58:38 -04:00
Florian Diebold
c30c5fb4dd Don't default publishDecorations to true on the server
If the client doesn't specify this explicitly, that very likely means it doesn't
know about it and so we shouldn't send decorations. In particular, the recent
change to this default caused decorations to be sent to emacs, resulting in a
lot of warning spam.
2019-03-09 12:55:15 +01:00
bors[bot]
4ce962f64e Merge #948
948: Fix test_missing_module_code_action_in_json_project on Windows r=matklad a=vipentti

The test would fail on Windows due to the paths not being properly escaped for
JSON.

In addition adds extra braces around the fn main to actually introduce braces in
the file.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-07 17:35:57 +00:00
Ville Penttinen
84e1d50a2a Fix test_missing_module_code_action_in_json_project on Windows
The test would fail on Windows due to the paths not being properly escaped for
JSON.

In addition adds extra braces around the fn main to actually introduce braces in
the file.
2019-03-07 19:27:06 +02:00
pcpthm
d4108cdd60 Specify derive feature for serde 2019-03-08 01:58:29 +09:00
Aleksey Kladov
1aa11eb7e9 when loading workspace, say how many packages were loaded
this should help to debug configuration issues, when you see `0
packages loaded` or something like that.
2019-03-07 17:46:17 +03:00
David Wood
4cd757c1e3
Remove rust-project.json test w/ dependencies. 2019-03-07 12:28:19 +01:00
David Wood
3bc33ae712
Add test demonstrating logic for handling deps. 2019-03-07 01:06:46 +01:00
David Wood
614dd3c347
Rename and change add_roots to return a Vec. 2019-03-07 01:05:07 +01:00
David Wood
00d927a188
Initial implementation of project-lock.json.
This commit adds a initial implementation of project-lock.json, a build
system agnostic method of specifying the crate graph and roots.
2019-03-07 01:05:03 +01:00
Ville Penttinen
0dcb1cb569 Add showWorkspaceLoadedNotification to vscode client
This allows users to control whether or not they want to see the "workspace
loaded" notification.

This is done on the server side using InitializationOptions which are provided
by the client. By default show_workspace_loaded is true, meaning the
notification is sent.
2019-03-06 11:34:38 +02:00
Ville Penttinen
ce118da149 Rename feedback to show_message 2019-03-05 22:25:24 +02:00
Ville Penttinen
80347b8187 Remove InternalFeedback 2019-03-05 22:20:11 +02:00
Ville Penttinen
9063dabcca Send an actual ShowMessage instead of InternalFeedback in feedback()
This now allows us to send a notification that can be shown in the UI when the
workspace has been loaded.

Additionally this removes the need for internal_mode flag.
2019-03-05 21:59:01 +02:00
kjeremy
eb3ee7b8e5 Updates 2019-03-05 10:26:36 -05:00
Aleksey Kladov
73b892aaa3 show message in client's UI if workspace fails to load 2019-03-05 16:33:05 +03:00
Ville Penttinen
ac52d9a1f1 Add optional range parameter to SyntaxTreeParams
When range is provided, instead of showing the syntax for the whole file, we'll
show the syntax tree for the given range.
2019-03-03 19:49:50 +02:00
kjeremy
7463f5debb Fix the build 2019-02-27 09:35:04 -05:00
bors[bot]
1927eb088a Merge #901
901: Add basic support for showing fn signature when hovering r=matklad a=vipentti

This adds basic support for displaying function signature when hovering over a usage of a function. 

Additionally refactored `hover` to return `HoverResult` to ease with testing and in general to be more robust.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-27 11:50:38 +00:00
Ville Penttinen
6eb45c1c2b Remove RawResponse::empty() 2019-02-27 12:57:59 +02:00
Ville Penttinen
33cebe1724 Work around for issue in vscode reporting a failure in request
vscode would report "A request has failed" when it got "Content modified"
message and this would cause a pop-up to appear. This works around the issue by
returning an "empty" response that vscode can ignore.
2019-02-27 12:49:04 +02:00
Ville Penttinen
6f5fd6c9de Add new type HoverResult to contain the results of hovering
This makes testing hovers easier as well as allows us to do more things with the
results if needed.
2019-02-26 19:30:17 +02:00
Aleksey Kladov
78f10fcdc4 rename type to type_alias in the AST as well 2019-02-25 13:49:32 +03:00
Aleksey Kladov
ef442b8682 Assign IDs to assists 2019-02-24 14:00:00 +03:00
kjeremy
56f48ac42a Update lsp-types and backtrace 2019-02-21 10:07:14 -05:00
Aleksey Kladov
1bdd935e91 switch to crates.io vfs 2019-02-18 16:43:16 +03:00
Aleksey Kladov
5823d3d042 drop unused deps 2019-02-18 12:46:08 +03:00
Aleksey Kladov
92aa0f9c87 Don't use additional_text_edits API internally 2019-02-18 12:24:20 +03:00
Ville Penttinen
85a6bf3424 Refactor find_all_refs to return ReferenceSearchResult 2019-02-17 13:40:43 +02:00
Aleksey Kladov
bf352cd251 automatically wait for worker threads
closes #817
2019-02-14 21:11:07 +03:00
Ville Penttinen
dd6307ddc4 Add support for container_name in workspace/symbol query 2019-02-12 22:06:14 +02:00
Ville Penttinen
710975ecd8 Fix typo in Cargo.toml authors
Fixes typo introduced in #782
2019-02-11 10:20:04 +02:00
Ville Penttinen
ab3d231b1d Update authors field in Cargo.tomls to "rust-analyzer developers"
This closes #777
2019-02-11 08:55:35 +02:00
Florian Diebold
43e52ac9e2 Implement BatchDatabase construction 2019-02-10 10:56:58 +01:00
Florian Diebold
50fd860471 Remove Vfs from project model 2019-02-09 11:15:25 +01:00
Florian Diebold
ddbf43b630 Move crate graph generation to ra_project_model 2019-02-09 11:15:25 +01:00
Florian Diebold
fcd615e4b7 Extract project model to separate crate 2019-02-09 11:15:25 +01:00
Aleksey Kladov
12e3b4c70b reformat the world 2019-02-08 14:49:43 +03:00
kjeremy
6753051a45 Some clippy cleanups 2019-02-06 15:50:26 -05:00
kjeremy
852b083794 Fill deprecation for LSP 2019-02-05 17:05:46 -05:00
bors[bot]
4d4c46aff8 Merge #742
742: Extern crate r=matklad a=flodiebold

This implements `extern crate` declarations by lowering them to (absolute) imports, and adds support for absolute paths. It also extracts the extern prelude from the per-module item map, and handles the special case of extern crates in the crate root adding to the extern prelude.

This means we finally resolve `Arc`, so it fixes #523 😄 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-05 07:53:08 +00:00
kjeremy
7f92fd858a Move comment 2019-02-04 16:34:02 -05:00
Florian Diebold
0c2fedc2cb Add alloc to std deps 2019-02-04 21:49:34 +01:00
kjeremy
20e9aa2364 Future proof by explicitly matching against None 2019-02-04 12:49:29 -05:00
kjeremy
0f7a714c63 Add comment 2019-02-04 10:26:43 -05:00
Jeremy Kolb
6ac4cca6c1 Implement lens for impls and support resolving lenses. 2019-02-04 08:45:33 -05:00
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