Style changes and improvements in autocomplete

This commit is contained in:
Aviral Dasgupta 2016-06-20 13:52:55 +05:30
parent b9d7743e5a
commit 4af983ed90
10 changed files with 135 additions and 93 deletions

View file

@ -39,6 +39,8 @@ const COMMANDS = [
}
];
let instance = null;
export default class CommandProvider extends AutocompleteProvider {
constructor() {
super();
@ -49,7 +51,7 @@ export default class CommandProvider extends AutocompleteProvider {
getCompletions(query: String) {
let completions = [];
const matches = query.match(/(^\/\w+)/);
const matches = query.match(/(^\/\w*)/);
if(!!matches) {
const command = matches[0];
completions = this.fuse.search(command).map(result => {
@ -66,4 +68,11 @@ export default class CommandProvider extends AutocompleteProvider {
getName() {
return 'Commands';
}
static getInstance(): CommandProvider {
if(instance == null)
instance = new CommandProvider();
return instance;
}
}