Skip to content

Commit

Permalink
fix(tab-complete): improve word matching!
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Oct 7, 2023
1 parent 8a3f1a5 commit ae55b89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,10 @@ class ChatBox extends LitElement {
this.completePadText = completeValue === '/' ? '' : completeValue
if (this.completeRequestValue === completeValue) {
const lastWord = chatInput.value.split(' ').at(-1)
this.completionItems = this.completionItemsSource.filter(i => i.startsWith(lastWord))
this.completionItems = this.completionItemsSource.filter(i => {
const compareableParts = i.split(/[_:]/)
return compareableParts.some(compareablePart => compareablePart.startsWith(lastWord))
})
return
}
this.completeRequestValue = ''
Expand Down

0 comments on commit ae55b89

Please sign in to comment.