Commit Graph

7428 Commits

Author SHA1 Message Date
Aleksey Kladov
9ce9a4ae0d Simplify tests 2020-07-08 23:06:15 +02:00
Aleksey Kladov
e4b4600752 better language 2020-07-08 22:47:50 +02:00
Aleksey Kladov
e8bb153b19 Add Markup type 2020-07-08 22:37:35 +02:00
Aleksey Kladov
16dcf020c4 simplify 2020-07-08 20:35:54 +02:00
Aleksey Kladov
d74a77efb1 Minimize API 2020-07-08 20:35:54 +02:00
Aleksey Kladov
7238acab78 Dead code 2020-07-08 20:35:54 +02:00
Aleksey Kladov
86aac4303f Reduce visibility 2020-07-08 19:41:57 +02:00
Aleksey Kladov
dab7f3d2c6 Remove relative_path dependency 2020-07-08 19:32:36 +02:00
Aleksey Kladov
7ae696ba76 Remove unwanted dependency 2020-07-08 18:26:31 +02:00
Aleksey Kladov
35e4bb3506 Document failed refactor 2020-07-08 18:17:45 +02:00
kjeremy
4b7f473223 Clippy perf warnings 2020-07-08 09:45:29 -04:00
Aleksey Kladov
69b79e3a73 Replace ad hocery with science 2020-07-07 23:28:48 +02:00
Aleksey Kladov
5d2225f4bc Fix symbol search in salsa
Previous solution for binning paths into disjoint directories was
simple and fast -- just a single binary search.

Unfortunatelly, it wasn't coorrect: if the ditr are

  /d
  /d/a
  /d/c

then partitioning the file /d/b/lib.rs won't pick /d as a correct
directory.

The correct solution here is a trie, but it requires exposing path
components.

So, we use a poor man's substitution -- a *vector* of sorted paths,
such that each bucket is prefix-free

closes #5246
2020-07-07 17:38:02 +02:00
Aleksey Kladov
9effc6116f Upstream salsa 2020-07-07 15:48:55 +02:00
bors[bot]
73e972a173
Merge #5244
5244: Add a command to compute memory usage statistics r=matklad a=jonas-schievink

This allows inspecting memory usage on a live rust-analyzer instance after it has been used interactively.

This will only work with `--features jemalloc`, so maybe it should print something more useful when that's not available? Right now it will just print 0 Bytes for every query.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-07 11:00:04 +00:00
bors[bot]
0719f2824c
Merge #5247
5247: Modernize unqualified reference completion tests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-07 10:52:54 +00:00
Aleksey Kladov
5b8a5bfb15 Modernize unqualified reference completion tests 2020-07-07 12:52:09 +02:00
bors[bot]
687fb031d2
Merge #5245
5245: Refactor AssistBuilder to manage a SourceChange r=matklad a=theduke

`AssistBuilder` now managaes a full `SourceChange` instead of a
`Vec<SourceFileEdit>`.

This prepares AssistBuilder to handle creation of new files.


