⚡️ autocomplete stopping improvements
This commit is contained in:
parent
683d53bcc2
commit
044827bcce
2 changed files with 11 additions and 6 deletions
|
|
@ -320,6 +320,7 @@ export async function getTabCompletion(
|
|||
];
|
||||
|
||||
const multiline =
|
||||
!input.selectedCompletionInfo && // Only ever single-line if using intellisense selected value
|
||||
options.multilineCompletions !== "never" &&
|
||||
(options.multilineCompletions === "always" || completeMultiline);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,19 +64,23 @@ export async function* stopAtSimilarLine(
|
|||
stream: LineStream,
|
||||
line: string,
|
||||
): AsyncGenerator<string> {
|
||||
line = line.trim();
|
||||
const lineIsBracketEnding = isBracketEnding(line);
|
||||
const trimmedLine = line.trim();
|
||||
const lineIsBracketEnding = isBracketEnding(trimmedLine);
|
||||
for await (const nextLine of stream) {
|
||||
if (lineIsBracketEnding && line.trim() === nextLine.trim()) {
|
||||
if (nextLine === line) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (lineIsBracketEnding && trimmedLine.trim() === nextLine.trim()) {
|
||||
yield nextLine;
|
||||
continue;
|
||||
}
|
||||
|
||||
let lineQualifies = nextLine.length > 4 && line.length > 4;
|
||||
let lineQualifies = nextLine.length > 4 && trimmedLine.length > 4;
|
||||
if (
|
||||
lineQualifies &&
|
||||
(commonPrefixLength(nextLine.trim(), line.trim()) > 8 ||
|
||||
distance(nextLine.trim(), line) / line.length < 0.1)
|
||||
(commonPrefixLength(nextLine.trim(), trimmedLine.trim()) > 8 ||
|
||||
distance(nextLine.trim(), trimmedLine) / trimmedLine.length < 0.1)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue