yuku / textcomplete

Autocomplete for HTMLTextAreaElement and more.

Home Page:https://yuku.takahashi.coffee/textcomplete/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Search result is replaced with `undefined` values

kbiedrzycki opened this issue · comments

Hey!

Wanted to ask about potential bug and possible solution. It occurs when a search result that is being selected from textcomplete suggestions contains $0, $1 or any other number in similar pattern (which I guess represents regex substitution). Basically, what is happening, these substitution patterns are being replaced with empty strings or what is worse, with undefined string, probably because of the lines https://github.com/yuku/textcomplete/blob/main/packages/textcomplete-core/src/SearchResult.ts#L4 and https://github.com/yuku/textcomplete/blob/main/packages/textcomplete-core/src/SearchResult.ts#L24. I wonder what is the use case for that (like, how we can actually provide replacement groups, for example when search result that looks like fun$1() or VALUE$10). We could potentially try to escape these values somehow, but not sure if there's any callback that we can attach to to unescape them once they are parsed. Any suggestions highly appreciated!

TLDR:
Selecting a suggestion from a textcomplete that contains regex substitution returns oddly - like ab$5ab -> abundefinedab.

commented

bump