Make individual Entrys responsible for determining suffixes
This makes it cleaner as CommandEntry always wants a space, but MemberEntry wants a space or ": " depending on if it is the first word or not.
This commit is contained in:
parent
f4be4880b8
commit
864d10f412
3 changed files with 15 additions and 18 deletions
|
@ -43,10 +43,10 @@ class Entry {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {?string} The suffix to override whatever the default is, or null to
|
||||
* @return {?string} The suffix to append to the tab-complete, or null to
|
||||
* not do this.
|
||||
*/
|
||||
getOverrideSuffix() {
|
||||
getSuffix(isFirstWord) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ class CommandEntry extends Entry {
|
|||
return this.getText();
|
||||
}
|
||||
|
||||
getOverrideSuffix() {
|
||||
getSuffix(isFirstWord) {
|
||||
return " "; // force a space after the command.
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +94,10 @@ class MemberEntry extends Entry {
|
|||
getKey() {
|
||||
return this.member.userId;
|
||||
}
|
||||
|
||||
getSuffix(isFirstWord) {
|
||||
return isFirstWord ? ": " : " ";
|
||||
}
|
||||
}
|
||||
|
||||
MemberEntry.fromMemberList = function(members) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue