Redefine the completion function to also accept the current line buffer (and start, stop indices).
This allow some different processing based on the "command" (first part of "line")