1- const { CompositeDisposable, Range, Point} = require ( 'atom' )
1+ const { CompositeDisposable, Range, Point } = require ( 'atom' )
22
33module . exports = class SnippetExpansion {
4- constructor ( snippet , editor , cursor , snippets ) {
4+ constructor ( snippet , editor , cursor , snippets ) {
55 this . settingTabStop = false
66 this . isIgnoringBufferChanges = false
77 this . onUndoOrRedo = this . onUndoOrRedo . bind ( this )
88 this . snippet = snippet
99 this . editor = editor
1010 this . cursor = cursor
1111 this . snippets = snippets
12- this . subscriptions = new CompositeDisposable
12+ this . subscriptions = new CompositeDisposable ( )
1313 this . tabStopMarkers = [ ]
1414 this . selections = [ this . cursor . selection ]
1515
1616 const startPosition = this . cursor . selection . getBufferRange ( ) . start
17- let { body, tabStopList} = this . snippet
17+ let { body, tabStopList } = this . snippet
1818 let tabStops = tabStopList . toArray ( )
1919
20- let indent = this . editor . lineTextForBufferRow ( startPosition . row ) . match ( / ^ \s * / ) [ 0 ]
20+ const indent = this . editor . lineTextForBufferRow ( startPosition . row ) . match ( / ^ \s * / ) [ 0 ]
2121 if ( this . snippet . lineCount > 1 && indent ) {
2222 // Add proper leading indentation to the snippet
2323 body = body . replace ( / \n / g, `\n${ indent } ` )
@@ -28,7 +28,7 @@ module.exports = class SnippetExpansion {
2828 this . editor . transact ( ( ) => {
2929 this . ignoringBufferChanges ( ( ) => {
3030 this . editor . transact ( ( ) => {
31- const newRange = this . cursor . selection . insertText ( body , { autoIndent : false } )
31+ const newRange = this . cursor . selection . insertText ( body , { autoIndent : false } )
3232 if ( this . snippet . tabStopList . length > 0 ) {
3333 this . subscriptions . add ( this . cursor . onDidChangePosition ( event => this . cursorMoved ( event ) ) )
3434 this . subscriptions . add ( this . cursor . onDidDestroy ( ( ) => this . cursorDestroyed ( ) ) )
@@ -47,7 +47,7 @@ module.exports = class SnippetExpansion {
4747 this . isUndoingOrRedoing = true
4848 }
4949
50- cursorMoved ( { oldBufferPosition, newBufferPosition, textChanged} ) {
50+ cursorMoved ( { oldBufferPosition, newBufferPosition, textChanged } ) {
5151 if ( this . settingTabStop || textChanged ) { return }
5252 const itemWithCursor = this . tabStopMarkers [ this . tabStopIndex ] . find ( item => item . marker . getBufferRange ( ) . containsPoint ( newBufferPosition ) )
5353
@@ -95,7 +95,7 @@ module.exports = class SnippetExpansion {
9595
9696 this . ignoringBufferChanges ( ( ) => {
9797 for ( const item of items ) {
98- const { marker, insertion} = item
98+ const { marker, insertion } = item
9999 var range = marker . getBufferRange ( )
100100
101101 // Don't transform mirrored tab stops. They have their own cursors, so
@@ -115,14 +115,14 @@ module.exports = class SnippetExpansion {
115115
116116 placeTabStopMarkers ( startPosition , tabStops ) {
117117 for ( const tabStop of tabStops ) {
118- const { insertions} = tabStop
118+ const { insertions } = tabStop
119119 const markers = [ ]
120120
121121 if ( ! tabStop . isValid ( ) ) { continue }
122122
123123 for ( const insertion of insertions ) {
124- const { range} = insertion
125- const { start, end} = range
124+ const { range } = insertion
125+ const { start, end } = range
126126 const marker = this . getMarkerLayer ( this . editor ) . markBufferRange ( [
127127 startPosition . traverse ( start ) ,
128128 startPosition . traverse ( end )
@@ -178,7 +178,7 @@ module.exports = class SnippetExpansion {
178178 const ranges = [ ]
179179 this . hasTransforms = false
180180 for ( const item of items ) {
181- const { marker, insertion} = item
181+ const { marker, insertion } = item
182182 if ( marker . isDestroyed ( ) ) { continue }
183183 if ( ! marker . isValid ( ) ) { continue }
184184 if ( insertion . isTransformation ( ) ) {
@@ -217,7 +217,7 @@ module.exports = class SnippetExpansion {
217217 if ( this . tabStopMarkers . length === 0 ) { return }
218218 const items = this . tabStopMarkers [ this . tabStopMarkers . length - 1 ]
219219 if ( items . length === 0 ) { return }
220- const { marker : lastMarker } = items [ items . length - 1 ]
220+ const { marker : lastMarker } = items [ items . length - 1 ]
221221 if ( lastMarker . isDestroyed ( ) ) {
222222 return false
223223 } else {
0 commit comments