Merge pull request #3254 from continuedev/nate/quick-edit-b3e2
fix autocomplete filtering cases
This commit is contained in:
commit
c8a7bf90fb
4 changed files with 26 additions and 10 deletions
|
|
@ -10,6 +10,7 @@ import {
|
|||
showWhateverWeHaveAtXMs,
|
||||
skipPrefixes,
|
||||
stopAtLines,
|
||||
stopAtLinesExact,
|
||||
stopAtRepeatingLines,
|
||||
stopAtSimilarLine,
|
||||
streamWithNewLines,
|
||||
|
|
@ -42,6 +43,12 @@ export class StreamTransformPipeline {
|
|||
let lineGenerator = streamLines(charGenerator);
|
||||
|
||||
lineGenerator = stopAtLines(lineGenerator, fullStop);
|
||||
const lineBelowCursor = this.getLineBelowCursor(helper);
|
||||
if (lineBelowCursor.trim() !== "") {
|
||||
lineGenerator = stopAtLinesExact(lineGenerator, fullStop, [
|
||||
lineBelowCursor,
|
||||
]);
|
||||
}
|
||||
lineGenerator = stopAtRepeatingLines(lineGenerator, fullStop);
|
||||
lineGenerator = avoidEmptyComments(
|
||||
lineGenerator,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { distance } from "fastest-levenshtein";
|
|||
|
||||
import { DiffLine } from "../../..";
|
||||
import { LineStream } from "../../../diff/util";
|
||||
import { BRACKETS, BRACKETS_REVERSE } from "../BracketMatchingService";
|
||||
|
||||
export type LineFilter = (args: {
|
||||
lines: LineStream;
|
||||
|
|
@ -270,6 +269,20 @@ export async function* stopAtLines(
|
|||
}
|
||||
}
|
||||
|
||||
export async function* stopAtLinesExact(
|
||||
stream: LineStream,
|
||||
fullStop: () => void,
|
||||
linesToStopAt: string[],
|
||||
): LineStream {
|
||||
for await (const line of stream) {
|
||||
if (linesToStopAt.some((stopAt) => line === stopAt)) {
|
||||
fullStop();
|
||||
break;
|
||||
}
|
||||
yield line;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters a LineStream, skipping specified prefixes on the first line.
|
||||
* @param {LineStream} lines - The input stream of lines.
|
||||
|
|
|
|||
|
|
@ -810,8 +810,7 @@ func main() {}`,
|
|||
}`,
|
||||
expectedCompletion: `string
|
||||
State string
|
||||
ZipCode string
|
||||
}`,
|
||||
ZipCode string`,
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -1118,8 +1117,7 @@ impl Calculator {
|
|||
self.result /= number;
|
||||
} else {
|
||||
println!("Cannot divide by zero.");
|
||||
}
|
||||
}`,
|
||||
}`,
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete Rust struct definition",
|
||||
|
|
@ -1600,8 +1598,7 @@ interface User {
|
|||
age: number;
|
||||
}`,
|
||||
expectedCompletion: `mail: string;
|
||||
age: number;
|
||||
}`,
|
||||
age: number;`,
|
||||
},
|
||||
{
|
||||
description: "Should autocomplete TypeScript interface declarations",
|
||||
|
|
@ -1853,8 +1850,7 @@ let john = { FirstName = "John"; LastName = "Doe"; Age = 30 }`,
|
|||
Address: string
|
||||
}`,
|
||||
expectedCompletion: `
|
||||
Address: string
|
||||
}`,
|
||||
Address: string`,
|
||||
},
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.241",
|
||||
"version": "0.9.242",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue