try to improve the amount of times where multiline completions are given
this may yet backfire, but as of yet it's not at all clear to me what that big blob of code i commented out was really trying to accomplish. in my own testing, it seemed to only result in disappointing single- line completions only when i would've expected multi-line completions. and so far in my limited testing, this seems to work fine ...?
This commit is contained in:
parent
8cde5ce43f
commit
836a07ad6e
|
@ -77,6 +77,20 @@ fn should_complete(document: &Document, position: Position) -> Result<Completion
|
|||
column: column + 1,
|
||||
},
|
||||
);
|
||||
|
||||
// HACK?: It's not entirely clear to me what the below commented out block of code that was originally being
|
||||
// used was trying to accomplish. What I found is that in a lot of cases, even when the document was
|
||||
// parsed into some known language with a document tree present, the logic below would end up returning
|
||||
// CompletionType::SingleLine ... usually because the specific scenario didn't fall into the root node
|
||||
// check at the start.
|
||||
// So far, with the below simplified to just return CompletionType::MultiLine in all cases where the
|
||||
// document tree is parsed into some known language _seems_ to work better? Certainly I get much less
|
||||
// forced single-line completions which was extremely disappointing and irritating to see!
|
||||
if current_node.is_some() {
|
||||
return Ok(CompletionType::MultiLine);
|
||||
}
|
||||
|
||||
/*
|
||||
if let Some(node) = current_node {
|
||||
if node == tree.root_node() {
|
||||
return Ok(CompletionType::MultiLine);
|
||||
|
@ -110,6 +124,7 @@ fn should_complete(document: &Document, position: Position) -> Result<Completion
|
|||
return Ok(CompletionType::MultiLine);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
let start_idx = document.text.try_line_to_char(row)?;
|
||||
// XXX: We treat the end of a document as a newline
|
||||
|
|
Loading…
Reference in a new issue