blob: f8eade90adda96a3a4b6d3246fa09b1203f86acb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
import CompletionsInteractor from '../usecases/completions';
import Completions from '../domains/completions';
export default class ContentMessageController {
constructor() {
this.completionsInteractor = new CompletionsInteractor();
}
getCompletions(line) {
let trimmed = line.trimStart();
let words = trimmed.split(/ +/);
let name = words[0];
if (words.length === 1) {
return this.completionsInteractor.queryConsoleCommand(name);
}
let keywords = trimmed.slice(name.length).trimStart();
switch (words[0]) {
case 'o':
case 'open':
case 't':
case 'tabopen':
case 'w':
case 'winopen':
return this.completionsInteractor.queryOpen(name, keywords);
case 'b':
case 'buffer':
return this.completionsInteractor.queryBuffer(name, keywords);
case 'bd':
case 'bdel':
case 'bdelete':
case 'bdeletes':
return this.completionsInteractor.queryBdelete(name, keywords);
case 'bd!':
case 'bdel!':
case 'bdelete!':
case 'bdeletes!':
return this.completionsInteractor.queryBdeleteForce(name, keywords);
case 'set':
return this.completionsInteractor.querySet(name, keywords);
}
return Promise.resolve(Completions.empty());
}
}
|