question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax highlighting/code completion not working for (some) tokio modules

See original GitHub issue

Environment

  • 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:closed
  • Created 4 years ago
  • Reactions:13
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
Undincommented, Apr 4, 2020

@shibang did you enable new macro expansion engine (see #3628)?

2reactions
Kubikxcommented, Jan 18, 2020

0.2.113.2150-193 still an issue 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

No Code Completion or Syntax Highlighting in Xcode Unit ...
Syntax Highlighting and Code Completion fails in the Unit Test Code, set it to NO it starts working again. We have tried all...
Read more >
Syntax Highlighting and Code Completion not working after ...
As written in the title, Syntax Highlight and Code Completion features are broke down after the theme change.
Read more >
Angular Template Syntax Highlighting & Code Completion not ...
Angular syntax highlighting was working fine in IntelliJ 2019.1.3 (build 191.6183.87). After upgrading to version 2019.2.3 (build 192.6817.14), ...
Read more >
Syntax highlighting and autocomple… - Apple Developer
I found a simple solution. Simply having another class import my new protocol made both the syntax highlighting and the autocompletion work. Posted...
Read more >
Intellisense identifier highlighting not working with C++ 20 ...
Intellisense is not working when modules are used. And particularly, the identifiers highlighting. This has a huge impact on coding.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found