Commit Graph

1190 Commits

Author SHA1 Message Date
Kirill Bulatov
b1d600a1ec Less panics in the assist resolution 2021-05-03 18:18:45 +03:00
Kirill Bulatov
28293d370f Add docs and use better naming 2021-05-03 18:16:35 +03:00
Kirill Bulatov
1679a376f3 Resolve single assist only 2021-05-03 18:03:28 +03:00
Kirill Bulatov
e5cdcb8b12 Add a way to resolve certain assists 2021-05-03 17:14:49 +03:00
Aleksey Kladov
cd69307aee fix: don't duplicate Progerss::Finised for cache priming 2021-05-02 21:45:00 +03:00
Boris-Chengbiao Zhou
ce8c6c4762 Ensure that only one cache priming task can run at a time
Fixes #8632.
2021-04-30 16:48:11 +02:00
m5tfi
5778ab1e41 add folding for where clauses 2021-04-30 10:18:36 +02:00
Aleksey Kladov
5c1a901035 internal: ensure that client and server-side configs are not mixed up
https://github.com/rust-lang/rust/issues/84647 would help big time here.
2021-04-28 13:13:30 +03:00
bors[bot]
86b5084917
Merge #8679
8679: fix: don't show error message for a valid notification r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-27 13:10:22 +00:00
Aleksey Kladov
f45c1ffc5b fix: don't show error message for a valid notification
Closes #6782, #6772
2021-04-27 16:09:59 +03:00
Jeremy Kolb
36c20dc23d Return ServerNotInitialized according to the spec
According to the spec we should return ServerNotInitialized if the server is waiting for an initialize request and something else comes in.
Upgrading to lsp-server 0.5.1 will do this and retry until the initialize request comes in.

Fixes #8581
2021-04-27 07:47:06 -04:00
Jorge Mederos Alvarado
c4dba4077f Add config options 2021-04-26 20:29:54 -04:00
Kirill Bulatov
c24bdab97e Use -u instead of --utc date flag 2021-04-26 17:12:13 +03:00
Aleksey Kladov
4f9640ff39 fix: add date to the version string on Mac
It doesn't support `--iso`
2021-04-26 15:20:15 +03:00
Lukas Wirth
050c69c19d Split out merge_imports module from helpers::insert_use 2021-04-24 13:31:43 +02:00
Aleksey Kladov
8d54fd105c fix: correct version string to contain hash, build date and channel 2021-04-24 13:36:45 +03:00
bors[bot]
e529f73355
Merge #8627
8627: Add profiling spans under cargo_to_crate_graph r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-22 18:26:09 +00:00
Laurențiu Nicola
6b187af337 Add profiling spans under cargo_to_crate_graph 2021-04-22 21:25:29 +03:00
James Leitch
72718bc2d7 Code review feedback. 2021-04-21 15:10:53 -07:00
James Leitch
9fcad82980 Diagnostic Remap Path Prefixes added. 2021-04-21 15:10:53 -07:00
James Leitch
60841f4276 Diagnostic paths attempt to use VSCode's path join behavior before defaulting to Rust's path join behavior. 2021-04-21 15:10:53 -07:00
Aleksey Kladov
21f4588fc8 internal: fix slightly broken test 2021-04-19 18:57:47 +03:00
Adrian Stanciu
1c75d8975c Fix typo: comparision -> comparison 2021-04-19 18:44:38 +03:00
Lukas Wirth
2f62c0117a Check for rust doc code attributes like rustdoc does 2021-04-19 13:32:52 +02:00
Lukas Wirth
8a959497b1 Don't require all doc fences to be valid for identifying rust code 2021-04-19 11:41:45 +02:00
bors[bot]
75bf832899
Merge #8540
8540: Prevent being able to rename items that are not part of the workspace r=Veykril a=Veykril

This change causes renames that happen on items coming from crates outside the workspace to fail. I believe this should be the right approach, but usage of cargo's workspace might not be entirely correct for preventing these kinds of refactoring from touching things they shouldn't. I'm not entirely sure?

