Merge pull request #1672 from sharelatex/ns-input-autocomplete

improve autocomplete when inserting over existing arguments

GitOrigin-RevId: 8d1401cca141348dd33b965c92e120cf66350d7e
This commit is contained in:
Simon Detheridge 2019-03-28 15:00:54 +00:00 committed by sharelatex
parent 385da07930
commit 61cd448832

View file

@ -382,6 +382,20 @@ define([
)
}
}
const inArgument = lineBeyondCursor.match(
/^([\w._-]+)\}(.*)/
)
if (inArgument) {
const argumentRightOfCursor = inArgument[1]
const afterArgument = inArgument[2]
if (afterArgument) {
rightRange.end.column =
rightRange.start.column +
argumentRightOfCursor.length +
1
}
editor.session.remove(rightRange)
}
}
}
// finally, insert the match