mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
use completions in API
This commit is contained in:
parent
ba0072401c
commit
d4ef07b235
2 changed files with 7 additions and 8 deletions
|
@ -24,7 +24,7 @@ pub use crate::completion::completion_item::{CompletionItem, InsertText};
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue