diff --git a/lib/runtime/modules.coffee b/lib/runtime/modules.coffee index 8befac90..58b6cc75 100644 --- a/lib/runtime/modules.coffee +++ b/lib/runtime/modules.coffee @@ -4,7 +4,7 @@ {debounce} = require 'underscore-plus' {client} = require '../connection' -{selector} = require '../ui' +{show} = require '../ui/selector' {module: getmodule, allmodules, ismodule} = client.import ['module', 'allmodules', 'ismodule'] @@ -66,7 +66,7 @@ module.exports = modules modules.catch (err) => console.log err - selector.show(modules, { active, infoMessage: 'Select module to evaluate in' }).then (mod) => + show(modules, { active }).then (mod) => return unless mod? if mod is @autodetect delete item.juliaModule diff --git a/lib/ui/selector.js b/lib/ui/selector.js index 42d758a9..b3335424 100644 --- a/lib/ui/selector.js +++ b/lib/ui/selector.js @@ -14,7 +14,7 @@ export function activate (_ink) { items: [], elementForItem }) - selector.element.classList.add('command-palette', 'julia-clientselector') + selector.element.classList.add('command-palette', 'julia-client-selector') panel = atom.workspace.addModalPanel({ item: selector.element }) } @@ -46,6 +46,8 @@ export function show (items, { active, emptyMessage, errorMessage, infoMessage, selector.focus() let confirmed = false return new Promise((resolve, reject) => { + // HACK: + // we can't pass those callback functions to `update` while atom-select-list's document says they can be ... selector.props.didConfirmSelection = (item) => { confirmed = true selector.cancelSelection() @@ -73,13 +75,12 @@ export function show (items, { active, emptyMessage, errorMessage, infoMessage, } } } + selector.props.filterKeyForItem = (items.length > 0 && items[0] instanceof Object) ? + item => item.primary : item => item if (items.constructor == Promise) { items.then(items => { - const filterKeyForItem = (items.length > 0 && items[0] instanceof Object) ? - item => item.primary : item => item selector.update({ items, - filterKeyForItem, emptyMessage, errorMessage, infoMessage, @@ -96,11 +97,8 @@ export function show (items, { active, emptyMessage, errorMessage, infoMessage, selector.cancelSelection() }) } else { - const filterKeyForItem = (items.length > 0 && items[0] instanceof Object) ? - item => item.primary : item => item selector.update({ items, - filterKeyForItem, emptyMessage, errorMessage, infoMessage, diff --git a/styles/julia-client.less b/styles/julia-client.less index 17af5ab7..ab739671 100644 --- a/styles/julia-client.less +++ b/styles/julia-client.less @@ -5,12 +5,6 @@ @import "ui-variables"; @import "syntax-variables"; -.julia-client-selector { - .character-match { - font-weight: bold; - } -} - .julia { table { td { @@ -91,6 +85,21 @@ atom-text-editor.editor { } } +.julia-client-selector { + .two-lines { + padding: 0.5em 1em !important; + .primary-line, .secondary-line { + line-height: 2em; + } + } + .error-message { + color: @text-color-error; + } + .character-match { + font-weight: bold; + } +} + .julia-syntax-color-selector { color: @syntax-text-color; background-color: @syntax-background-color;