Commit graph

193 commits

Author SHA1 Message Date
Aleksey Kladov
7e73b7a5f8 Minor rename 2020-02-06 18:47:26 +01:00
Aleksey Kladov
ad204f7562 Mostly remove ImoportLocator infra 2020-02-06 17:17:51 +01:00
Aleksey Kladov
a173e31890 Make assists use ImportsLocator directly 2020-02-06 16:40:28 +01:00
Aleksey Kladov
dfbe96750b Move imports locator to ide_db 2020-02-06 16:26:43 +01:00
Aleksey Kladov
271017e6bf Move NameKind up 2020-02-06 16:23:28 +01:00
Aleksey Kladov
f8dde21fe9 Simplify 2020-02-06 16:00:39 +01:00
Aleksey Kladov
832dfae250 Tweak goto parent module 2020-02-06 15:47:33 +01:00
Aleksey Kladov
8a39519e1c Cleanup 2020-02-06 15:10:07 +01:00
Aleksey Kladov
88267c86c0 cleanup imports 2020-02-06 14:03:45 +01:00
Aleksey Kladov
939f05f3e3 Move to a crate 2020-02-06 12:43:56 +01:00
Aleksey Kladov
1bfb111cf9 Move change to ide-db 2020-02-06 12:35:40 +01:00
Aleksey Kladov
ee76e6141e Fix test imports 2020-02-06 12:26:10 +01:00
Aleksey Kladov
0509a0a34e Move Query 2020-02-06 12:24:13 +01:00
Aleksey Kladov
ad247aa670 Move symbol_index 2020-02-06 12:22:35 +01:00
Aleksey Kladov
ec95152a4e Move FeatureFlags 2020-02-06 12:18:52 +01:00
Aleksey Kladov
ee2ee1a8ff Move line_index 2020-02-06 12:17:40 +01:00
Aleksey Kladov
551f33d754 Move ide-db 2020-02-06 12:08:08 +01:00
Aleksey Kladov
896906fea8 Start ide_db 2020-02-06 12:07:06 +01:00
Kirill Bulatov
78092c7c66 Apply the reviews suggestions 2020-02-05 12:47:28 +02:00
Aleksey Kladov
f5a20014ce minor, if let else -> match 2020-02-04 13:41:56 +01:00
Veetaha
9e7eaa959f ra_syntax: refactored the lexer design as per @matklad and @kiljacken PR review 2020-02-04 00:00:55 +02:00
Veetaha
ac37a11f04 Reimplemented lexer with vectors instead of iterators 2020-02-04 00:00:55 +02:00
Kirill Bulatov
fcf5bbbbeb Fix inlay hints test snippet compilation 2020-02-03 13:35:14 +02:00
Aleksey Kladov
24ad1cce2c Avoid premature pessimization
The extra allocation for message should not matter here at all, but
using a static string is just as ergonomic, if not more, and there's
no reason to write deliberately slow code
2020-02-02 18:56:37 +01:00
Kirill Bulatov
c669b2f489 Code review fixes 2020-02-02 14:27:52 +02:00
Kirill Bulatov
6dae5cbb11 Require ModPath for importing 2020-02-02 14:06:51 +02:00
Aleksey Kladov
f1720d7983 Re-sync queries for memory usage measurnment 2020-01-29 16:10:46 +01:00
Mikhail Modin
fbc3ffcee6 Improves reference search by StructLiteral 2020-01-27 21:34:19 +00:00
bors[bot]
1d729033eb
Merge #2883
2883: Implement Syntax Highlight inside macro call r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-01-27 13:36:26 +00:00
bors[bot]
4f9506416c
Merge #2887
2887: Initial auto import action implementation r=matklad a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2180

Adds an auto import action implementation.

This implementation is not ideal and has a few limitations:

* The import search functionality should be moved into a separate crate accessible from ra_assists.
This requires a lot of changes and a preliminary design. 
Currently the functionality is provided as a trait impl, more on that here: https://github.com/rust-analyzer/rust-analyzer/issues/2180#issuecomment-575690942

* Due to the design desicion from the previous item, no doctests are run for the new aciton (look for a new FIXME in the PR)

