aboutsummaryrefslogtreecommitdiff
path: root/src/background/usecases
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-07-21 10:35:27 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-07-21 16:15:07 +0900
commit890d93fe773ea5cde41d19125d4bad626e54059e (patch)
tree675fbad2261cb6f405589fcc1a553b9900210f63 /src/background/usecases
parentbf7c125fb214b52d67527bdd292a4b5bb81b1d32 (diff)
Buffer completion on Clean Architecture
Diffstat (limited to 'src/background/usecases')
-rw-r--r--src/background/usecases/completions.js32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/background/usecases/completions.js b/src/background/usecases/completions.js
index fc1ff52..21049d2 100644
--- a/src/background/usecases/completions.js
+++ b/src/background/usecases/completions.js
@@ -22,19 +22,39 @@ export default class CompletionsInteractor {
if (items.length === 0) {
return Promise.resolve(Completions.empty());
}
- return Promise.resolve(new Completions(
- [new CompletionGroup('Console Command', items)]
- ));
+ return Promise.resolve(
+ new Completions([new CompletionGroup('Console Command', items)])
+ );
}
- async queryBdeleteCommand(name, force, args) {
- let tabs = await this.completionRepository.queryTabs(args);
+ queryOpen() {
+ return Promise.resolve(Completions.empty());
+ }
+
+ queryBuffer(name, keywords) {
+ return this.queryTabs(name, true, keywords);
+ }
+
+ queryBdelete(name, keywords) {
+ return this.queryTabs(name, true, keywords);
+ }
+
+ queryBdeleteForce(name, keywords) {
+ return this.queryTabs(name, false, keywords);
+ }
+
+ querySet() {
+ return Promise.resolve(Completions.empty());
+ }
+
+ async queryTabs(name, excludePinned, args) {
+ let tabs = await this.completionRepository.queryTabs(args, excludePinned);
let items = tabs.map(tab => new CompletionItem({
caption: tab.title,
content: name + ' ' + tab.title,
url: tab.url,
icon: tab.favIconUrl
}));
- return [new CompletionGroup('Buffers', items)];
+ return new Completions([new CompletionGroup('Buffers', items)]);
}
}