Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion does not work with regex crate #487

Open
oxeb opened this issue Jan 23, 2016 · 4 comments
Open

Completion does not work with regex crate #487

oxeb opened this issue Jan 23, 2016 · 4 comments

Comments

@oxeb
Copy link

oxeb commented Jan 23, 2016

I'm using atom, windows 7, rust 1.5.x and racer. Racer offers suggestions to me for my own code, code from the standard library,and most crates I get with cargo. It does not seem to work with the regex crate, in particular regex::Regex. My code builds and I have set up the toml correctly.

Somebody on the freenode IRC rust channel also confirmed this was happening on their end as well.

It does not impact me if this is never changes, but I wanted to report the issue so that if a bug is present it can be found.

@phildawes
Copy link
Collaborator

Hi @oxeb,
Thanks for the report, I suspect racer is tripping up somewhere. Would you mind posting your Cargo.toml and maybe some example code?

@oxeb
Copy link
Author

oxeb commented Jan 25, 2016

OK I made a repo that I think demonstrates the problem here https://github.com/oxeb/regex3
I am sorry that took so long. When I encountered the problem the other day I was using regex = "0.1.47", but now they have bumped it to regex = "0.1.48" The version bump did not seem to make a difference. Thank you.

@jaxx
Copy link
Contributor

jaxx commented Jan 25, 2016

@phildawes Regex::new() is enum constructor. I think this is not supported yet by racer. I made test that fails. Racer can only show enum variants, not functions.

#[test]
fn completes_enum_fn_locally() {
    let src="
    enum Foo {
        One,
        Two
    }

    impl Foo {
        fn new() -> Foo {
            Foo::One
        }
    }

    fn main() {
        let f = Foo::n
    }";
    let f = TmpFile::new(src);
    let path = f.path();
    let pos = scopes::coords_to_point(src, 14, 22);
    let cache = core::FileCache::new();
    let got = complete_from_file(src, &path, pos, &core::Session::from_path(&cache, &path, &path)).nth(0).unwrap();
    assert_eq!("new".to_string(), got.matchstr.to_string());
}

@jwilm
Copy link
Collaborator

jwilm commented Jan 25, 2016

Looks like the Enum branch in resolve_path doesn't run search_for_impls as it does for Struct. There might be other issues, but that's at least one spot that looks problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants