Jeroen Vannevel
73e49493bd
rough, but appears to work
2022-02-15 14:39:22 +00:00
Lukas Wirth
661d721e20
Add completion module tailored towards use trees
2022-02-03 15:51:57 +01:00
Lukas Wirth
6940cca760
Move attribute path completions into attribute completion module
2022-02-03 15:50:14 +01:00
Florian Diebold
4ed5fe1554
Fix assoc type shorthand from method bounds
...
In code like this:
```rust
impl<T> Option<T> {
fn as_deref(&self) -> T::Target where T: Deref {}
}
```
when trying to resolve the associated type `T::Target`, we were only
looking at the bounds on the impl (where the type parameter is defined),
but the method can add additional bounds that can also be used to refer
to associated types. Hence, when resolving such an associated type, it's
not enough to just know the type parameter T, we also need to know
exactly where we are currently.
This fixes #11364 (beta apparently switched some bounds around).
2022-02-03 13:15:02 +01:00
Lukas Wirth
d7a544e69a
fix: Complete functions and methods from block level impls
2022-02-01 23:29:40 +01:00
Lukas Wirth
45ff51ba22
Make more precise range macro upmapping
2022-01-31 15:53:44 +01:00
Lukas Wirth
6194092086
Complete local fn and closure params from surrounding locals scope
2022-01-31 11:56:42 +01:00
Lukas Wirth
ddf7b70a0f
Fix cfg_attr invalidating derive identifier IDE functionality
2022-01-30 22:47:16 +01:00
Lukas Wirth
cc04cfc982
Reduce allocations in attribute collection
2022-01-30 22:18:32 +01:00
Lukas Wirth
ebd723995a
fix: don't panic in semantics due to cfg_attr
disrupting offsets
2022-01-23 17:42:38 +01:00
Jonas Schievink
8a7f0d920e
Allow macros to expand to or-patterns
2022-01-17 16:52:53 +01:00
Lukas Wirth
82fccb971e
feat: Add very simplistic ident completion for format_args! macro input
2022-01-15 12:23:26 +01:00
bors[bot]
fc331fe831
Merge #11282
...
11282: fix: Properly cache files in Semantics when ascending macros r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11280
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-14 10:08:27 +00:00
Lukas Wirth
f1cb5ed9b0
fix: Properly cache files in Semantics when ascending macros
2022-01-14 11:07:53 +01:00
Lukas Wirth
2f8dd64830
Replace HasSource usages with Semantics equivalent
2022-01-14 10:59:27 +01:00
Jonas Schievink
3fde9f820a
Unexport MacroDefId
from hir
2022-01-13 16:18:05 +01:00
Jonas Schievink
18e80e6892
Remove ModuleId
from hir
reexports
2022-01-12 20:21:13 +01:00
Jonas Schievink
09219e10f1
Mostly restore hir
API boundary
2022-01-12 19:56:47 +01:00
Jonas Schievink
0706de94bb
Report DefDiagnostic
s from inside item bodies
2022-01-11 14:34:25 +01:00
bors[bot]
5a711d4f3a
Merge #11210
...
11210: feat: Deprioritize ops methods in completion r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10593
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-11 09:39:12 +00:00
Lukas Wirth
ca0633c808
feat: Deprioritize ops methods in completion
2022-01-11 09:26:53 +01:00
Lukas Wirth
47591f0fb2
Remove InFile
wrapping from DynMap keys
2022-01-08 12:16:44 +01:00
Lukas Wirth
6746ba5839
Record attribute calls on assoc items in TraitData and ImplData
2022-01-08 10:45:12 +01:00
bors[bot]
41a0e95d61
Merge #11230
...
11230: fix: Fix attribute stripping ignoring doc comments r=Veykril a=Veykril
Follow up to https://github.com/rust-analyzer/rust-analyzer/pull/11225#pullrequestreview-846779237
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-07 18:06:33 +00:00
Lukas Wirth
81163b8cd4
fix: Fix attribute stripping ignoring doc comments
2022-01-07 18:51:10 +01:00
bors[bot]
40009e07d0
Merge #11145
...
11145: feat: add config to use reasonable default expression instead of todo! when filling missing fields r=Veykril a=bnjjj
Use `Default::default()` in struct fields when we ask to fill it instead of putting `todo!()` for every fields
before:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {<|>};
}
```
after:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {
text: String::new(),
num: 0,
other: todo!(),
};
}
```
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
2022-01-07 14:10:11 +00:00
Lukas Wirth
ca4baa6e55
Use FileAstId<ast::Adt>
in nameres where appropriate instead
2022-01-07 14:20:27 +01:00
Benjamin Coenen
f4ce0d78bb
add better default behavior on fill struct fields diagnostic
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-06 15:42:29 +01:00
Lukas Wirth
dc135cc076
internal: Support registered tools and attributes in ide layer
2022-01-06 14:56:50 +01:00
bors[bot]
ac3ea3e81c
Merge #11112
...
11112: Evaluate constants in array repeat expression r=HKalbasi a=HKalbasi
cc #8655
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-01-04 21:51:37 +00:00
hkalbasi
75c2acae6e
Evaluate constants in array repeat expression
2022-01-05 01:17:01 +03:30
Benjamin Coenen
336c899a07
add better default behavior on fill struct fields diagnostic
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-04 15:59:00 +01:00
Lukas Wirth
19f1ff5c70
give resolve_derive_ident
a more robust api
2022-01-03 16:00:45 +01:00
Lukas Wirth
44b0fe8ec7
cleanup
2022-01-02 23:44:26 +01:00
Lukas Wirth
aeb5d64912
Implement ToDef for ast::Attr
2022-01-02 23:44:26 +01:00
Lukas Wirth
6b7b09d329
internal: Record unresolved derive invocations in hir
2022-01-02 23:44:23 +01:00
Lukas Wirth
762a3b3030
Fix tool module classification not working correctly
2022-01-02 23:14:18 +01:00
Lukas Wirth
44d61766b5
internal: Record unresolved derive invocations in hir
2022-01-01 20:43:25 +01:00
Aleksey Kladov
aa1788dc71
clarify semantics of doc links
2021-12-28 17:00:55 +03:00
Aleksey Kladov
177a183e85
minor: simplify
2021-12-28 16:52:15 +03:00
Aleksey Kladov
56b51852c2
minor: dedup
2021-12-28 16:52:15 +03:00
Aleksey Kladov
726da9884b
avoid speculation when completing macros
2021-12-28 16:52:15 +03:00
hkalbasi
e6139cf47b
show values of constants in hover
2021-12-23 17:53:46 +03:30
Lukas Wirth
276687a6ee
internal: Directly use self param in completions instead of searching
2021-12-22 00:18:39 +01:00
Lukas Wirth
22b2c2fdf7
Simplify
2021-12-21 14:07:48 +01:00
Lukas Wirth
8e084132f8
internal: Do less work in hir::Semantics
2021-12-21 13:38:58 +01:00
bors[bot]
8dc3a270f6
Merge #11067
...
11067: internal: Store function param names in ItemTree r=Veykril a=Veykril
This prevents us reparsing source files for completions, sometimes slowing them down massively if the source file is not cached at the expense of a slightly bigger memory usage.
related info https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Completion.20performance
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 14:43:39 +00:00
Lukas Wirth
cd9d76e0ca
internal: Store function param names in ItemTree
2021-12-20 15:24:37 +01:00
bors[bot]
f46731a230
Merge #11028
...
11028: Bump MSRV (1.57) r=Veykril a=iDawer
This bumps MSRV on all crates to 1.57 except `la-arena`
#10986 requires >=1.57
Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
Lukas Wirth
a574434c3f
Simplify NameClass::classify
2021-12-20 13:47:06 +01:00