I am experiencing issues with the autocompletion feature of my IDE when using certain crates, like pnet
. I am using CLion with the Rust extension but the problem also occurs with VSCode. It seems like the IDE is completely unaware of certain parts of the library.
let packet = pnet::packet::ipv4::Ipv4Packet::new(&data);
Here for example I am losing autocompletion after ipv4::
. Also syntax highlighting does not work.
Does this have something to do with the way this crate is utilizing macros? Has anybody an idea on how to make autocompletion work?
Auto-completion engines have known issues with Rust macros and generated code.
This is likely what is causing the issue with pnet
.
pnet::packet
is defined as
extern crate pnet_packet;
/// Support for packet parsing and manipulation.
pub mod packet {
pub use pnet_packet::*;
}
with pnet_packet
being a crate with a build.rs
script that generates most of the code.
There is not much you can do to help your IDE as far as I know.