What needs to be implemented to handle Accept Word and Accept Line feature? 2) Do we need special handling for Accept Word/Accept Line in provideInlineCompletionItems? 3) For our vscode extension we have implemented both vscode.CompletionItemProvider and vscode.InlineCompletionItemProvider,does this causes any issue? 4)provideInlineCompletionItems method of vscode.InlineCompletionItemProvider has Position Argument, while constructing vscode.InlineCompletionItem we construct range using current cursor position and position which is passed as an argument, is this an issue? -code snippet shown below class inlineCompletionitemProvider implements vscode.InlineCompletionItemProvider { public static hint:string = ""; public static pos:vscode.Position; public static range:vscode.Range; provideInlineCompletionItems(document: vscode.TextDocument, position: vscode.Position, context: vscode.InlineCompletionContext, token: vscode.CancellationToken): vscode.ProviderResult<vscode.InlineCompletionItem[] | vscode.InlineCompletionList> { if (context.triggerKind == vscode.InlineCompletionTriggerKind.Invoke) { - range created using start position and position passed as an argument let vscodeRange:vscode.Range = new vscode.Range(inlineCompletionitemProvider.pos,position); let item: vscode.InlineCompletionItem = new vscode.InlineCompletionItem(
${inlineCompletionitemProvider.hint},vscodeRange); return [item]; } else{ return []; } } }- code snippet to explicit trigger inline hint provider and display them
private onResult = async () => { oracleInlineCompletionitemProvider.hint = "testing mac accept word"; oracleInlineCompletionitemProvider.pos = activeTextEditor.selection.active; - this is cuurent cursor position. hints would be displayed at this position
await vscode.commands.executeCommand('editor.action.inlineSuggest.trigger');
}
- code snippet to explicit trigger inline hint provider and display them
Accept Word and Accept Line feature does not work for MAC for any vscode version and for Windows on vscode version later than 1.86.2
12 Views Asked by ajayg At
0