Commit graph

451 commits

Author SHA1 Message Date
Aleksey Kladov
4753409f86 refactor TryConvWith similar to ConvWith 2019-08-20 19:53:05 +03:00
Aleksey Kladov
6ea4184fd1 translate \n -> \r\n on the way out 2019-08-20 19:53:05 +03:00
Aleksey Kladov
80a6e61446 make CTX type param instead of assoc type
that way, we can implement ConvWith<&'_ CTX> for different lifetimes
2019-08-20 19:53:05 +03:00
Aleksey Kladov
de3f2948ea add tests for crlf 2019-08-20 19:53:05 +03:00
Aleksey Kladov
ccca427ce4 minor 2019-08-20 19:53:05 +03:00
Aleksey Kladov
7cd9b1dd7a don't load sysroot in most heavy tests 2019-08-19 15:41:18 +03:00
Aleksey Kladov
64ecba4f15 update lsp 2019-08-17 22:21:59 +03:00
Aleksey Kladov
343463c824 implement durability 2019-08-15 15:27:00 +03:00
Aleksey Kladov
13eddd7c49 Drop support for old extendSelection API
Emacs now handles this via native LSP request

dc86bbb227
2019-08-12 13:49:28 +03:00
Kirill Bulatov
2c5c35bdae Always set the runnable name 2019-08-09 23:34:14 +03:00
Kirill Bulatov
726535a44e Extract common logic 2019-08-09 22:19:34 +03:00
Kirill Bulatov
918addee23 Show backtraces in lens runnables 2019-08-09 21:42:04 +03:00
bors[bot]
7e12422fa2 Merge #1652
1652: Improve type hints behavior r=matklad a=SomeoneToIgnore

This PR fixed the following type hints issues:

* Restructures the `InlayKind` enum contents based on the discussion here: https://github.com/rust-analyzer/rust-analyzer/pull/1606#issuecomment-515968055
* Races described in #1639 
* Caches the latest decorations received for each file to show them the next time the file is opened (instead of a new server request)

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-08-06 16:50:49 +00:00
Aleksey Kladov
3d45da9bca fix tests 2019-08-06 14:41:22 +02:00
Aleksey Kladov
deea8f52d9 allow to exclude certain files and directories 2019-08-06 14:28:31 +02:00
Aleksey Kladov
f70b7e1f07 rename config 2019-08-06 14:28:31 +02:00
Aleksey Kladov
34203256bf introduce ra_vfs_glob crate
It manages exclusion rules for the vfs crate
2019-08-06 14:28:31 +02:00
Aleksey Kladov
d751bd08bf cleanup 2019-08-06 10:57:16 +02:00
Aleksey Kladov
0e4a542cfb rename 2019-08-06 10:50:32 +02:00
Aleksey Kladov
27303da419 use Conv for severity 2019-08-06 09:50:00 +02:00
Kirill Bulatov
15411d4474 Use proper inlay kinds 2019-08-05 00:28:36 +03:00
Jeremy Kolb
e99d3da6c2 Add test for #1540 2019-08-03 18:01:48 -04:00
kjeremy
8da8c147ee remove-comment 2019-07-31 11:53:47 -04:00
kjeremy
4fccad9b2c Add explicit newline preserving tests 2019-07-31 10:46:15 -04:00
Roman Stoliar
facc7a35a5 Fixed review comments 2019-07-30 21:25:51 +03:00
Roman Stoliar
1c11d7b1d8 Hide comments in rust section of doc comments 2019-07-30 03:46:38 +03:00
Kirill Bulatov
b8f95f42e1 Support destructuring patterns 2019-07-29 00:33:10 +03:00
Kirill Bulatov
5169a9d498 Improve inlay hinting for types
Add hints for types in for loop expressions.
Resolve types for every tuple parameter.
Refactor the code.
2019-07-26 18:06:31 +03:00
Kirill Bulatov
dbbb0beb3e Make Analysis api cancellable 2019-07-25 20:22:41 +03:00
bors[bot]
5f3ff157e3 Merge #1549
1549: Show type lenses for the resolved let bindings r=matklad a=SomeoneToIgnore

Types that are fully unresolved are not displayed:

<img width="279" alt="image" src="https://user-images.githubusercontent.com/2690773/61518122-8e4ba980-aa11-11e9-9249-6d9f9b202e6a.png">

A few concerns that I have about the current implementation:

* I've adjusted the `file_structure` API method to return the information about the `let` bindings.
Although it works fine, I have a feeling that adding a new API method would be the better way.
But this requires some prior discussion, so I've decided to go for an easy way with an MVP. 
Would be nice to hear your suggestions.

