Complete set properties
This commit is contained in:
parent
86c4841964
commit
ab29706348
1 changed files with 35 additions and 2 deletions
|
@ -5,6 +5,7 @@ import CompletionRepository from '../repositories/completions';
|
|||
import CommandDocs from 'background/shared/commands/docs';
|
||||
import * as filters from './filters';
|
||||
import SettingRepository from '../repositories/setting';
|
||||
import * as properties from '../../shared/settings/properties';
|
||||
|
||||
const COMPLETION_ITEM_LIMIT = 10;
|
||||
|
||||
|
@ -61,9 +62,41 @@ export default class CompletionsInteractor {
|
|||
return this.queryTabs(name, false, keywords);
|
||||
}
|
||||
|
||||
querySet() {
|
||||
querySet(name, keywords) {
|
||||
let items = Object.keys(properties.docs).map((key) => {
|
||||
if (properties.types[key] === 'boolean') {
|
||||
return [
|
||||
new CompletionItem({
|
||||
caption: key,
|
||||
content: name + ' ' + key,
|
||||
url: 'Enable ' + properties.docs[key],
|
||||
}),
|
||||
new CompletionItem({
|
||||
caption: 'no' + key,
|
||||
content: name + ' no' + key,
|
||||
url: 'Disable ' + properties.docs[key],
|
||||
}),
|
||||
];
|
||||
}
|
||||
return [
|
||||
new CompletionItem({
|
||||
caption: key,
|
||||
content: name + ' ' + key,
|
||||
url: 'Set ' + properties.docs[key],
|
||||
})
|
||||
];
|
||||
});
|
||||
items = items.reduce((acc, val) => acc.concat(val), []);
|
||||
items = items.filter((item) => {
|
||||
return item.caption.startsWith(keywords);
|
||||
});
|
||||
if (items.length === 0) {
|
||||
return Promise.resolve(Completions.empty());
|
||||
}
|
||||
return Promise.resolve(
|
||||
new Completions([new CompletionGroup('Properties', items)])
|
||||
);
|
||||
}
|
||||
|
||||
async queryTabs(name, excludePinned, args) {
|
||||
let tabs = await this.completionRepository.queryTabs(args, excludePinned);
|
||||
|
|
Reference in a new issue