cc #6623, this is one of the bigger footguns when it comes to refactoring, especially in combination with import aliases people tend to rename items coming from a crates dependency which this prevents.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-19 07:57:40 +00:00
Lukas Wirth
493aaa1403 Better visualise control flow for change_annotation_support" 2021-04-19 00:14:55 +02:00
Lukas Wirth
c447a795ab Prevent being able to rename items that are not part of the workspace 2021-04-18 12:44:00 +02:00
Chayim Refael Friedman
6c287e1504 Accept E<error_number> notation in doctests
```compile_fail,E0000
```

The code was stolen from rustdoc at 392ba2ba1a/src/librustdoc/html/markdown.rs (L866-L867)
2021-04-18 06:15:40 +03:00
Milo
2fa5086424 change grammar 2021-04-15 19:40:07 +01:00
Jonas Schievink
30aae2cefb Move cursor position when using item movers 2021-04-14 00:03:04 +02:00
bors[bot]
03e0bf7f55
Merge #8354
8354: Distinguishing between different operators in semantic highlighting r=matklad a=chetankhilosiya



Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
2021-04-13 11:46:23 +00:00
Aleksey Kladov
06a633ff42 feat: improve performance by delaying computation of fixes for diagnostics 2021-04-13 12:09:04 +03:00
Aleksey Kladov
04b5fcfdb2 Ensure that listing&resolving code actions use the same set of actions 2021-04-13 11:27:00 +03:00
bors[bot]
fe29a9e837
Merge #8494
8494: internal: unfork code paths for unresolved and resolved assist r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-13 07:59:36 +00:00
Aleksey Kladov
460f0ef669 internal: unfork code paths for unresolved and resolved assist 2021-04-13 10:59:15 +03:00
Laurențiu Nicola
3b964c0c81 Exclude nightly tag from git describe to fix version string 2021-04-13 09:20:17 +03:00
Aleksey Kladov
426d098bd6 internal: prepare for lazy diagnostics 2021-04-12 17:58:01 +03:00
Aleksey Kladov
29d5f29932 fix: don't spam repeated error messages when cargo check fails
Conceptually, using a *message* here is wrong, because this is a
"status", rather than "point in time" thing. But statuses are an LSP
extension, while messages are stable. As a compromise, send message only
for more critical `metadata` failures, and only once per state change.
2021-04-12 16:19:36 +03:00
Aleksey Kladov
186c5c47cb feat: avoid checking the whole project during initial loading 2021-04-12 15:29:31 +03:00
bors[bot]
0fac165052
Merge #8410
8410: Use CompletionTextEdit::InsertAndReplace if supported by the client r=Veykril a=Veykril

