Final Version. Everything is working; atleast for Python🥳
This commit is contained in:
parent
c1d0a53720
commit
a3bf2f93bb
|
@ -4,7 +4,7 @@
|
||||||
"displayName": "Fabelous Autocoder",
|
"displayName": "Fabelous Autocoder",
|
||||||
"description": "A simple to use Ollama autocompletion Plugin",
|
"description": "A simple to use Ollama autocompletion Plugin",
|
||||||
"icon": "icon.png",
|
"icon": "icon.png",
|
||||||
"publisher": "fabel",
|
"publisher": "Falko Habel",
|
||||||
"license": "CC BY-ND 4.0",
|
"license": "CC BY-ND 4.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitea.fabelous.app/fabel/Fabelous-Autocoder/issues"
|
"url": "https://gitea.fabelous.app/fabel/Fabelous-Autocoder/issues"
|
||||||
|
@ -118,6 +118,11 @@
|
||||||
"command": "fabelous-autocoder.handleTab",
|
"command": "fabelous-autocoder.handleTab",
|
||||||
"key": "tab",
|
"key": "tab",
|
||||||
"when": "editorTextFocus && !editorTabMovesFocus"
|
"when": "editorTextFocus && !editorTabMovesFocus"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "fabelous-autocoder.handleBackspace",
|
||||||
|
"key": "backspace",
|
||||||
|
"when": "editorTextFocus"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commands": [
|
"commands": [
|
||||||
|
|
|
@ -159,13 +159,21 @@ class CompletionManager {
|
||||||
edit.replace(this.document.uri, rangeToReplace, contentToInsert);
|
edit.replace(this.document.uri, rangeToReplace, contentToInsert);
|
||||||
|
|
||||||
await vscode.workspace.applyEdit(edit);
|
await vscode.workspace.applyEdit(edit);
|
||||||
this.clearPreview(); // Clear the preview decorations
|
|
||||||
|
// Clear the preview decorations
|
||||||
|
this.clearPreview();
|
||||||
|
|
||||||
|
// Set activeCompletionManager to null
|
||||||
|
activeCompletionManager = null;
|
||||||
|
|
||||||
// Calculate the new cursor position from the inserted content
|
// Calculate the new cursor position from the inserted content
|
||||||
const lastCompletionLine = completionLines[completionLines.length - 1];
|
const lastCompletionLine = completionLines[completionLines.length - 1];
|
||||||
const newPosition = new vscode.Position(this.startPosition.line + numberOfLines - 1, lastCompletionLine.length);
|
const newPosition = new vscode.Position(
|
||||||
|
this.startPosition.line + numberOfLines - 1,
|
||||||
|
lastCompletionLine.length
|
||||||
|
);
|
||||||
|
|
||||||
// Set the new cursor position without any additional move
|
// Set the new cursor position
|
||||||
this.textEditor.selection = new vscode.Selection(newPosition, newPosition);
|
this.textEditor.selection = new vscode.Selection(newPosition, newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +212,7 @@ class CompletionManager {
|
||||||
this.textEditor.selection = new vscode.Selection(this.startPosition, this.startPosition);
|
this.textEditor.selection = new vscode.Selection(this.startPosition, this.startPosition);
|
||||||
|
|
||||||
console.log(`Lines ${startLine + 1} to ${endLine + 1} removed successfully`);
|
console.log(`Lines ${startLine + 1} to ${endLine + 1} removed successfully`);
|
||||||
|
activeCompletionManager = null;
|
||||||
} else {
|
} else {
|
||||||
console.log('No lines to remove');
|
console.log('No lines to remove');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue