Skip to content

Commit

Permalink
Merge pull request #732 from JunoLab/avi/follow722
Browse files Browse the repository at this point in the history
follow #722:
  • Loading branch information
aviatesk authored Apr 15, 2020
2 parents 5d46cc9 + 2541816 commit 40900ec
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lib/runtime/modules.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions lib/ui/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
}

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
21 changes: 15 additions & 6 deletions styles/julia-client.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
@import "ui-variables";
@import "syntax-variables";

.julia-client-selector {
.character-match {
font-weight: bold;
}
}

.julia {
table {
td {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 40900ec

Please sign in to comment.