Commit graph

54 commits

Author SHA1 Message Date
Aleksey Kladov
55ba353b39 Don't expose SyntaxKind from IDE API
SyntaxKind is somewhat of an internal type, but IDE is using it to
basically specify an icon. Let's have a dedicated entity for this
instead.
2020-12-18 19:28:48 +03:00
Jesse Bakker
700034bd5a Do not merge imports with different attributes 2020-12-18 15:29:37 +01:00
Aleksey Kladov
2ae31e34b1 Rename ImplDef -> Impl
We used to have `Def` suffix for all symbols, but we moved off from
that. `FunctionDef` isn't better than `Function`. Looks like we've
forgot to change `Impl` though!
2020-12-17 14:36:15 +03:00
bors[bot]
d641bccb0f
Merge #6907
6907: Lifetime reference search  r=matklad a=Veykril

PR #6787 but rewritten to make use of the HIR now. This only applies to Lifetimes, not labels. Also Higher-Ranked Trait Bounds aren't supported yet, but I feel like this PR is big enough as is which is why I left them out after noticing I forgot about them.

Supporting renaming required slight changes in the renaming module as lifetime names aren't allowed for anything but lifetimes(and labels) and vice versa for normal names.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-17 11:00:39 +00:00
Jonas Schievink
21b68a328c Remove module_lang_items
It isn't used anywhere except in `crate_lang_items`. Remove it to
slightly reduce memory usage and simplify the code.
2020-12-17 00:26:01 +01:00
Lukas Wirth
55faa2daa3 Lifetime reference search 2020-12-16 22:21:01 +01:00
Jonas Schievink
c1cb595382 Move to upstream macro_rules! model 2020-12-15 15:37:37 +01:00
Daiki Ihara
36a9daac70 Add find usages for enum constructors 2020-12-15 00:39:42 +09:00
Aleksey Kladov
17f236c2b0 Normalize spelling to American English 2020-12-10 17:51:56 +03:00
Aleksey Kladov
6e24321e45 Introduce anchored_path
They allow to represent paths like `#[path = "C:\path.rs"] mod foo;`
in a lossless cross-platform & network-transparent way.
2020-12-09 19:07:05 +03:00
bors[bot]
2aa7f2ece5
Merge #6750
6750: Remove documentation query, move doc handling to attributes r=matklad a=Veykril

Fixes #3182

Removes the documentation query in favor of `Attrs::docs`. Attrs already handlded doc comments partially but the alloc saving check was wrong so it only worked when other attributes existed as well. Unfortunately the `new` constructor has to do an intermediate allocation now because we need to keep the order of mixed doc attributes and doc comments.

I've also partially adjusted the `hover` module to have its tests check the changes, it still has some `HasSource` trait usage due to the `ShortLabel` trait usage, as that is only implemented on the Ast parts and not the Hir, should this ideally be implemented for the Hir types as well?(would be a follow up PR of course)

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-08 13:23:12 +00:00
Kirill Bulatov
bf24cb3e8d Tweak the search query params for better lookup speed 2020-12-08 15:05:09 +02:00
Kirill Bulatov
3183ff3a7b Disable the completion for no corresponding client resolve capabilities 2020-12-08 01:07:20 +02:00
Kirill Bulatov
93bc009a59 Remove the state 2020-12-07 23:41:08 +02:00
Kirill Bulatov
74c3bbacc9 Make completion resolve async 2020-12-07 23:41:08 +02:00
Lukas Wirth
b3652ef288 Remove documentation query 2020-12-07 19:58:17 +01:00
Jonas Schievink
b9d947cc6f Add slightly more profiling details 2020-12-04 20:26:28 +01:00
Daiki Ihara
f486640682 Extract tests module to file in ide_db crate 2020-12-04 00:05:39 +09:00
Lukas Wirth
ec94657077 Fix use merging not using the first path segment 2020-11-30 17:21:07 +01:00
Lukas Wirth
de4ada22d4 Support self in reference search 2020-11-29 20:54:17 +01:00
Kirill Bulatov
3f612d37c6 Move the helpers into ide_db 2020-11-28 16:30:39 +02:00
bors[bot]
db6988d4e7
Merge #6614 #6632
6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore

Presumably closes https://github.com/rust-analyzer/rust-analyzer/issues/6594
May help https://github.com/rust-analyzer/rust-analyzer/issues/6612

* Ignore modules eaferly
* Do less completion string rendering

6632: Pin cargo_metadata r=matklad a=kjeremy

