use completions in API
This commit is contained in:
parent
ba0072401c
commit
d4ef07b235
@ -24,7 +24,7 @@
|
||||
pub(crate) fn completions(
|
||||
db: &db::RootDatabase,
|
||||
position: FilePosition,
|
||||
) -> Cancelable<Option<Vec<CompletionItem>>> {
|
||||
) -> Cancelable<Option<Completions>> {
|
||||
let original_file = db.source_file(position.file_id);
|
||||
// Insert a fake ident to get a valid parse tree
|
||||
let file = {
|
||||
@ -53,12 +53,10 @@ pub(crate) fn completions(
|
||||
param_completions(&mut acc, name.syntax());
|
||||
}
|
||||
}
|
||||
let res = if has_completions {
|
||||
Some(acc.into())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Ok(res)
|
||||
if !has_completions {
|
||||
return Ok(None);
|
||||
}
|
||||
Ok(Some(acc))
|
||||
}
|
||||
|
||||
/// Complete repeated parametes, both name and type. For example, if all
|
||||
|
@ -219,7 +219,8 @@ pub fn crate_root(&self, crate_id: CrateId) -> FileId {
|
||||
self.db.crate_graph().crate_root(crate_id)
|
||||
}
|
||||
pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> {
|
||||
completions(&self.db, position)
|
||||
let completions = completions(&self.db, position)?;
|
||||
Ok(completions.map(|it| it.into()))
|
||||
}
|
||||
pub fn approximately_resolve_symbol(
|
||||
&self,
|
||||
|
Loading…
Reference in New Issue
Block a user