Compare commits
2 Commits
main
...
remove_com
Author | SHA1 | Date |
---|---|---|
Falko Victor Habel | bf6318965b | |
Falko Victor Habel | ac740e1f89 |
|
@ -12,7 +12,7 @@ Fabelous Autocoder is a powerful VS Code extension that provides intelligent cod
|
|||
|
||||
## How It Works
|
||||
|
||||
1. Trigger the autocompletion by typing a completion key (configurable, default is space).
|
||||
1. Trigger the autocompletion by typing the completion key (alt+oem_plus).
|
||||
2. The extension sends your current code context to the configured API.
|
||||
3. A code completion is generated and displayed as a preview.
|
||||
4. Accept the completion with `Tab` or decline it with `Backspace`.
|
||||
|
@ -21,7 +21,7 @@ Fabelous Autocoder is a powerful VS Code extension that provides intelligent cod
|
|||
|
||||
![Fabelous Autocoder Showcase](demo.gif)
|
||||
|
||||
1. **Trigger Completion**: Type normally and hit the completion key (space by default).
|
||||
1. **Trigger Completion**: Type normally and hit the completion key (alt+oem_plus).
|
||||
2. **Preview**: The suggested completion appears in light gray text.
|
||||
3. **Accept**: Press `Tab` to accept the entire suggestion.
|
||||
4. **Decline**: Press `Backspace` to remove the preview and decline the suggestion.
|
||||
|
@ -36,7 +36,6 @@ Customize Fabelous Autocoder through VS Code settings:
|
|||
- `fabelous-autocoder.temperature`: Control the randomness of completions.
|
||||
- `fabelous-autocoder.max tokens predicted`: Set the maximum length of completions.
|
||||
- `fabelous-autocoder.prompt window size`: Adjust the context window size.
|
||||
- `fabelous-autocoder.completion keys`: Set custom completion trigger keys.
|
||||
- `fabelous-autocoder.response preview`: Toggle preview functionality.
|
||||
- `fabelous-autocoder.preview max tokens`: Limit preview length.
|
||||
- `fabelous-autocoder.preview delay`: Add delay before showing preview.
|
||||
|
|
12
package.json
12
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "fabelous-autocoder",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"displayName": "Fabelous Autocoder",
|
||||
"description": "A simple to use Ollama autocompletion Plugin",
|
||||
"icon": "icon.png",
|
||||
|
@ -66,11 +66,6 @@
|
|||
"default": 2000,
|
||||
"description": "The size of the prompt in characters. NOT tokens, so can be set about 1.5-2x the max tokens of the model (varies)."
|
||||
},
|
||||
"fabelous-autocoder.completion keys": {
|
||||
"type": "string",
|
||||
"default": " ",
|
||||
"description": "Character that the autocompletion item provider appear on. Multiple characters will be treated as different entries. REQUIRES RELOAD"
|
||||
},
|
||||
"fabelous-autocoder.response preview": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
|
@ -123,6 +118,11 @@
|
|||
"command": "fabelous-autocoder.handleBackspace",
|
||||
"key": "backspace",
|
||||
"when": "editorTextFocus"
|
||||
},
|
||||
{
|
||||
"key": "alt+oem_plus",
|
||||
"command": "fabelous-autocoder.autocomplete",
|
||||
"when": "editorTextFocus"
|
||||
}
|
||||
],
|
||||
"commands": [
|
||||
|
|
|
@ -275,54 +275,17 @@ async function handleBackspace() {
|
|||
}
|
||||
}
|
||||
|
||||
async function provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, cancellationToken: vscode.CancellationToken) {
|
||||
const item = new vscode.CompletionItem('Fabelous autocompletion');
|
||||
item.insertText = new vscode.SnippetString('${1:}');
|
||||
item.documentation = new vscode.MarkdownString('Press `Enter` to get an autocompletion from Fabelous Autocoder');
|
||||
|
||||
if (config.responsePreview) {
|
||||
await new Promise(resolve => setTimeout(resolve, config.responsePreviewDelay * 1000));
|
||||
if (cancellationToken.isCancellationRequested) {
|
||||
return [item];
|
||||
}
|
||||
|
||||
const context = getContextLines(document, position);
|
||||
const fimPrompt = createFIMPrompt(context, document.languageId);
|
||||
|
||||
try {
|
||||
const result = await generateCompletion(fimPrompt, cancellationToken);
|
||||
const preview = (result as any).preview;
|
||||
if (preview) {
|
||||
item.detail = preview.split('\n')[0];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching preview:', error);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.continueInline || !config.responsePreview) {
|
||||
item.command = {
|
||||
command: 'fabelous-autocoder.autocomplete',
|
||||
title: 'Fabelous Autocomplete',
|
||||
arguments: []
|
||||
};
|
||||
}
|
||||
|
||||
return [item];
|
||||
}
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
updateConfig();
|
||||
createPreviewDecorationType();
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.workspace.onDidChangeConfiguration(updateConfig),
|
||||
vscode.languages.registerCompletionItemProvider('*', { provideCompletionItems }, ...config.completionKeys),
|
||||
vscode.commands.registerTextEditorCommand('fabelous-autocoder.autocomplete', autocompleteCommand),
|
||||
vscode.commands.registerCommand('fabelous-autocoder.handleTab', handleTab),
|
||||
vscode.commands.registerCommand('fabelous-autocoder.handleBackspace', handleBackspace) // Add this line
|
||||
vscode.commands.registerCommand('fabelous-autocoder.handleBackspace', handleBackspace)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function deactivate() {}
|
||||
|
|
Loading…
Reference in New Issue