See: https://github.com/oli-obk/cargo_metadata/pull/142#issuecomment-733653275

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-26 10:43:35 +00:00
Jonas Schievink
9559bce311 Rename parse_macro to parse_macro_expansion
This does not parse macros, it expands a macro and parses the *result*
2020-11-24 21:57:51 +01:00
Kirill Bulatov
4baac238a8 Improve autoimports on completion speed
* Ignore modules eaferly
* Do less completion string rendering
2020-11-24 02:28:45 +02:00
Kirill Bulatov
4109968934 Remove query aliases 2020-11-16 21:24:54 +02:00
Kirill Bulatov
46514448b7 Tweak the search limits a bit 2020-11-16 21:19:06 +02:00
Kirill Bulatov
4c8edd003a Use imports_locator 2020-11-16 21:19:06 +02:00
Kirill Bulatov
f62e8616c8 Add imports in auto completion 2020-11-16 21:19:05 +02:00
Lukas Wirth
cb60708274 Use shorthand field syntax in destructures 2020-11-14 21:08:20 +01:00
Lukas Wirth
e55a44a831 Use shorthand record syntax when renaming struct initializer field 2020-11-14 17:51:09 +01:00
bors[bot]
bf84e4958e
Merge #6331 #6342
6331: correct hover text for items with doc attribute with raw strings r=matklad a=JoshMcguigan

Fixes #6300 by improving the handling of raw string literals in attribute style doc comments.

This still has a bug where it could consume too many `"` at the start or end of the comment text, just as the original code had. Not sure if we want to fix that as part of this PR or not? If so, I think I'd prefer to add a unit test for either the `as_simple_key_value` function (I'm not exactly sure where this would belong / how to set this up) or create a `fn(&SmolStr) -> &SmolStr` to unit test by factoring out the `trim` operations from `as_simple_key_value`. Thoughts on this? 

6342: Shorter dependency chain r=matklad a=popzxc

Continuing implementing suggestions from the `Completion refactoring` zulip thread.

This PR does the following:

- Removes dependency of `completions` on `assists` by moving required functionality into `ide_db`.
- Moves completely `call_info` crate into `ide_db` as it looks like it fits perfect there.
- Adds a bunch of new tests and docs.
- Adds the re-export of `base_db` to the `ide_db` and removes direct dependency on `base_db` from other crates.

The last point is controversial, I guess, but I noticed that in places where `ide_db` is used, `base_db` is also *always* used. Thus I think the dependency on the `base_db` is implied by the fact of `ide_db` interfaces, and thus it makes sense to just provide `base_db` out of the box.


Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-10-24 19:08:12 +00:00
Laurențiu Nicola
09468ce370 Bump deps 2020-10-24 17:10:36 +03:00
Igor Aleksanov
19cce08662 Re-export base_db from ide_db 2020-10-24 11:39:57 +03:00
Igor Aleksanov
2c787676c9 Add tests for traits functions in ide_db 2020-10-24 11:29:16 +03:00
Igor Aleksanov
b6ea56ea09 Make call_info a part of ide_db 2020-10-24 11:07:10 +03:00
Igor Aleksanov
8d3d509af7 Remove dependency on 'assists' from 'completion' crate 2020-10-24 10:47:23 +03:00
Aleksey Kladov
c5868a4879 Clarify the names one more time 2020-10-15 17:38:51 +02:00
Aleksey Kladov
56e67e3a39 More idiomatic classification API 2020-10-15 17:38:17 +02:00
Aleksey Kladov
f9c1336873 More clarifications 2020-10-15 17:37:55 +02:00
Aleksey Kladov
bc287b8f9b Unconfuse expression and pattern field init shorthands 2020-10-15 17:37:36 +02:00
Aleksey Kladov
fa3c449d8f Clarify NameClass names a bit 2020-10-15 17:37:36 +02:00
Jonas Schievink
210456aeaa Treat ast::Name in field patterns as use 2020-10-09 19:56:54 +02:00
Aleksey Kladov
8716c4cec3 Move ide::AnalysisChange -> base_db::Change
This seems like a better factoring logically; ideally, clients shouldn't touch
`set_` methods of the database directly. Additionally, I think this
should remove the unfortunate duplication in fixture code.
2020-10-02 16:45:08 +02:00
Aleksey Kladov
e7df0ad2fb Remove periodic gc stub 2020-09-29 21:22:48 +02:00
Pavan Kumar Sunkara
4d97f5f037 Rename record_field_pat to record_pat_field 2020-09-10 18:56:04 +02:00
Pavan Kumar Sunkara
335add49db Add description for crates that will be published 2020-08-24 13:07:22 +02:00
Pavan Kumar Sunkara
a8fa5cd42e Add version to deps in cargo.toml 2020-08-24 11:10:41 +02:00
Aleksey Kladov
e262149b7c Optimize reference search 2020-08-20 00:54:44 +02:00
Aleksey Kladov
4b5b55f6f3 **Remove Unused Parameter** refactoring 2020-08-19 19:40:55 +02:00
Aleksey Kladov
81b0976187 Future proof find-usages API
We might want to provide more efficient impls for check if usages
exist, limiting the search, filtering and cancellation, so let's
violate YAGNI a bit here.
2020-08-19 18:58:48 +02:00