Commit Graph

1389 Commits

Author SHA1 Message Date
Aleksey Kladov
12103b16de internal: untangle usages of ReferenceCategory somewhat
Not everything that can be read or write is a reference, let's try to
use more precise types.
2021-10-02 13:02:06 +03:00
Aleksey Kladov
46eb03d99a internal: use naming that matches intended use-case 2021-10-02 12:18:18 +03:00
lhvy
dbb02370a4
Add semantic token modifier for crate root 2021-10-01 20:52:13 +10:00
Lukas Wirth
0c7ea0c9a1 Fix add missing semantic token modifier in SUPPORTED_MODIFIERS 2021-09-30 20:38:05 +02:00
lhvy
f713cfb818
Remove unneeded semantic token definition 2021-10-01 01:55:29 +10:00
lhvy
2b3baa8503
Give defaultLibrary semantic token modifier to items from standard library 2021-10-01 01:19:24 +10:00
bors[bot]
ee12b0f173
Merge #10181
10181: Begining of lsif r=HKalbasi a=HKalbasi

This PR adds a `lsif` command to cli, which can be used as `rust-analyzer lsif /path/to/project > dump.lsif`. It now generates a valid, but pretty useless lsif (only supports folding ranges). The propose of this PR is to discussing about the structure of lsif generator, before starting anything serious.

cc `@matklad` #8696 #3098


Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-29 13:13:03 +00:00
hamidreza kalbasi
5bd0f50111 remove glob import and cancellables 2021-09-29 16:25:10 +03:30
Laurențiu Nicola
81891f7abe Enable attribute proc macros by default 2021-09-27 18:11:31 +03:00
hamidreza kalbasi
13d36e96c2 use crates io version 2021-09-26 10:39:23 +03:30
hamidreza kalbasi
48bebeaa32 support goto definition and find references 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
f2775ac2e9 reuse hover results with resultset 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
70061d2b7e move lsif types to lsp types crate 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
e803bd25c4 add hover 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
1103e390e0 cfg unix for tests with unix path 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
5163201847 use utf16 instead of utf8 2021-09-26 10:04:02 +03:30
hamidreza kalbasi
557210a688 Begining of lsif 2021-09-26 10:04:02 +03:30
Nixon Enraght-Moony
720a3da4ac Give rustfmt spawn error context. 2021-09-24 17:51:47 +01:00
bors[bot]
eb17e90eba
Merge #10105
10105: RfC: Use `todo!()` instead of `()` for missing fields r=jonas-schievink a=jo-so

Most commonly a field of a struct can be initialized with its default value than an empty tuple.

Co-authored-by: Jörg Sommer <joerg@jo-so.de>
2021-09-24 15:12:17 +00:00
bors[bot]
377476ac45
Merge #10332
10332: minor: Allow overwriting RUST_BACKTRACE for the server manually r=jonas-schievink a=Veykril

Trying to figure out why we aren't getting backtraces for windows builds from CI, this let's one set the backtraces to `FULL`
Might be cc https://github.com/rust-lang/rust/issues/87481
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-24 14:59:02 +00:00
Lukas Wirth
983e19c868 Allow setting RUST_BACKTRACE for the server manually 2021-09-24 15:38:00 +02:00
Carlos Menezes
0c49e3883c
Fix link to "Auto Import" 2021-09-24 13:59:44 +01:00
Lukas Wirth
e60f3d265f Split the hover module up 2021-09-23 20:36:15 +02:00
Lukas Wirth
8b2be8572f Rename some assists 2021-09-21 00:54:09 +02:00
Dawer
0ff271d38f fix completion handler trying to seek outside of character boundaries.
With this patch, in these examples
```rust
fn main() {
    "⊞$0";
}
```

```rust
struct S {
д$0 u8
}
```
entering ':' character in `$0` places shouldn't cause panics.
2021-09-17 23:04:20 +05:00
bors[bot]
6eecd84771
Merge #10126
10126: feat: Speculatively expand attributes in completions r=Veykril a=Veykril