Co-authored-by: Christoph Herzog <chris@theduke.at>
2020-07-07 10:25:17 +00:00
Christoph Herzog
3360118040 Refactor AssistBuilder to manage a SourceChange
`AssistBuilder`` now managaes a full `SourceChange` instead of a
Vec<SourceFileEdit>.

This prepares AssistBuilder to handle creation of new files.
2020-07-07 12:10:18 +02:00
Jonas Schievink
f44c4b61e1 Add a command to compute memory usage statistics 2020-07-07 12:10:14 +02:00
Aleksey Kladov
9b2847885d cleanup 2020-07-07 11:44:16 +02:00
bors[bot]
0f5d62a3f3
Merge #5235 #5236 #5241
5235: Don't ping people in PRs r=matklad a=lnicola



5236: Disable ES module interop r=matklad a=lnicola



5241: Clippy perf warnings r=matklad a=kjeremy

Removes redundant clones

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-07 09:29:52 +00:00
Aleksey Kladov
4bbc385277 Switch to fully dynamically dispatched salsa
This improves compile times quite a bit
2020-07-07 10:14:48 +02:00
kjeremy
ebdee366b0 Clippy perf warnings
Removes redundant clones
2020-07-06 17:13:55 -04:00
Aleksey Kladov
23258d8436 Simplify file watcher 2020-07-06 09:28:17 +02:00
bors[bot]
8b0983e89a
Merge #5228
5228: Fix typo r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-05 09:24:58 +00:00
Aleksey Kladov
569504938e Fix typo 2020-07-05 11:19:16 +02:00
Aleksey Kladov
4be73c2b7f AbsPath 2020-07-05 11:15:35 +02:00
Aleksey Kladov
453167b492 Modernise item completion tests 2020-07-04 23:25:33 +02:00
Paul Daniel Faria
5b96d4103e Fallback to target in cfg if not specified in project json config 2020-07-04 13:50:27 -04:00
Paul Daniel Faria
db99f2dd7e Add optional target to crates in json project, lookup default cfgs per target when generating cfg list 2020-07-04 13:49:44 -04:00
Aleksey Kladov
943fa46395 Alight details in comkplation list 2020-07-04 19:03:58 +02:00
Aleksey Kladov
c14a3b4a20 Modernize qual path completion tests 2020-07-04 18:53:30 +02:00
Aleksey Kladov
824a24c710 Modernize snippet completion tests 2020-07-04 18:03:34 +02:00
Aleksey Kladov
3902e5574c Add Item change to the set of benches 2020-07-04 17:04:33 +02:00
Aleksey Kladov
000d1db351 Fix bench to work with relative paths 2020-07-04 17:03:02 +02:00
Aleksey Kladov
ba9c398144 Modernize postfix completion tests 2020-07-04 15:44:21 +02:00
Aleksey Kladov
7a7fd6d239 Modernize pattern completion tests 2020-07-04 15:10:55 +02:00
Aleksey Kladov
9dacd2338c Fix lookup in tests 2020-07-04 15:05:33 +02:00
Aleksey Kladov
216e093f90 Macro tests 2020-07-04 15:04:57 +02:00
Aleksey Kladov
03ca33406e Modernize tests 2020-07-04 14:53:43 +02:00
Aleksey Kladov
f2f6a46aa4 Cleanup dot completiont tests 2020-07-04 10:41:50 +02:00
Aleksey Kladov
caeddff543 Comments 2020-07-04 10:03:27 +02:00
Aleksey Kladov
5c68dd6b59 Better tests for completion scoring 2020-07-04 09:53:54 +02:00
Aleksey Kladov
aaba2300fb Modernize completion presentation tests 2020-07-04 09:36:53 +02:00
Aleksey Kladov
65768feaff Unify naming 2020-07-04 09:08:51 +02:00
Aleksey Kladov
6518f18f80 Cleanup tests 2020-07-04 09:07:18 +02:00
bors[bot]
212fa29a69
Merge #5197
5197: SSR internal refactorings r=davidlattimore a=davidlattimore

- Extract error code out to a separate module
- Improve error reporting when a test fails
- Refactor matching code
- Update tests so that all paths in search patterns can be resolved

Co-authored-by: David Lattimore <dml@google.com>
2020-07-04 00:13:11 +00:00
David Lattimore
a354e5b5cf SSR: Update tests so that all paths in patterns can be resolved 2020-07-04 08:56:58 +10:00
David Lattimore
69051d2f9d SSR: Refactor matching code.
Mutable state is now stored in the enum Phase.
MatchState, since it now has no mutable state is renamed Matcher.
MatchInputs is merged into Matcher
2020-07-04 08:56:58 +10:00
David Lattimore
4a8679824b SSR: Improve error reporting when a test fails 2020-07-04 08:56:58 +10:00
David Lattimore
a5ef644a16 SSR: Extract error code out to a separate module
This is to make reusing it outside of parsing easier in a subsequent
change.
2020-07-04 08:56:51 +10:00
Aleksey Kladov
cda1a6c638 Cleanup more completion tests 2020-07-04 00:01:45 +02:00
Aleksey Kladov
9f9b38bdb4 Cleanup presentation tests 2020-07-03 23:15:44 +02:00
Aleksey Kladov
d09f692300 Add AssistKind::Generate 2020-07-03 19:32:18 +02:00
Aleksey Kladov
66b6a433c6 Unify naming of generating assists 2020-07-03 19:32:18 +02:00
bors[bot]
a434ecef51
Merge #5212
5212: Fix module renaming r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-03 16:55:01 +00:00
Aleksey Kladov
f4a3bc30b8 Fix module renaming 2020-07-03 18:47:26 +02:00
Aleksey Kladov
4c347a9f65 Compress rename tests 2020-07-03 18:39:36 +02:00
Aleksey Kladov
2656c415c8 Use expect for rename tests 2020-07-03 18:35:43 +02:00
Aleksey Kladov
ee7ab0104d Adhere to code style in rename tests 2020-07-03 18:29:37 +02:00
bors[bot]
7ad7f3ca8c
Merge #5211
5211: Fix inference of indexing argument (partly) r=flodiebold a=flodiebold

We need to add the `T: Index<Arg>` obligation to be resolved later as well, otherwise we can't make inferences about `Arg` later based on the `Index` impls.

This still doesn't fix indexing with integer variables though; there's a further problem with Chalk floundering because of the variable, I think.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-07-03 16:18:34 +00:00
Florian Diebold
57feb323f7 Fix inference of indexing argument (partly)
We need to add the `T: Index<Arg>` obligation to be resolved later as well,
otherwise we can't make inferences about `Arg` later based on the `Index` impls.

This still doesn't fix indexing with integer variables though; there's a further
problem with Chalk floundering because of the variable, I think.
2020-07-03 18:17:06 +02:00
bors[bot]
0f68fed4a0
Merge #5209
5209: Fixes to memory usage stats r=matklad a=jonas-schievink

This brings the unaccounted memory down from 287mb to 250mb, and displays memory used by VFS and "other" allocations.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-03 15:58:46 +00:00
Aleksey Kladov
b8ef8539a6 Fix workspace reloading 2020-07-03 17:19:00 +02:00
Jonas Schievink
f01e7e3601 Track VFS and remaining/unaccounted memory 2020-07-03 17:16:01 +02:00
Jonas Schievink
93d0ac7fa0 Fix memory usage accounting for interned queries 2020-07-03 17:12:29 +02:00
bors[bot]
88a602f305
Merge #5205
5205: Refactor attribut completion tests r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-03 14:06:13 +00:00
Aleksey Kladov
314efae29d Refactor attribut completion tests 2020-07-03 15:59:37 +02:00
Aleksey Kladov
f1671f460b Compress attribute completion tests 2020-07-03 15:38:53 +02:00
bors[bot]
f51b0cfdd6
Merge #5116
5116: Categorize assists r=matklad a=kjeremy

Categorize assists so that editors can use them. Follows the LSP spec pretty close (and some things may need adjustments) but this populates the Refactor menu in vscode and pushes quickfixes through again.

This is a prerequisite to filtering out assists that the client doesn't care about.

Fixes #4147

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-03 12:44:09 +00:00
Aleksey Kladov
503de8e229 Add function to test completion edit 2020-07-03 13:21:48 +02:00
Aleksey Kladov
e2b04621f9 Refactor keyword completion tests 2020-07-03 12:51:18 +02:00
Aleksey Kladov
0e23175a07 Cleanup record completion tests 2020-07-03 11:48:48 +02:00
kjeremy
4c9347ecc3 Don't categorize things we don't care about 2020-07-02 18:01:22 -04:00
kjeremy
36cc81ac71 Move AssistKind into AssistId 2020-07-02 17:48:35 -04:00
kjeremy
1d58e16824 Recategorize a few 2020-07-02 17:14:15 -04:00
Jeremy Kolb
b98c16a034 Categorize assists 2020-07-02 17:13:02 -04:00
bors[bot]
4cb8bf03c5
Merge #5192
5192: Implement rust-analyzer feature configuration to tests. r=matklad a=daxpedda

Fixes #3198.

I'm unsure if it is desired this way, maybe we want to make a seperate configuration?

Co-authored-by: daxpedda <daxpedda@gmail.com>
2020-07-02 15:48:54 +00:00
Aleksey Kladov
6c7578bd7a Move cargo metadata off the main loop 2020-07-02 17:39:51 +02:00
daxpedda
eb75a644a1
Implement rust-analyzer feature configuration to tests. 2020-07-02 16:13:24 +02:00
bors[bot]
83f3cdca4f
Merge #5191
5191: Minor r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:10:13 +00:00
Aleksey Kladov
6a694ad047 Minor 2020-07-02 16:06:00 +02:00
bors[bot]
1a3a7f4237
Merge #5188
5188: Implement StatusBar r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-07-02 14:02:52 +00:00
bors[bot]
e75b4fc85e
Merge #5189
5189: Record and suggest assoc. items of traits via ImportMap r=matklad a=jonas-schievink

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

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-02 13:55:14 +00:00
Jonas Schievink
6ee73cd334 Use SmolStr 2020-07-02 15:42:37 +02:00
Aleksey Kladov
4f26a3734e Indicate when project needs a reload 2020-07-02 15:34:12 +02:00
Aleksey Kladov
3ef7676076 Implement StatusBar 2020-07-02 15:32:14 +02:00
Jonas Schievink
361b399b6d Fix tests 2020-07-02 13:34:08 +02:00
Jonas Schievink
31f5b48817 Record and suggest trait items via ImportMap 2020-07-02 12:43:52 +02:00
bors[bot]
57ed622ec4
Merge #5089 #5161 #5184 #5185 #5186
5089: Disable auto-complete on comments r=matklad a=BGluth

Resolves #4907 by disabling any auto-completion on comments.

As flodiebold [pointed out](https://github.com/rust-analyzer/rust-analyzer/issues/4907#issuecomment-648439979), in the future we may want to support some form of auto-completion within doc comments, but for now it was suggested to just disable auto-completion on them entirely.

The implementation involves adding a new field `is_comment` to `CompletionContext` and checking if the immediate token we auto-completed on is a comment. I couldn't see a case where we need to check any of the ancestors, but let me know if this is not sufficient. I also wasn't sure if it was necessary to add a new field to this struct, but I decided it's probably the best option if we want to potentially do auto-completion on doc comments in the future.

Finally, the three tests I added should I think ideally not filter results by `CompletionKind::Keyword`, but if I want to get unfiltered results, I need access to a non-public function [get_all_completion_items](9a4d02faf9/crates/ra_ide/src/completion/test_utils.rs (L32-L39)) which I don't know if I should make public just for this.



5161: SSR: Add initial support for placeholder constraints r=matklad a=davidlattimore



5184: Always install required nightly extension if current one is not nightly r=matklad a=Veetaha

This is weird, but having switched back to stable by uninstalling the extension appears that vscode doesn't destroy the `PersistentState` and thus changing to `nightly` channel doesn't work because the last check for nightly extension was less than 1 hour ago. The simple solution is to skip this check if we know that the current extension version is not nightly.

5185: Force showing extension activation error pop-up notification r=matklad a=Veetaha

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

5186: fix: correct pd/ppd/tfn/tmod completion doc r=matklad a=fannheyward

a33eefa3b2/crates/ra_ide/src/completion/complete_snippet.rs (L23-L24)

Co-authored-by: BGluth <gluthb@gmail.com>
Co-authored-by: David Lattimore <dml@google.com>
Co-authored-by: Veetaha <veetaha2@gmail.com>
Co-authored-by: Heyward Fann <fannheyward@gmail.com>
2020-07-02 09:12:46 +00:00
Heyward Fann
f1986be8fd fix: correct pd/ppd/tfn/tmod completion doc
a33eefa3b2/crates/ra_ide/src/completion/complete_snippet.rs (L23)
2020-07-02 11:06:00 +08:00
David Lattimore
83588a1c45 SSR: Use T! instead of SyntaxKind::* where possible 2020-07-02 09:19:58 +10:00
BGluth
cc77bdf59a Auto-completion no longer occurs on comments 2020-07-01 15:20:07 -06:00
BGluth
0bbd6428ad Added tests for no auto-completion on comments 2020-07-01 15:16:47 -06:00
bors[bot]
a33eefa3b2
Merge #5149
5149: Implement Chalk variable kinds r=flodiebold a=flodiebold

This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.)

Should fix the last remaining issue of #2534.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-07-01 18:41:06 +00:00
Florian Diebold
d5d485ef92 Implement Chalk variable kinds
This means we need to keep track of the kinds (general/int/float) of variables
in `Canonical`, which requires some more ceremony. (It also exposes some places
where we're not really dealing with canonicalization correctly -- another thing
to be cleaned up when we switch to using Chalk's types directly.)

Should fix the last remaining issue of #2534.
2020-07-01 20:40:38 +02:00
bors[bot]
ec1d1a1b70
Merge #5179
5179: ItemTree: Lower fields despite invalid type r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-07-01 17:28:12 +00:00
Jonas Schievink
4ef1d533bd ItemTree: Lower fields despite invalid type 2020-07-01 19:24:39 +02:00
bors[bot]
43dfd29d8d
Merge #5174
5174: Colorize more test fixtures r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-07-01 17:20:02 +00:00