Fixes #8404, Fixes #3130

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-10 13:07:46 +00:00
Chetan Khilosiya
1735b3ef6a 8279: Added initial implementation for
Operator semantic highlighting.
2021-04-08 22:58:26 +05:30
kjeremy
3634b2145c Bump lsp-types and syn
This lsp-types now supports a default InsertTextMode for completion and a per-completion item commit_characters
2021-04-08 10:57:47 -04:00
Lukas Wirth
8fa3011908 Use CompletionTextEdit::InsertAndReplace if supported by the client 2021-04-08 15:21:27 +02:00
Lukas Wirth
4b555ab1d9 Emit folding ranges for multiline array literals 2021-04-08 00:12:11 +02:00
Jonas Schievink
36cd724b7b Autoclose blocks when typing { 2021-04-07 16:38:04 +02:00
Manuel Ceron
dbd760010e Return a better error message for when we are waiting for cargo. 2021-04-07 14:33:41 +02:00
bors[bot]
74711deb72
Merge #8375
8375: feat: show errors from `cargo metadata` and initial `cargo check` in the status bar r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-04-06 15:09:38 +00:00
Aleksey Kladov
de33702784 feat: show errors from cargo metadata and initial cargo check in the status bar
closes #3155
2021-04-06 18:08:05 +03:00
bors[bot]
12e86433ab
Merge #8368
8368: Move Ty accessors to TyExt r=flodiebold a=Veykril

CC #8313

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-06 13:32:15 +00:00
Aleksey Kladov
8fe20b19d4 More robust status notifications 2021-04-06 15:45:31 +03:00
Lukas Wirth
9b4699a9be Move Ty accessors to TyExt 2021-04-06 13:58:48 +02:00
Aleksey Kladov
9143e3925c Prepare for more stateless status reporting 2021-04-06 13:23:09 +03:00
Aleksey Kladov
e3c47ccefc Use autoreload config to gate execution rather that staleness 2021-04-06 13:10:50 +03:00
Aleksey Kladov
3698b3eab8 Avoid duplicate cargo checks 2021-04-06 12:40:31 +03:00
Aleksey Kladov
9ca59733e3 Improve readability
It's better to order functions in the order they are called, if there's
ordering between them.
2021-04-06 12:35:40 +03:00
Aleksey Kladov
aaa8c208b1 internal: do not drop errors from cargo metadata/check
Work towards #3155
2021-04-06 12:33:19 +03:00
Aleksey Kladov
7099438e0c internal: prepare to store OpQueue results in the queue itself 2021-04-05 20:49:00 +03:00
Aleksey Kladov
a01fd1af19 internal: explain "extract if condition" refactoring 2021-04-05 13:02:47 +03:00
Jonas Schievink
ab49f762a9 analysis-stats: allow skipping type inference
This removes "noise" from memory profiles since it avoids lowering
function bodies and types
2021-04-05 01:42:19 +02:00
Jonas Schievink
d3b804d11d Error when rustfmt component is unavailable 2021-04-05 00:33:11 +02:00
Jonas Schievink
3abcdc03ba Make ast_to_token_tree infallible
It could never return `None`, so reflect that in the return type
2021-04-04 01:46:45 +02:00
Jade
feae14be11 Put the revision in the logged startup message 2021-04-02 02:53:56 -07:00
bors[bot]
ea8feca31a
Merge #8265
8265: Improve rustc diagnostic mapping r=jonas-schievink a=jonas-schievink

Try to mirror rustc diagnostics more closely by:

* Emitting hint-level diagnostics at *all* macro invocation sites that caused the diagnostic
  * Previously we emitted a copy of the diagnostic (not at hint level) at the last macro invocation site only
* Emitting the original diagnostic inside the macro, if it was caused by a macro
* Always including related information pointing to the invocation site or the macro, respectively (the old code contained a bug that would sometimes omit it)

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


![screenshot-2021-03-30-19:34:56](https://user-images.githubusercontent.com/1786438/113031484-1266a600-918f-11eb-9164-fed01c8ba37e.png)
![screenshot-2021-03-30-19:35:10](https://user-images.githubusercontent.com/1786438/113031486-12ff3c80-918f-11eb-8f15-9d7f23b69653.png)


Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-04-01 21:22:11 +00:00
Jonas Schievink
0a8274dd46 Include remaining memory in memory usage stats 2021-04-01 23:01:07 +02:00
Jonas Schievink
608a4653a3 Check for and skip dummy macro files 2021-04-01 15:51:34 +02:00
Jonas Schievink
066330e953 Adjust message when pointing at location in macro 2021-04-01 14:44:20 +02:00
Jonas Schievink
7c87e49638 Search for a suitable primary location 2021-03-31 17:50:19 +02:00
Jonas Schievink
7723dd0909 Rename convert_location -> location 2021-03-31 17:18:21 +02:00
Chetan Khilosiya
f269fe7156 8024: Added the trait modifier for methods
method in impls and method calls will have trait modifier.
2021-03-31 00:31:15 +05:30
Jonas Schievink
9b41effd07 Improve rustc diagnostic mapping 2021-03-30 19:29:26 +02:00
Aleksey Kladov
fb00b92dde internal: revive google_cpu_profile infra 2021-03-30 17:29:43 +03:00
Aleksey Kladov
797185e1b6 internal: switch from CLI to internal benchmarking
We have a CLI for benchmarking, but no one actually uses it it seems.
Let's try switching to "internal" benchmarks, implemented as rust tests.
They should be easier to "script" to automate tracking of perf
regressions.
2021-03-30 12:47:23 +03:00
Ayomide Bamidele
8e11796dc5 formatting fix 2021-03-29 12:56:02 +01:00
Ayomide Bamidele
391be07298 Folding range for consts 2021-03-29 12:17:19 +01:00
Josh Mcguigan
0e31ae2cef completion relevance distinguish between exact type match and could unify 2021-03-26 09:18:18 -07:00
bors[bot]
5f9ba2d589
Merge #8177
8177: Limit the hints size by default r=Veykril a=SomeoneToIgnore

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8175
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/3138

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-03-24 08:53:48 +00:00
Edwin Cheng
f41ae64722 Ignore proc-macro stdout to prevent IPC crash 2021-03-24 03:44:28 +08:00
Kirill Bulatov
5e83a56dfb Bump the default hint length 2021-03-23 19:43:55 +02:00
Kirill Bulatov
f1e1a2c0a7 Limit the hints size by default 2021-03-23 19:04:48 +02:00
bors[bot]
d4fa6721af
Merge #8054
8054: Item movers r=matklad a=ivan770

Closes #6823

https://user-images.githubusercontent.com/14003886/111331579-b4f43480-8679-11eb-9af0-e4dabacc4923.mp4

Implementation issues:
- [ ] Most of items are non-movable, since _movability_ of any item has to be determined manually. Common ones are movable though
- [x] Cursor should move with the item

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-03-22 13:08:45 +00:00
Edwin Cheng
7784cadc3d Reexport PrefixKind to remove deps to hir 2021-03-22 13:39:13 +08:00
bors[bot]
1ae20d2b89
Merge #8132
8132: Add `'` to trigger_characters, allowing more direct lifetime completions r=Veykril a=Veykril

Fixes having to type a character after `'` to complete lifetimes and labels

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-21 15:57:14 +00:00
Matthias Krüger
202b51bc7b a lot of clippy::style fixes 2021-03-21 16:15:41 +01:00
Lukas Wirth
f3c7499be5 Add ' to trigger_characters, allowing more direct lifetime completions 2021-03-21 11:05:04 +01:00
Lukas Wirth
a9a7c5cb1f Don't return a SourceChange on WillRenameFiles when nothing gets refactored 2021-03-20 13:57:58 +01:00
Lukas Wirth
8c0f454d11 Use a highlight modifier for intra doc links 2021-03-18 22:32:07 +01:00
ivan770
7d60458495
Item up and down movers 2021-03-18 11:22:27 +02:00
Lukas Wirth
9763f0a6bd Semantic highlight intradoclinks in documentation 2021-03-17 21:00:01 +01:00
Matthias Krüger
64b91393b8 remove uselessly wrapped ?s. (clippy::meedless_question_mark
let x = Some(3);

let y = Some(x?);
can just be:
let y = x
2021-03-17 02:19:40 +01:00
Matthias Krüger
048dad8c2e don't clone types that are copy (clippy::clone_on_copy) 2021-03-17 01:56:31 +01:00
Matthias Krüger
966c23f529 avoid converting types into themselves via .into() (clippy::useless-conversion)
example: let x: String = String::from("hello world").into();
2021-03-17 01:27:56 +01:00
Aleksey Kladov
469b739c28 Enable proc-macros by default 2021-03-15 18:19:08 +03:00
bors[bot]
5138baf2ac
Merge #8021 #8022
8021: Enable searching for builtin types r=matklad a=Veykril

Not too sure how useful this is for reference search overall, but for completeness sake it should be there 
![image](https://user-images.githubusercontent.com/3757771/111132711-f69db600-8579-11eb-8c90-22fd6862d11f.png)

Also enables document highlighting for them.


8022: some clippy::performance fixes r=matklad a=matthiaskrgr

use vec![] instead of Vec::new() + push()
avoid redundant clones
use chars instead of &str for single char patterns in ends_with() and starts_with()
allocate some Vecs with capacity to avoid unnecessary resizing

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2021-03-15 10:05:49 +00:00
Aleksey Kladov
5dcdf2ceee Move code to the appropriate layer
StructureNodeKind is a type which is specific to a particular feature,
file_structure. It shouldn't be in the "code shared by all ide features"
part.
2021-03-15 12:55:27 +03:00
Matthias Krüger
cad617bba0 some clippy::performance fixes
use vec![] instead of Vec::new() +  push()
avoid redundant clones
use chars instead of &str for single char patterns in ends_with() and starts_with()
allocate some Vecs with capacity to avoid unneccessary resizing
2021-03-15 10:19:59 +01:00
Lukas Wirth
9763d9e8c4 Enable searching for builtin types 2021-03-15 09:32:06 +01:00
ivan770
d6977550dd
Make CI happy 2021-03-14 19:05:09 +02:00
ivan770
7d48e04f31
Introduce StructureNodeKind 2021-03-14 19:00:41 +02:00
ivan770
71a97a2d8c
Provide regions in file structure 2021-03-14 18:53:37 +02:00