Syntax highlighting/code completion not working for (some) tokio modules
See original GitHub issueEnvironment
- IntelliJ Rust plugin version: 0.2.110.2150-193 (also tried 192)
- Rust toolchain version: 1.39.0
- IDE name and version: Clion 2019.3, also tested 2019.2.5
- Operating system: Windows 10 Version 1909, also tested MacOS 10.14.6
Problem description
This problem is possibly very similar to #4627 but with tokio
instead of async_std
…something to do with macro resolution probably.
The main reason I’m posting this is because I’ve found a (rather obvious) very fragile unsafe workaround to mitigate the pain of
not having proper code analysis (in CLion) temporarily.
The issue is described best by some code:
use tokio::net::TcpStream; //
// ^^^^^^ Lack of color here, can't Cmd/Ctrl-B here.
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let tcp = TcpStream::connect("420.4.2.0:4204").await?;
// ^^^^^^^^^^^^^^^^^^ Unresolved reference: `TcpStream`
Steps to reproduce
In Cargo.toml
, add:
[dependencies.tokio]
version = "0.2.2"
features = [ "full" ]
(I added “full” to enable all possible features, just to make sure the issue isn’t caused by a feature not being enabled)
Steps to hack around
What we do here is basically trade a real eye for 2 fake ones:
From tokio-0.2.2/src/net/mod.rs
, note lines 28-32:
cfg_tcp! {
pub mod tcp;
pub use tcp::listener::TcpListener;
pub use tcp::stream::TcpStream;
}
Well, cfg_tcp!
causes the issue…so I deemed it necessary to hardcode:
// cfg_tcp! {
pub mod tcp;
pub use tcp::listener::TcpListener;
pub use tcp::stream::TcpStream;
// }
Maybe the plugin could do something like this behind the scenes as a temporary hack to get things working; just throwing out ideas because I’ve heard that this issue has been around for quite awhile.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:16 (5 by maintainers)
@shibang did you enable new macro expansion engine (see #3628)?
0.2.113.2150-193 still an issue 😦