Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.

UPI 0.3 #199

Merged
merged 8 commits into from
Mar 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions lib/editor-control.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,36 @@ class EditorControl
clearTimeout @exprTypeTimeout if @exprTypeTimeout?

@disposables.add @editor.onDidChangeSelectionRange ({newBufferRange}) =>
slcl = editorElement.pixelRectForScreenRange(@editor.screenRangeForBufferRange(newBufferRange))
eecl = editorElement.querySelector('.scroll-view').getBoundingClientRect()
ttcl = document.querySelector('ide-haskell-tooltip')?.getBoundingClientRect?()
if ttcl?
ttcld = document.querySelector('ide-haskell-tooltip div').getBoundingClientRect()
ttbox =
left: ttcl.left - eecl.left
top: ttcld.top - eecl.top
width: ttcl.width
height: ttcld.height
xmax = Math.round(Math.max(ttbox.left, slcl.left))
xmin = Math.round(Math.min(ttbox.left + ttbox.width, slcl.left + slcl.width))
ymax = Math.round(Math.max(ttbox.top, slcl.top))
ymin = Math.round(Math.min(ttbox.top + ttbox.height, slcl.top + slcl.height))
if ymax <= ymin and xmax <= xmin
document.querySelector('ide-haskell-tooltip').style.setProperty('opacity', '0.3')
else
document.querySelector('ide-haskell-tooltip').style.removeProperty('opacity')

clearTimeout @selTimeout if @selTimeout?
if newBufferRange.isEmpty()
@hideTooltip eventType: 'selection'
switch atom.config.get('ide-haskell.onCursorMove')
when 'Show Tooltip'
clearTimeout @exprTypeTimeout if @exprTypeTimeout?
unless @showCheckResult newBufferRange.start, false, 'keyboard'
@hideTooltip()
@hideTooltip(persistOnCursorMove: false)
when 'Hide Tooltip'
clearTimeout @exprTypeTimeout if @exprTypeTimeout?
@hideTooltip()
@hideTooltip(persistOnCursorMove: false)
else
@selTimeout = setTimeout (=> @shouldShowTooltip newBufferRange.start, 'selection'),
atom.config.get('ide-haskell.expressionTypeInterval')
Expand Down Expand Up @@ -168,6 +187,7 @@ class EditorControl
return unless @editor?

throw new Error('eventType not set') unless detail.eventType
detail.persistOnCursorMove ?= false

if range.isEqual(@tooltipHighlightRange)
return
Expand Down
9 changes: 9 additions & 0 deletions lib/ide-haskell.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,14 @@ module.exports = IdeHaskell =
]
]

UPI = require './upi-0.3'
@upi3 = new UPI(@pluginManager)

deactivate: ->
@pluginManager.deactivate()
@pluginManager = null
@upi3.dispose()
@upi3 = null

atom.keymaps.removeBindingsFromSource 'ide-haskell'

Expand All @@ -242,6 +247,10 @@ module.exports = IdeHaskell =
UPI = require './upi'
new UPI(@pluginManager)

provideUpi3: ->
@upiProvided = true
@upi3

consumeLinter: (indieRegistry) ->
linter = indieRegistry.register
name: 'IDE-Haskell'
Expand Down
8 changes: 3 additions & 5 deletions lib/output-panel/output-panel.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class OutputPanel

@disposables.add @results.onDidUpdate => @currentResult = null

@backendStatus status: 'ready'

toggle: ->
if @panel.isVisible()
@panel.hide()
Expand Down Expand Up @@ -49,9 +47,9 @@ class OutputPanel
setHideParameterValues: (value) ->
@element.setHideParameterValues(value)

backendStatus: ({status, progress}) ->
@element.statusChanged {status, oldStatus: @status ? 'ready'}
@status = status
backendStatus: (pluginName, statusObject) ->
{status, progress, detail} = statusObject
@element.statusChanged pluginName, {status, detail}
unless status is 'progress'
progress ?= 0
@element.setProgress progress if progress?
Expand Down
26 changes: 22 additions & 4 deletions lib/output-panel/views/output-panel.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class OutputPanelView extends HTMLElement
@style.width = @model.state.width if @model.state?.width?
@checkboxUriFilter.setFileFilter @model.state.fileFilter

@statusMap = new Map

@

createdCallback: ->
Expand All @@ -27,6 +29,19 @@ class OutputPanelView extends HTMLElement
id: 'status'
attrs:
'data-status': 'ready'

@disposables.add atom.tooltips.add @status,
'class': 'ide-haskell-status-tooltip'
title: =>
(for [plugin, {status, detail}] in Array.from(@statusMap.entries())
"""
<ide-haskell-status-item>
<ide-haskell-status-icon data-status=\"#{status}\">#{plugin}</ide-haskell-status-icon>
<ide-haskell-status-detail>#{detail ? ""}</ide-haskell-status-detail>
</ide-haskell-status-item>
""")
.join('')

OutputPanelButtonsElement = require './output-panel-buttons'
@disposables.add @addPanelControl new OutputPanelButtonsElement,
id: 'buttons'
Expand Down Expand Up @@ -101,6 +116,8 @@ class OutputPanelView extends HTMLElement
@remove()
@items.destroy()
@disposables.dispose()
@statusMap.clear()
@statusMap = null

setPanelPosition: (@pos) ->
@setAttribute 'data-pos', @pos
Expand Down Expand Up @@ -160,14 +177,15 @@ class OutputPanelView extends HTMLElement
@activateTab name
break

statusChanged: ({status, oldStatus}) ->
statusChanged: (pluginName, status) ->
prio =
progress: 0
progress: 5
error: 20
warning: 10
ready: 0
if prio[status] >= prio[oldStatus] or status is 'progress'
@status.setAttribute 'data-status', status
@statusMap.set(pluginName, status)
[consensus] = Array.from(@statusMap.values()).sort (a, b) -> prio[b.status] - prio[a.status]
@status.setAttribute 'data-status', consensus.status

showItem: (item) ->
@activateTab item.severity
Expand Down
Loading