简体   繁体   English

Rust 自动完成功能不适用于某些板条箱

[英]Rust autocompletion not working with certain crates

I am experiencing issues with the autocompletion feature of my IDE when using certain crates, like pnet .使用某些板条箱(如pnet时,我的 IDE 的自动完成功能出现问题。 I am using CLion with the Rust extension but the problem also occurs with VSCode.我将 CLion 与 Rust 扩展一起使用,但 VSCode 也会出现此问题。 It seems like the IDE is completely unaware of certain parts of the library. IDE 似乎完全不知道库的某些部分。

let packet = pnet::packet::ipv4::Ipv4Packet::new(&data);

Here for example I am losing autocompletion after ipv4:: .例如,这里我在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.自动完成引擎在 Rust 宏和生成的代码方面存在已知问题。

This is likely what is causing the issue with pnet .这可能是导致pnet问题的原因。

pnet::packet is defined as pnet::packet 定义为

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. pnet_packet是一个带有build.rs脚本的 crate,可以生成大部分代码。

There is not much you can do to help your IDE as far as I know.据我所知,您无能为力来帮助您的 IDE。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM