configModeGenerator top-level property
Implementation
final FigGenerator configModeGenerator = FigGenerator(
trigger: '+',
custom: (tokens, _, __) async {
final previouslyAdded = tokens.last.split('+');
final possibleSuggestionsMap = {
'OTP': ['o'],
'o': ['OTP'],
'FIDO': ['f'],
'f': ['FIDO'],
'CCID': ['c'],
'c': ['CCID'],
};
final suggestions =
Set.from(possibleSuggestionsMap.values.expand((v) => v));
for (final token in previouslyAdded) {
suggestions.remove(token);
final aliases = possibleSuggestionsMap[token];
if (aliases != null) {
for (final v in aliases) {
suggestions.remove(v);
}
}
}
return suggestions.map((v) => FigSuggestion(name: v)).toList();
},
);