Function racer::complete_from_file
[−]
[src]
pub fn complete_from_file<'c, P, C>(filepath: P,
cursor: C,
session: &'c Session)
-> MatchIter<'c> where P: AsRef<Path>, C: Into<Location>
Search for completion at position in a file
src
- the file contents to search infilepath
- path to file containingsrc
pos
- byte offset in file with path/expr to completesession
- a racer::Session
Examples
extern crate racer; let src = " fn apple() { } fn main() { let b = ap }"; println!("{:?}", src); let cache = racer::FileCache::default(); let session = racer::Session::new(&cache); session.cache_file_contents("lib.rs", src); let got = racer::complete_from_file("lib.rs", racer::Location::Point(42), &session) .nth(0).unwrap(); assert_eq!("apple", got.matchstr); assert_eq!(got.mtype, racer::MatchType::Function);