* For the same reason, I have to create the mock trait implementaion to test the assist

* Ideally, I think we should have this feature as a diagnostics (that detects an absense of an import) that has a corresponding quickfix action that gets evaluated on demand.
Curretly we perform the import search every time we resolve the import which looks suboptimal.
This requires `classify_name_ref` to be moved from ra_ide, so not done currently.

A few improvements to the imports mechanism to be considered later:

* Constants like `ra_syntax::SyntaxKind::NAME` are not imported, because they are not present in the database

* Method usages are not imported, they are found in the database, but `find_use_path` does not return any import paths for them

* Some import paths returned by the `find_use_path` method end up in `core::` or `alloc::` instead of `std:`, for example: `core::fmt::Debug` instead of `std::fmt::Debug`.
This is not an error techically, but still looks weird.

* No detection of cases where a trait should be imported in order to be able to call a method

* Improve `auto_import_text_edit` functionality: refactor it and move away from the place it is now, add better logic for merging the new import with already existing imports

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-01-27 13:04:53 +00:00
Kirill Bulatov
9be1ab7ff9 Code review fixes 2020-01-27 14:42:45 +02:00
Kirill Bulatov
d0a782ef1c Have a better trait interface 2020-01-27 00:17:10 +02:00
Kirill Bulatov
bef5cf0b99 Raise the import search query cap 2020-01-27 00:16:29 +02:00
Kirill Bulatov
f57239729c Remove unnecessary lifetime parameter 2020-01-27 00:16:29 +02:00
Kirill Bulatov
316795e074 Initial auto import action implementation 2020-01-27 00:16:29 +02:00
Jeremy Kolb
b89991daed Update crates 2020-01-26 10:46:45 -05:00
bors[bot]
adda6dbdf8
Merge #2899
2899: Provide more runners for potential tests r=matklad a=SomeoneToIgnore

Based on the https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Runners.20for.20custom.20test.20annotations discussion.

Adds a test runner for every method that has an annotation that contains `test` word in it, allowing to run tests annotated with custom testing annotations such as `#[tokio::test]`, `#[test_case(...)]` and others at costs of potentially emitting some false-positives.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-01-25 11:10:28 +00:00
Aleksey Kladov
b90ea640e6 Cancel requests during shutdown 2020-01-24 16:35:37 +01:00
Kirill Bulatov
3137215e8d Provide more runners for potential tests 2020-01-23 13:40:21 +02:00
Kirill Bulatov
4029e44102 Omit default parameters for reference types 2020-01-22 16:55:09 +02:00
Edwin Cheng
f320af4d63 Implement Syntax Highlight inside Macro 2020-01-21 00:06:47 +08:00
Florian Diebold
18ec4e3403 Improve parameter hints a bit & add emacs support
- just include the name, not e.g. `mut`
 - don't return empty hints (or `_`)
2020-01-18 13:40:32 +01:00
Aleksey Kladov
595b06a1b8 Create modules via SourceBinder 2020-01-16 17:33:07 +01:00
Aleksey Kladov
9a6c26e348 Move module to SourceBinder 2020-01-16 16:53:11 +01:00
Aleksey Kladov
7aa627fe58 Move more stuff to SourceBinder 2020-01-16 16:37:51 +01:00
Aleksey Kladov
a3d6ddbe69 More natural trait setup 2020-01-16 16:27:21 +01:00
Aleksey Kladov
81a45ca1b3 Make FromSource private 2020-01-16 16:08:46 +01:00
Aleksey Kladov
272f6dfd9e Micro-optimize type hints to avoid allocations 2020-01-16 14:31:34 +01:00
bors[bot]
c78d269b66
Merge #2837
2837: Accidentally quadratic r=matklad a=matklad

Our syntax highlighting is accdentally quadratic. Current state of the PR fixes it in a pretty crude way, looks like for the proper fix we need to redo how source-analyzer works. 

**NB:** don't be scared by diff stats, that's mostly a test-data file

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-01-15 19:38:10 +00:00
Kirill Bulatov
d51cf7794d itertools::Either -> either::Either 2020-01-15 20:20:20 +02:00