stuff
This commit is contained in:
parent
8a5cda8937
commit
22b02641b4
6 changed files with 39 additions and 18 deletions
|
|
@ -147,6 +147,10 @@ class Autopilot(ContinueBaseModel):
|
|||
if not self._adding_highlighted_code:
|
||||
return
|
||||
|
||||
# Filter out rifs from ~/.continue/diffs folder
|
||||
range_in_files = [
|
||||
rif for rif in range_in_files if not os.path.dirname(rif.filepath) == os.path.expanduser("~/.continue/diffs")]
|
||||
|
||||
workspace_path = self.continue_sdk.ide.workspace_directory
|
||||
for rif in range_in_files:
|
||||
rif.filepath = os.path.basename(rif.filepath)
|
||||
|
|
|
|||
|
|
@ -332,8 +332,9 @@ class DefaultModelEditCodeStep(Step):
|
|||
|
||||
# Highlight the line to show progress
|
||||
line_to_highlight = current_line_in_file - len(current_block_lines)
|
||||
await sdk.ide.highlightCode(RangeInFile(filepath=rif.filepath, range=Range.from_shorthand(
|
||||
line_to_highlight, 0, line_to_highlight, 0)), "#FFFFFF22" if len(current_block_lines) == 0 else "#00FF0022")
|
||||
if False:
|
||||
await sdk.ide.highlightCode(RangeInFile(filepath=rif.filepath, range=Range.from_shorthand(
|
||||
line_to_highlight, 0, line_to_highlight, 0)), "#FFFFFF22" if len(current_block_lines) == 0 else "#00FF0022")
|
||||
|
||||
if len(current_block_lines) == 0:
|
||||
# Set this as the start of the next block
|
||||
|
|
@ -382,12 +383,14 @@ class DefaultModelEditCodeStep(Step):
|
|||
replacement = "\n".join(current_block_lines)
|
||||
start_line = current_block_start
|
||||
end_line = current_block_start + index_of_last_line_in_block
|
||||
await sdk.ide.showSuggestion(FileEdit(
|
||||
filepath=rif.filepath,
|
||||
range=Range.from_shorthand(
|
||||
start_line, 0, end_line, 0),
|
||||
replacement=replacement
|
||||
))
|
||||
|
||||
if False:
|
||||
await sdk.ide.showSuggestion(FileEdit(
|
||||
filepath=rif.filepath,
|
||||
range=Range.from_shorthand(
|
||||
start_line, 0, end_line, 0),
|
||||
replacement=replacement
|
||||
))
|
||||
|
||||
# Reset current block / update variables
|
||||
current_line_in_file += 1
|
||||
|
|
|
|||
4
extension/package-lock.json
generated
4
extension/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.0.112",
|
||||
"version": "0.0.113",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.0.112",
|
||||
"version": "0.0.113",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
"displayName": "Continue",
|
||||
"pricing": "Free",
|
||||
"description": "The open-source coding autopilot",
|
||||
"version": "0.0.112",
|
||||
"version": "0.0.113",
|
||||
"publisher": "Continue",
|
||||
"engines": {
|
||||
"vscode": "^1.67.0"
|
||||
|
|
@ -130,12 +130,12 @@
|
|||
"key": "shift+ctrl+enter"
|
||||
},
|
||||
{
|
||||
"command": "continue.acceptAllSuggestions",
|
||||
"command": "continue.acceptDiff",
|
||||
"mac": "shift+cmd+enter",
|
||||
"key": "shift+ctrl+enter"
|
||||
},
|
||||
{
|
||||
"command": "continue.rejectAllSuggestions",
|
||||
"command": "continue.rejectDiff",
|
||||
"mac": "shift+cmd+backspace",
|
||||
"key": "shift+ctrl+backspace"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const MainTextInput = styled.textarea`
|
|||
}
|
||||
`;
|
||||
|
||||
const UlMaxHeight = 200;
|
||||
const UlMaxHeight = 400;
|
||||
const Ul = styled.ul<{
|
||||
hidden: boolean;
|
||||
showAbove: boolean;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,14 @@ class DiffManager {
|
|||
fs.unlinkSync(diffInfo.newFilepath);
|
||||
}
|
||||
|
||||
acceptDiff(newFilepath: string) {
|
||||
acceptDiff(newFilepath?: string) {
|
||||
// If no newFilepath is provided and there is only one in the dictionary, use that
|
||||
if (!newFilepath && this.diffs.size === 1) {
|
||||
newFilepath = Array.from(this.diffs.keys())[0];
|
||||
}
|
||||
if (!newFilepath) {
|
||||
return;
|
||||
}
|
||||
// Get the diff info, copy new file to original, then delete from record and close the corresponding editor
|
||||
const diffInfo = this.diffs.get(newFilepath);
|
||||
if (!diffInfo) {
|
||||
|
|
@ -105,7 +112,14 @@ class DiffManager {
|
|||
this.cleanUpDiff(diffInfo);
|
||||
}
|
||||
|
||||
rejectDiff(newFilepath: string) {
|
||||
rejectDiff(newFilepath?: string) {
|
||||
// If no newFilepath is provided and there is only one in the dictionary, use that
|
||||
if (!newFilepath && this.diffs.size === 1) {
|
||||
newFilepath = Array.from(this.diffs.keys())[0];
|
||||
}
|
||||
if (!newFilepath) {
|
||||
return;
|
||||
}
|
||||
const diffInfo = this.diffs.get(newFilepath);
|
||||
if (!diffInfo) {
|
||||
return;
|
||||
|
|
@ -117,10 +131,10 @@ class DiffManager {
|
|||
|
||||
export const diffManager = new DiffManager();
|
||||
|
||||
export async function acceptDiffCommand(newFilepath: string) {
|
||||
export async function acceptDiffCommand(newFilepath?: string) {
|
||||
diffManager.acceptDiff(newFilepath);
|
||||
}
|
||||
|
||||
export async function rejectDiffCommand(newFilepath: string) {
|
||||
export async function rejectDiffCommand(newFilepath?: string) {
|
||||
diffManager.rejectDiff(newFilepath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue