Handles inserting a snippet at the end of a selection
@param   {String} string         the entire string to use
@param   {Number[]}  selectionRange the starting and ending positions of the selection
@param   {String} snippet        the snippet to insert
@returns {Object} the new string, the updated selectionRange
function insertHandler(string, selectionRange, snippet) {
  const start = selectionRange[0];
  const end = selectionRange[1];
  const value = string.substring(0, start) + snippet + string.substring(end, string.length);

  return { value, range: [start, start + snippet.length] };
}