Skip to content

Commit 40900ec

Browse files
authored
Merge pull request #732 from JunoLab/avi/follow722
follow #722:
2 parents 5d46cc9 + 2541816 commit 40900ec

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

lib/runtime/modules.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{debounce} = require 'underscore-plus'
55

66
{client} = require '../connection'
7-
{selector} = require '../ui'
7+
{show} = require '../ui/selector'
88

99
{module: getmodule, allmodules, ismodule} = client.import ['module', 'allmodules', 'ismodule']
1010

@@ -66,7 +66,7 @@ module.exports =
6666
modules
6767
modules.catch (err) =>
6868
console.log err
69-
selector.show(modules, { active, infoMessage: 'Select module to evaluate in' }).then (mod) =>
69+
show(modules, { active }).then (mod) =>
7070
return unless mod?
7171
if mod is @autodetect
7272
delete item.juliaModule

lib/ui/selector.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function activate (_ink) {
1414
items: [],
1515
elementForItem
1616
})
17-
selector.element.classList.add('command-palette', 'julia-clientselector')
17+
selector.element.classList.add('command-palette', 'julia-client-selector')
1818
panel = atom.workspace.addModalPanel({ item: selector.element })
1919
}
2020

@@ -46,6 +46,8 @@ export function show (items, { active, emptyMessage, errorMessage, infoMessage,
4646
selector.focus()
4747
let confirmed = false
4848
return new Promise((resolve, reject) => {
49+
// HACK:
50+
// we can't pass those callback functions to `update` while atom-select-list's document says they can be ...
4951
selector.props.didConfirmSelection = (item) => {
5052
confirmed = true
5153
selector.cancelSelection()
@@ -73,13 +75,12 @@ export function show (items, { active, emptyMessage, errorMessage, infoMessage,
7375
}
7476
}
7577
}
78+
selector.props.filterKeyForItem = (items.length > 0 && items[0] instanceof Object) ?
79+
item => item.primary : item => item
7680
if (items.constructor == Promise) {
7781
items.then(items => {
78-
const filterKeyForItem = (items.length > 0 && items[0] instanceof Object) ?
79-
item => item.primary : item => item
8082
selector.update({
8183
items,
82-
filterKeyForItem,
8384
emptyMessage,
8485
errorMessage,
8586
infoMessage,
@@ -96,11 +97,8 @@ export function show (items, { active, emptyMessage, errorMessage, infoMessage,
9697
selector.cancelSelection()
9798
})
9899
} else {
99-
const filterKeyForItem = (items.length > 0 && items[0] instanceof Object) ?
100-
item => item.primary : item => item
101100
selector.update({
102101
items,
103-
filterKeyForItem,
104102
emptyMessage,
105103
errorMessage,
106104
infoMessage,

styles/julia-client.less

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
@import "ui-variables";
66
@import "syntax-variables";
77

8-
.julia-client-selector {
9-
.character-match {
10-
font-weight: bold;
11-
}
12-
}
13-
148
.julia {
159
table {
1610
td {
@@ -91,6 +85,21 @@ atom-text-editor.editor {
9185
}
9286
}
9387

88+
.julia-client-selector {
89+
.two-lines {
90+
padding: 0.5em 1em !important;
91+
.primary-line, .secondary-line {
92+
line-height: 2em;
93+
}
94+
}
95+
.error-message {
96+
color: @text-color-error;
97+
}
98+
.character-match {
99+
font-weight: bold;
100+
}
101+
}
102+
94103
.julia-syntax-color-selector {
95104
color: @syntax-text-color;
96105
background-color: @syntax-background-color;

0 commit comments

Comments
 (0)