@@ -3,7 +3,7 @@ ImportListView = require './import-list-view'
3
3
4
4
{bufferPositionFromMouseEvent } = require ' ./utils'
5
5
{TooltipMessage } = require ' ./tooltip-view'
6
- {Range ,CompositeDisposable ,Disposable } = require ' atom'
6
+ {Range , CompositeDisposable , Disposable } = require ' atom'
7
7
8
8
class EditorControl
9
9
constructor : (@editor , @manager ) ->
@@ -31,12 +31,12 @@ class EditorControl
31
31
# buffer events for automatic check
32
32
buffer = @editor .getBuffer ()
33
33
editorElement = atom .views .getView (@editor )
34
- @disposables .add buffer .onWillSave () ->
34
+ @disposables .add buffer .onWillSave ->
35
35
# TODO if uri was changed, then we have to remove all current markers
36
36
if atom .config .get (' ide-haskell.onSavePrettify' )
37
37
atom .commands .dispatch editorElement, ' ide-haskell:prettify-file'
38
38
39
- @disposables .add buffer .onDidSave () ->
39
+ @disposables .add buffer .onDidSave ->
40
40
# TODO if uri was changed, then we have to remove all current markers
41
41
if atom .config .get (' ide-haskell.onSaveCheck' )
42
42
atom .commands .dispatch editorElement, ' ide-haskell:check-file'
@@ -56,7 +56,7 @@ class EditorControl
56
56
@ clearExprTypeTimeout ()
57
57
@exprTypeTimeout = setTimeout (=>
58
58
(@ showCheckResult e) or
59
- (@ showExpressionType bufferPt, ' mouse' , ' get' + action)
59
+ (@ showExpressionType bufferPt, ' mouse' , ' get' + action)
60
60
), atom .config .get (' ide-haskell.expressionTypeInterval' )
61
61
@disposables .add @editorElement , ' mouseout' , ' .scroll-view' , (e ) =>
62
62
action = atom .config .get (' ide-haskell.onMouseHoverShow' )
@@ -82,7 +82,7 @@ class EditorControl
82
82
@editorElement = null
83
83
@editor = null
84
84
@lastMouseBufferPt = null
85
- @tooltipMarkers = null
85
+ @tooltipMarkers = null
86
86
87
87
# helper function to hide tooltip and stop timeout
88
88
clearExprTypeTimeout : ->
@@ -107,7 +107,7 @@ class EditorControl
107
107
return unless uri is @editor .getURI ()
108
108
109
109
# create a new marker
110
- range = new Range position, {row : position .row , column : position .column + 1 }
110
+ range = new Range position, {row : position .row , column : position .column + 1 }
111
111
marker = @editor .markBufferRange range,
112
112
type : ' check-result'
113
113
severity : severity
@@ -119,7 +119,7 @@ class EditorControl
119
119
@ decorateMarker (m)
120
120
121
121
decorateMarker : (m ) ->
122
- cls = ' ide-haskell-' + m .getProperties ().severity
122
+ cls = ' ide-haskell-' + m .getProperties ().severity
123
123
@gutter .decorateMarker m, type : ' line-number' , class : cls
124
124
@editor .decorateMarker m, type : ' highlight' , class : cls
125
125
@editor .decorateMarker m, type : ' line' , class : cls
@@ -153,10 +153,10 @@ class EditorControl
153
153
@ hideExpressionType ()
154
154
return
155
155
156
- runPendingEvent = ({fun,crange}) =>
156
+ runPendingEvent = ({fun, crange}) =>
157
157
@showExpressionTypePendingEvent = null
158
158
@showExpressionTypeRunning = true
159
- @manager .backend ? [fun] @editor .getBuffer (), crange, ({range,type,info}) =>
159
+ @manager .backend ? [fun] @editor .getBuffer (), crange, ({range, type, info}) =>
160
160
return unless @editor ?
161
161
if @showExpressionTypePendingEvent ?
162
162
runPendingEvent @showExpressionTypePendingEvent
@@ -177,7 +177,7 @@ class EditorControl
177
177
unless type?
178
178
@manager .backendWarning ()
179
179
return
180
- @markerBufferRange = range
180
+ @markerBufferRange = range
181
181
if mouseEvent or contextEvent
182
182
tooltipMarker = @editor .markBufferPosition range .start
183
183
else
@@ -200,7 +200,7 @@ class EditorControl
200
200
runPendingEvent @showExpressionTypePendingEvent
201
201
202
202
hideExpressionType : ->
203
- @tooltipHighlightRange = null
203
+ @tooltipHighlightRange = null
204
204
@tooltipMarkers .dispose ()
205
205
@tooltipMarkers = new CompositeDisposable
206
206
@@ -241,15 +241,15 @@ class EditorControl
241
241
crange = @editor .getLastSelection ().getBufferRange ()
242
242
else
243
243
throw new Error " unknown event type #{ eventType} "
244
- @manager .backend .getType @editor .getBuffer (), crange, ({range,type}) =>
244
+ @manager .backend .getType @editor .getBuffer (), crange, ({range, type}) =>
245
245
return unless @editor ?
246
246
n = @editor .indentationForBufferRow (range .start .row )
247
- indent = ' ' .repeat n* @editor .getTabLength ()
248
- @editor .scanInBufferRange / [\w '. ] + / , range, ({matchText,stop}) =>
247
+ indent = ' ' .repeat n * @editor .getTabLength ()
248
+ @editor .scanInBufferRange / [\w '. ] + / , range, ({matchText, stop}) =>
249
249
symbol = matchText
250
- pos = [range .start .row ,0 ]
251
- @editor .setTextInBufferRange [pos,pos],
252
- indent+ symbol+ " :: " + type+ " \n "
250
+ pos = [range .start .row , 0 ]
251
+ @editor .setTextInBufferRange [pos, pos],
252
+ indent + symbol + " :: " + type + " \n "
253
253
stop ()
254
254
255
255
insertImport : (eventType ) ->
@@ -271,12 +271,12 @@ class EditorControl
271
271
# "(\\s+as\\s+[\\w.']+)?(\\s+hiding)?"+
272
272
# "(\\s+\\((.*)\\))")
273
273
buffer = @editor .getBuffer ()
274
- buffer .backwardsScan / ^ (\s * )import/ , ({match,range}) =>
274
+ buffer .backwardsScan / ^ (\s * )import/ , ({match, range}) =>
275
275
r = buffer .rangeForRow range .start .row
276
- @editor .setTextInBufferRange [r .end ,r .end ],
276
+ @editor .setTextInBufferRange [r .end , r .end ],
277
277
" \n #{ match[1 ]} import #{ mod} "
278
278
279
- closeTooltips : () ->
279
+ closeTooltips : ->
280
280
@ hideExpressionType ()
281
281
@ hideCheckResult ()
282
282
0 commit comments