![j1OjBt5Nca](https://user-images.githubusercontent.com/3757771/133163858-91930072-1441-4ce4-9979-b0ad2727b47f.gif)

Fixes #9866

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-13 22:22:08 +00:00
Lukas Wirth
dfb94d09d4 Exclude test file from rust tidy check 2021-09-14 00:21:16 +02:00
bors[bot]
bcf0072bb4
Merge #10199
10199: fix: Fix Cargo.toml change detection r=lnicola a=lnicola

Maybe fixes #9546

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-13 18:14:20 +00:00
Laurențiu Nicola
4d7a3bb5c7 Shuffle code around to avoid an allocation 2021-09-13 21:06:31 +03:00
Lukas Wirth
edc915fbb6 Add proc-macro fixture directive 2021-09-13 18:37:50 +02:00
Laurențiu Nicola
8875f2c8aa Fix Cargo.toml change detection 2021-09-13 19:15:17 +03:00
Giles Cope
15312aab58
removing seemingly unused dev deps. 2021-09-11 16:26:36 +01:00
Giles Cope
4ccd90af81
remove unused deps 2021-09-11 16:20:04 +01:00
Jörg Sommer
c87b860d3d Use todo!() instead of () for missing fields
The generated code with `()` doesn't compile in most of the cases. To signal
the developer there's something to do, fill in `todo!()`.

Because the file *missing_fields.rs* contains the string `todo!()` it needs
an exception for the test *check_todo*.
2021-09-09 18:04:50 +02:00
Jonas Schievink
e241015a75 Rename is_member to is_local 2021-09-07 17:29:58 +02:00
David Barsky
184fbf24f0 update to tracing-tree 0.1.10, which does not pull in syn. 2021-09-06 10:33:08 -04:00
bors[bot]
5fb2eb2314
Merge #10147
10147: fix: don't panic if the client sends invalid request r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-04 13:56:47 +00:00
Aleksey Kladov
2d2c4e7c22 internal: deduplicate 2021-09-04 16:56:23 +03:00
Aleksey Kladov
33199b7e43 fix: don't panic if the client sends invalid request 2021-09-04 12:27:27 +03:00
Ali
1fd153a24e
fix error message for when DidChangeTextDocument path doesn't exist 2021-09-02 15:19:47 -07:00
Jonas Schievink
bdba35cc93 fix: multi-token mapping aware find references 2021-09-01 19:19:16 +02:00
Aleksey Kladov
81602f8a5d internal: reduce coupling
tt is a data structure, data structures cant' go wrong, they shouldn't
have the knowledge that the world outside of them has all kinds of
errors.
2021-08-31 19:14:33 +03:00
Aleksey Kladov
d8a3d6f378 internal: cleanup proc macro server error handlig
When dealing with proc macros, there are two very different kinds of
errors:

* first, usual errors of "proc macro panicked on this particular input"
* second, the proc macro server might day if the user, eg, kills it

First kind of errors are expected and are a normal output, while the
second kind are genuine IO-errors.

For this reason, we use a curious nested result here: `Result<Result<T,
E1>, E2>` pattern, which is 100% inspired by http://sled.rs/errors.html
2021-08-31 19:01:39 +03:00
Aleksey Kladov
722a2a4690 minor: improve readability
naming, layout & comments help!
2021-08-31 15:46:00 +03:00
Aleksey Kladov
8dbf3832b2 internal: split database loading time in anaysis-stats into components 2021-08-31 14:38:52 +03:00
Aleksey Kladov
53d2050085 feat: improve CPU usage
closes #9922

Turned out to be trivial after preliminary refactor.

The intended behavior is that we schedule cache priming once ws become
quiescent (that is, we fully load cargo project), and we continue to
rschedule it until it completes (priming might get cancelled by user
typing into a file).
2021-08-30 19:48:16 +03:00
Aleksey Kladov
9e0203bd69 internal: make scheduling control flow more obvious
There should be only one place where we need to check if we want to
start background activities.
2021-08-30 19:39:08 +03:00
Aleksey Kladov
a59f344c4f internal: improve consistency
Let's have only one place where we start delayed ops
2021-08-30 19:24:31 +03:00
Aleksey Kladov
6317292cd5 internal: more obviously correct code for cache priming progerss
It doesn't make sense for the prime_caches itself send begin/end events
-- the caller knows perfectly fine when they happen!
2021-08-30 19:18:48 +03:00
bors[bot]
1636f61a15
Merge #10005
10005: Extend `CargoConfig.unset_test_crates`  r=matklad a=regexident

This is to allow for efficiently disabling `#[cfg(test)]` on all crates (by passing `unset_test_crates: UnsetTestCrates::All`) without having to first load the crate graph, when using rust-analyzer as a library.

(FYI: The change doesn't seem to be covered by any existing tests.)

Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-08-30 08:42:13 +00:00