* There's a hardcoded `{undersolved}` check that I was forced to use, since the method that resolves types returns a `String`. 
Is there a better typed API I can use? This will help, for instance, to add an action to the type lenses that will allow us to navigate to the type.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-07-23 09:51:40 +00:00
Kirill Bulatov
8f3377d9f9 Code review fixes 2019-07-22 23:25:13 +03:00
kjeremy
ce77291ca4 flexi_logger 0.14 2019-07-22 13:13:55 -04:00
Kirill Bulatov
ba76017d2e Do not show the lens with type hints 2019-07-21 23:48:54 +03:00
Kirill Bulatov
09c7c86696 Resolve types on the server 2019-07-21 23:44:37 +03:00
Kirill Bulatov
201b344f2b Refactor server api 2019-07-20 23:45:26 +03:00
Kirill Bulatov
b6c662c573 If possible, show type lenses for the let bindings 2019-07-20 21:39:04 +03:00
Kirill Bulatov
1037242e6e Add "Run" lens for binary runnables 2019-07-16 15:02:11 +03:00
kjeremy
1fcc002677 cargo update 2019-07-15 15:07:11 -04:00
Michael Bolin
e81a47b8eb Remove executeCommandProvider: apply_code_action.
This appears to have been introduced ages ago in
be742a5877
but has since been removed.

As it stands, it is problematic if multiple instances of the
rust-analyzer LSP are launched during the same VS Code session because
VS Code complains about multiple LSP servers trying to register the
same command.

Most LSP servers workaround this by parameterizing the command by the
process id. For example, this is where `rls` does this:

ff0b9057c8/rls/src/server/mod.rs (L413-L421)

Though `apply_code_action` does not seems to be used, so it seems better
to delete it than to parameterize it.
2019-07-10 22:49:35 -07:00
Michael Bolin
a814883cd4 Ignore workspace/didChangeConfiguration notifications. 2019-07-10 20:56:16 -07:00
Shotaro Yamada
a426de60ad Remove unused dependencies 2019-07-09 00:28:00 +09:00
Aleksey Kladov
e075e096cf don't send LocationLink unless the client opts-in
closes #1474
2019-07-08 14:09:38 +03:00
Aleksey Kladov
b042faeb64 simplify 2019-07-08 13:47:02 +03:00
Aleksey Kladov
227bc0b6d4 add try_conv_with_to_vec 2019-07-08 13:39:16 +03:00
Jeremy Kolb
9c6e93cd6c Simplify responses by using into() 2019-07-07 17:28:21 -04:00
Jeremy Kolb
3f44aaf363 use flatten branch of lsp-types 2019-07-07 14:13:13 -04:00
Jeremy Kolb
9438bbc75a Formatting again 2019-07-04 19:31:06 -04:00
Jeremy Kolb
b4c0c7f79c Symplify by using into() 2019-07-04 19:08:08 -04:00
Jeremy Kolb
e7fb6c83cc Formatting 2019-07-04 17:43:19 -04:00
Jeremy Kolb
4ad9e986ad Some clippy fixes for 1.36 2019-07-04 17:43:00 -04:00
Jeremy Kolb
a394c04bca Fix formatting 2019-07-04 16:58:52 -04:00
Jeremy Kolb
ad4276ac05 Change default() 2019-07-04 16:57:52 -04:00
Jeremy Kolb
9bfdab7089 Update to lsp-types 0.58.0 2019-07-04 16:57:52 -04:00
Aleksey Kladov
1834bae5b8 allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was
broken in the last rustfmt release, and syntax highlighting of imports
is more important anyway
2019-07-04 23:09:09 +03:00
Aleksey Kladov
18a1e092e9 Move memory usage statistics to ra_prof 2019-06-30 13:30:17 +03:00
Ryan Cumming
e052ca9d61 Swallow expected rustfmt errors
My workflow in Visual Studio Code + Rust Analyzer has become:

1. Make a change to Rust source code using all the analysis magic

2. Save the file to trigger `cargo watch`. I have format on save enabled
   for all file types so this also runs `rustfmt`

3. Fix any diagnostics that `cargo watch` finds

Unfortunately if the Rust source has any syntax errors the act of saving
will pop up a scary "command has failed" message and will switch to the
"Output" tab to show the `rustfmt` error and exit code.

I did a quick survey of what other Language Servers do in this case.
Both the JSON and TypeScript servers will swallow the error and return
success. This is consistent with how I remember my workflow in those
languages. The syntax error will show up as a diagnostic so it should
be clear why the file isn't formatting.

I checked the `rustfmt` source code and while it does distinguish "parse
errors" from "operational errors" internally they both result in exit
status of 1. However, more catastrophic errors (missing `rustfmt`,
SIGSEGV, etc) will return 127+ error codes which we can distinguish from
a normal failure.

This changes our handler to log an info message and feign success if
`rustfmt` exits with status 1.

Another option I considered was only swallowing the error if the
formatting request came from format-on-save. However, the Language
Server Protocol doesn't seem to distinguish those cases.
2019-06-27 08:08:26 +10:00
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