rls icon indicating copy to clipboard operation
rls copied to clipboard

No autocompletion when aliasing types with cfg

Open TheAifam5 opened this issue 5 years ago • 1 comments

Hey!

I'm making multi-platform library for process manipulation. RLS shows the function definition when I hover over from_current or test, but RLS returns:

[Trace - 9:18:46 PM] Received response 'textDocument/codeAction - (716)' in 1ms.
Result: []

Code:

pub mod platform {
  pub trait ProcessTrait {
    fn from_current() -> Self;
    fn test(self);
  }

  #[cfg(target_os = "windows")]
  pub type Process = native::windows::Process;

  #[cfg(target_os = "macos")]
  pub type Process = native::macos::Process;

  #[cfg(target_os = "linux")]
  pub type Process = native::linux::Process;

  mod native {
    pub mod linux {
      use super::super::ProcessTrait;
      pub struct Process();

      impl ProcessTrait for Process {
        fn from_current() -> Process {
          Process {}
        }

        fn test(self) {}
      }
    }

    pub mod windows {}

    pub mod macos {}
  }
}

use platform::{Process, ProcessTrait};
fn test() {
  let p: Process = Process::from_current(); // no autocompletion after Process::
  p.test(); // no autocompletion after p.
}

Regards, TheAifam5

TheAifam5 avatar Oct 14 '19 19:10 TheAifam5

I'm seeing the same thing with aliased types from my library crate in the integration tests.

kevinbarabash avatar Apr 07 '22 03:04 kevinbarabash