Change name of provideCompletionItems command in VsCode Extension

Viewed 88

I am creating a VsCode extension which provides inline completions. Currently, it can be accessed using the default "Trigger Suggest" command. I want it to be different, as it should be different from the default option. The main code looks like this:

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {

    const command = 'getairesponse';    


    const files = ['c','cpp','csharp','java','javascript', 'php', 'python', 'SQL', 'HTML', 'plaintext'];

    const provider1 = vscode.languages.registerCompletionItemProvider(files, {

        async provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, context: vscode.CompletionContext) {

            var editor = vscode.window.activeTextEditor;
            if (editor){
            var cursorPosition = editor.selection.active;
            var input = editor.document.getText(new vscode.Range(0, 0, cursorPosition.line, cursorPosition.character));
            var out = getOutput(input);
            const simpleCompletion = new vscode.CompletionItem(await out);
            return [simpleCompletion];
            }
        }
    });


    context.subscriptions.push(provider1);
} 

I want the command for the extension to be equal to the constant command. I have also included the command in the package.json file:

"contributes": {
        "commands": [
            {
                "command": "getairesponse",
                "title": "Get AI Response"
            }
        ]
    }
0 Answers
Related