mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Merge pull request #640 from microsoft/isidorn/update-inline-completions-sample
update to new InlineCompletions api
This commit is contained in:
@ -30,11 +30,11 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
const end = matches[2];
|
||||
const endInt =
|
||||
end === '*' ? document.lineAt(position.line).text.length : parseInt(end, 10);
|
||||
const text = matches[3].replace(/\\n/g, '\n');
|
||||
const insertText = matches[3].replace(/\\n/g, '\n');
|
||||
|
||||
return [
|
||||
{
|
||||
text,
|
||||
insertText,
|
||||
range: new vscode.Range(position.line, startInt, position.line, endInt),
|
||||
someTrackingId: someTrackingIdCounter++,
|
||||
},
|
||||
@ -45,10 +45,6 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
vscode.languages.registerInlineCompletionItemProvider({ pattern: '**' }, provider);
|
||||
|
||||
// Be aware that the API around `getInlineCompletionItemController` will not be finalized as is!
|
||||
vscode.window.getInlineCompletionItemController(provider).onDidShowCompletionItem((e) => {
|
||||
const id = (e.completionItem as MyInlineCompletionItem).someTrackingId;
|
||||
});
|
||||
}
|
||||
|
||||
interface MyInlineCompletionItem extends vscode.InlineCompletionItem {
|
||||
|
||||
Reference in New Issue
Block a user