IF THERE IS ALREADY A LINE MATCHING #include  it should not insert it

let disposable = vscode.commands.registerCommand('e5nvscode.insertGpuOffload', function () { const editor = vscode.window.activeTextEditor; if (editor) { const document = editor.document; const selection = editor.selection; editor.edit(editBuilder => { editBuilder.insert(selection.start, 'GPU_OFFLOAD_LOOP'); let lastIncludeLine = null; for (let i = 0; i < document.lineCount; i++) { let line = document.lineAt(i); if (line.text.match(/#include\s*<.*\..*>/)) { lastIncludeLine = line; } } if (lastIncludeLine) { editBuilder.insert(lastIncludeLine.range.end, '\n#include '); } }); } }); context.subscriptions.push(disposable);