couldn't get askOnSpace to work

This commit is contained in:
Nathan Hedge 2023-12-21 00:43:22 -06:00
parent ee97715d9b
commit 259730806f
No known key found for this signature in database
GPG Key ID: 1ADBA36D6E304C5C
2 changed files with 4 additions and 12 deletions

View File

@ -2,7 +2,7 @@
"name": "ollama-autocoder", "name": "ollama-autocoder",
"displayName": "Ollama Autocoder", "displayName": "Ollama Autocoder",
"description": "A simple to use Ollama autocompletion engine with options exposed and streaming functionality", "description": "A simple to use Ollama autocompletion engine with options exposed and streaming functionality",
"version": "0.0.2", "version": "0.0.3",
"icon": "icon.png", "icon": "icon.png",
"publisher": "10nates", "publisher": "10nates",
"license": "MIT", "license": "MIT",
@ -66,11 +66,6 @@
"type": "integer", "type": "integer",
"default": 2000, "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)." "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)."
},
"ollama-autocoder.ask-on-space": {
"type": "boolean",
"default": true,
"description": "Have the option `Autocomplete with Ollama` appear when you press space. **RELOAD REQUIRED**"
} }
} }
}, },

View File

@ -10,7 +10,6 @@ let apiSystemMessage: string | undefined;
let numPredict: number; let numPredict: number;
let promptWindowSize: number; let promptWindowSize: number;
let rawInput: boolean | undefined; let rawInput: boolean | undefined;
let askOnSpace: boolean | undefined;
function updateVSConfig() { function updateVSConfig() {
VSConfig = vscode.workspace.getConfiguration("ollama-autocoder"); VSConfig = vscode.workspace.getConfiguration("ollama-autocoder");
@ -20,7 +19,6 @@ function updateVSConfig() {
numPredict = VSConfig.get("max-tokens-predicted") || 500; numPredict = VSConfig.get("max-tokens-predicted") || 500;
promptWindowSize = VSConfig.get("prompt-window-size") || 2000; promptWindowSize = VSConfig.get("prompt-window-size") || 2000;
rawInput = VSConfig.get("raw-input"); rawInput = VSConfig.get("raw-input");
askOnSpace = VSConfig.get("ask-on-space"); // not actually changeable, requires reload
if (apiSystemMessage == "DEFAULT" || rawInput) apiSystemMessage = undefined; if (apiSystemMessage == "DEFAULT" || rawInput) apiSystemMessage = undefined;
} }
@ -153,7 +151,7 @@ function activate(context: vscode.ExtensionContext) {
" " " "
); );
// Register a command for getting a completion from Ollama // Register command passthrough for completionProvider
const internalAutocompleteCommand = vscode.commands.registerCommand( const internalAutocompleteCommand = vscode.commands.registerCommand(
"ollama-autocoder.autocomplete-internal", "ollama-autocoder.autocomplete-internal",
autocompleteCommand autocompleteCommand
@ -168,9 +166,8 @@ function activate(context: vscode.ExtensionContext) {
} }
); );
// Add the commands to the context // Add the commands & completion provider to the context
// Add the completion provider to the context context.subscriptions.push(completionProvider);
if (askOnSpace) context.subscriptions.push(completionProvider);
context.subscriptions.push(internalAutocompleteCommand); context.subscriptions.push(internalAutocompleteCommand);
context.subscriptions.push(externalAutocompleteCommand); context.subscriptions.push(externalAutocompleteCommand);