From da92e15bfb00fcd41b5c200763608cd4722b9de1 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 27 Oct 2015 23:23:43 -0400 Subject: [PATCH] Give some API properties priority in autocomplete. --- app/schemas/models/level_component.coffee | 6 ++++++ app/views/play/level/tome/SpellView.coffee | 1 + 2 files changed, 7 insertions(+) diff --git a/app/schemas/models/level_component.coffee b/app/schemas/models/level_component.coffee index a89972b4d..a3b82e136 100644 --- a/app/schemas/models/level_component.coffee +++ b/app/schemas/models/level_component.coffee @@ -91,6 +91,12 @@ PropertyDocumentationSchema = c.object { {title: 'Description', type: 'string', description: 'Description of the return value.', maxLength: 1000} ] i18n: { type: 'object', format: 'i18n', props: ['description'], description: 'Help translate this return value'} + autoCompletePriority: + type: 'number' + title: 'Autocomplete Priority' + description: 'How important this property is to autocomplete.' + minimum: 0 + default: 1.0 DependencySchema = c.object { title: 'Component Dependency' diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee index 7756622d7..afc552073 100644 --- a/app/views/play/level/tome/SpellView.coffee +++ b/app/views/play/level/tome/SpellView.coffee @@ -436,6 +436,7 @@ module.exports = class SpellView extends CocoView meta: $.i18n.t('keyboard_shortcuts.press_enter', defaultValue: 'press enter') name: doc.name tabTrigger: doc.snippets[e.language].tab + importance: doc.autoCompletePriority ? 1.0 haveFindNearestEnemy ||= doc.name is 'findNearestEnemy' haveFindNearest ||= doc.name is 'findNearest' if doc.name is 'attack'