-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-complete for primitive types #2647
Comments
This issue seems to be related: #1139. However that one is closed and this is still an issue. |
I also see this issue for slices, even though this test exists. My initial guess is the slice type needs to be added to LangItemTarget, and perhaps this causes things to work in the test, but not work when the slice implementation is from an external crate? |
@JoshMcguigan the slice methods work for me on current master. Are you sure you're running the newest version? Completion for |
Ah yes, my issue here is that by default coc-rust-analyzer does not use the cargo installed version of rust analyzer. I pointed coc-rust-analyzer at the cargo installed binary and the slice completions and type inference started working. Thanks for double checking me here. |
Recent version (2020-03-02) seems changed behaviour struct Foo {
i: i32,
}
impl Foo {
fn to_packet_bytes(self) -> [u8; 4] {
self.i.to_le_bytes()
}
}
fn main() {
println!("Results:")
} it recognize |
@davemilter I can confirm that the Note that So my wild guess is it related to #3368... |
No competition for fn main() {
let mut a = [0u8; 4];
let b = [17u8; 3];
a[0..3].|
// a[0..3].copy_from_slice(&b);
println!("a: {:?}", a);
} |
I just tested it , and the following works: fn main() {
let mut a = [0u8; 4];
let b = [17u8; 3];
a[0usize..3usize].<|> // a lot of functions appears in completion
println!("a: {:?}", a);
} So I think the remain problem related to handle integer variables in Chalk. closed in favor of #2534 |
Sorry to dig and old thread but google will point me there when trying to understand why I have no autocompletion for primitive types. However I couldn't achieve the same in the "rustling" tutorial. Expected (I could only reproduce in an existing project by adding But it's totally unclear what happens, searching for "mod primitive_types" in Google points me to nothing. I'll update this message if I find more information but for beginners this is still quite confusing how to enable primitive_types completion in VS code. Update:
It seems that for Rust Analyzer to work correctly, the project must have a certain structure. Coming from JS, it's like needing a proper "tsconfig.json" to enable TypeScript analysis on all files. |
@eric-burel The |
I do think the code action should say "Insert |
Inherent methods for primitive types aren't available when auto-completing.
eg.
The text was updated successfully, but these errors were encountered: