Style changes and improvements in autocomplete
This commit is contained in:
parent
b9d7743e5a
commit
4af983ed90
10 changed files with 135 additions and 93 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue