id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
octoblu/meshblu:test/lib/publishConfig-spec.coffee:3:completion | completion | beforeEach (done) ->
@configEvent = sinon.spy()
@subscriber = new Subscriber namespace: 'meshblu'
@subscriber.on 'message', @configEvent
@subscriber.subscribe 'config', 'uuid-interested-device', =>
@sut.publish done
afterEach ->
@subscriber.removeAllListeners()
it 'should... | {uuid: 'uuid-interested-device'}
]}
@database.devices.update query, update, done
beforeEach (done) ->
@database.devices.insert
uuid: 'uuid-interested-device'
sendWhitelist: ['uuid-device-being-configged']
, done
beforeEach (done) ->
@subscriber = new Subscriber n... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | da4c413d52b9bfb5063eda4ef991e78f80712062 | 815 | https://github.com/octoblu/meshblu/blob/da4c413d52b9bfb5063eda4ef991e78f80712062/test/lib/publishConfig-spec.coffee | 92 | 130 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:2:raw_corpus | raw_corpus | it "should publish the config to 'uuid-device-being-configged'", ->
expect(@message).to.deep.equal foo: 'bar'
describe "when another device is in the configForward list", ->
beforeEach (done) ->
@database.devices.insert
uuid: 'uuid-interested-device'
sendWhitelist: ['uuid-device-being... | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 43 | 90 | ||
octoblu/meshblu:test/lib/publishConfig-spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it "should publish the config to 'uuid-device-being-configged'", ->
expect(@message).to.deep.equal foo: 'bar'
describe "when another device is in the configForward list", ->
beforeEach (done) ->
@database.devices.insert
uuid: 'uuid-inte... | it("should publish the config to 'uuid-device-being-configged'", function() {
return expect(this.message).to.deep.equal({
foo: 'bar'
});
});
describe("when another device is in the configForward list", function() {
beforeEach(function(done) {
return this.database.devices.insert({
uuid: 'uuid-intere... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 43 | 90 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it("should publish the config to 'uuid-device-being-configged'", function() {
return expect(this.message).to.deep.equal({
foo: 'bar'
});
});
describe("when another device is in the configForward list", function() {
beforeEach(function(done) {
return ... | it "should publish the config to 'uuid-device-being-configged'", ->
expect(@message).to.deep.equal foo: 'bar'
describe "when another device is in the configForward list", ->
beforeEach (done) ->
@database.devices.insert
uuid: 'uuid-interested-device'
sendWhitelist: ['uuid-device-being... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 43 | 90 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:2:completion | completion | it "should publish the config to 'uuid-device-being-configged'", ->
expect(@message).to.deep.equal foo: 'bar'
describe "when another device is in the configForward list", ->
beforeEach (done) ->
@database.devices.insert
uuid: 'uuid-interested-device'
sendWhitelist: ['uuid-device-being... | uuid: 'uuid-uninterested-device'
sendWhitelist: []
, done
beforeEach (done) ->
@configEvent = sinon.spy()
subscriber = new Subscriber namespace: 'meshblu'
subscriber.once 'message', @configEvent
subscriber.subscribe 'config', 'uuid-uninterested-device', =>
@sut.publish... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 43 | 90 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:3:raw_corpus | raw_corpus | beforeEach (done) ->
@configEvent = sinon.spy()
@subscriber = new Subscriber namespace: 'meshblu'
@subscriber.on 'message', @configEvent
@subscriber.subscribe 'config', 'uuid-interested-device', =>
@sut.publish done
afterEach ->
@subscriber.removeAllListeners()
it 'should... | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 92 | 103 | ||
octoblu/meshblu:test/lib/publishConfig-spec.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
beforeEach (done) ->
@configEvent = sinon.spy()
@subscriber = new Subscriber namespace: 'meshblu'
@subscriber.on 'message', @configEvent
@subscriber.subscribe 'config', 'uuid-interested-device', =>
@sut.publish done
afterEach ... | beforeEach(function(done) {
this.configEvent = sinon.spy();
this.subscriber = new Subscriber({
namespace: 'meshblu'
});
this.subscriber.on('message', this.configEvent);
return this.subscriber.subscribe('config', 'uuid-interested-device', () => {
return this.sut.publish(done);
});
});
afterEach(func... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 92 | 103 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
beforeEach(function(done) {
this.configEvent = sinon.spy();
this.subscriber = new Subscriber({
namespace: 'meshblu'
});
this.subscriber.on('message', this.configEvent);
return this.subscriber.subscribe('config', 'uuid-interested-device', () => {
r... | beforeEach (done) ->
@configEvent = sinon.spy()
@subscriber = new Subscriber namespace: 'meshblu'
@subscriber.on 'message', @configEvent
@subscriber.subscribe 'config', 'uuid-interested-device', =>
@sut.publish done
afterEach ->
@subscriber.removeAllListeners()
it 'should... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 92 | 103 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:3:completion | completion | beforeEach (done) ->
@configEvent = sinon.spy()
@subscriber = new Subscriber namespace: 'meshblu'
@subscriber.on 'message', @configEvent
@subscriber.subscribe 'config', 'uuid-interested-device', =>
@sut.publish done | afterEach ->
@subscriber.removeAllListeners()
it 'should break free from the infinite loop and get here', ->
expect(@configEvent).to.have.been.calledOnce | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 05cdb904b696e4617f538c752231bf7bd37c9304 | 815 | https://github.com/octoblu/meshblu/blob/05cdb904b696e4617f538c752231bf7bd37c9304/test/lib/publishConfig-spec.coffee | 92 | 103 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:1:raw_corpus | raw_corpus | async = require 'async'
PublishConfig = require '../../lib/publishConfig'
Subscriber = require '../../lib/Subscriber'
Database = require '../test-database'
clearCache = require '../../lib/clearCache'
describe.only 'PublishConfig', ->
beforeEach (done) ->
uuids = [
'uuid-device-being-configged'
'uuid-... | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 78805b5aa1ddb414f1b99bbb14b68ef91613175c | 815 | https://github.com/octoblu/meshblu/blob/78805b5aa1ddb414f1b99bbb14b68ef91613175c/test/lib/publishConfig-spec.coffee | 1 | 41 | ||
octoblu/meshblu:test/lib/publishConfig-spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
PublishConfig = require '../../lib/publishConfig'
Subscriber = require '../../lib/Subscriber'
Database = require '../test-database'
clearCache = require '../../lib/clearCache'
describe.only 'PublishConfig', ->
beforeEach (done) ->
u... | var Database, PublishConfig, Subscriber, async, clearCache;
async = require('async');
PublishConfig = require('../../lib/publishConfig');
Subscriber = require('../../lib/Subscriber');
Database = require('../test-database');
clearCache = require('../../lib/clearCache');
describe.only('PublishConfig', function() {
... | CoffeeScript | JavaScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 78805b5aa1ddb414f1b99bbb14b68ef91613175c | 815 | https://github.com/octoblu/meshblu/blob/78805b5aa1ddb414f1b99bbb14b68ef91613175c/test/lib/publishConfig-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Database, PublishConfig, Subscriber, async, clearCache;
async = require('async');
PublishConfig = require('../../lib/publishConfig');
Subscriber = require('../../lib/Subscriber');
Database = require('../test-database');
clearCache = require('../../lib/clea... | async = require 'async'
PublishConfig = require '../../lib/publishConfig'
Subscriber = require '../../lib/Subscriber'
Database = require '../test-database'
clearCache = require '../../lib/clearCache'
describe.only 'PublishConfig', ->
beforeEach (done) ->
uuids = [
'uuid-device-being-configged'
'uuid-... | JavaScript | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 78805b5aa1ddb414f1b99bbb14b68ef91613175c | 815 | https://github.com/octoblu/meshblu/blob/78805b5aa1ddb414f1b99bbb14b68ef91613175c/test/lib/publishConfig-spec.coffee | 1 | 41 |
octoblu/meshblu:test/lib/publishConfig-spec.coffee:1:completion | completion | async = require 'async'
PublishConfig = require '../../lib/publishConfig'
Subscriber = require '../../lib/Subscriber'
Database = require '../test-database'
clearCache = require '../../lib/clearCache'
describe.only 'PublishConfig', ->
beforeEach (done) ->
uuids = [
'uuid-device-being-configged'
'uuid-... | uuid: 'uuid-device-being-configged'
meshblu:
configForward: [
{uuid: 'uuid-interested-device'}
{uuid: 'uuid-uninterested-device'}
]
, done
beforeEach ->
@sut = new PublishConfig
uuid: 'uuid-device-being-configged'
config: {foo: 'bar'}
database: @dat... | CoffeeScript | CoffeeScript | octoblu/meshblu | test/lib/publishConfig-spec.coffee | MIT | 78805b5aa1ddb414f1b99bbb14b68ef91613175c | 815 | https://github.com/octoblu/meshblu/blob/78805b5aa1ddb414f1b99bbb14b68ef91613175c/test/lib/publishConfig-spec.coffee | 1 | 41 |
orktes/atom-react:lib/atom-react.coffee:1:raw_corpus | raw_corpus | class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react(?:-native)?[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern:
type: ... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 4 | 53 | ||
orktes/atom-react:lib/atom-react.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react(?:-native)?[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?... | var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.l... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.js... | class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react(?:-native)?[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern:
type: ... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:1:completion | completion | class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react(?:-native)?[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern:
type: ... | editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
return fn.call(editor.languageMode, bufferRow, options) unless editor.getGrammar().scopeName == "source.js.jsx"
scopeDescriptor = @editor.scopeDescriptorForBufferPosition([bufferRow, 0])
decreaseNextLineIndentRegex = @getReg... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 54 | 103 | ||
orktes/atom-react:lib/atom-react.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(ed... | ({
patchEditorLangModeSuggestedIndentForBufferRow: function(editor) {
var fn, self;
self = this;
fn = editor.languageMode.suggestedIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.languageMode.suggestedIndentForBufferRow = function(bufferRow, options) {
var complexAtt... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
patchEditorLangModeSuggestedIndentForBufferRow: function(editor) {
var fn, self;
self = this;
fn = editor.languageMode.suggestedIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.languageMode.suggestedIndentForBufferRo... | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
tagStartTest = tagStartRegex.testSync(precedingLine)
decreaseIndentTest = decreaseIndentRegex.testSync(precedingLine)
indent += 1 if tagStartTest and... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file requires React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
jsxGrammar = atom.grammars.grammarsByScopeName["source.j... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 104 | 153 | ||
orktes/atom-react:lib/atom-react.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file requires React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
... | var extName, jsxGrammar, path;
if (this.isReactEnabledForEditor(editor)) {
path = require('path');
// Check if file extension is .jsx or the file requires React
extName = path.extname(editor.getPath());
if (extName === ".jsx" || (extName === ".js" && this.isReact(editor.getText()))) {
jsxGrammar = atom.gra... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 104 | 153 |
orktes/atom-react:lib/atom-react.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var extName, jsxGrammar, path;
if (this.isReactEnabledForEditor(editor)) {
path = require('path');
// Check if file extension is .jsx or the file requires React
extName = path.extname(editor.getPath());
if (extName === ".jsx" || (extName === ".js" && this.... | return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file requires React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
jsxGrammar = atom.grammars.grammarsByScopeName["source.j... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 104 | 153 |
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file requires React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
jsxGrammar = atom.grammars.grammarsByScopeName["source.j... | jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 104 | 153 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | catch err
# Parsing/formatting the selection failed lets try to parse the whole file but format the selection only
range = selection.getBufferRange().serialize()
# esprima ast line count starts for 1
range[0][0]++
range[1][0]++
jsxformat.setOptions({range: ra... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 154 | 203 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | catch err
# Parsing/formatting the selection failed lets try to parse the whole file but format the selection only
range = selection.getBufferRange().serialize()
# esprima ast line count starts for 1
range[0][0]++
range[1][0]++
jsxformat.setOptions({range: ra... | # return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
deactivate: ->
@disposableReformat.dispose()
@disposableHTMLTOJSX.dispose()
@disposableProcessEditor.dispose()
@disposa... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 154 | 203 |
orktes/atom-react:lib/atom-react.coffee:5:raw_corpus | raw_corpus | # Bind events
@disposableConfigListener = atom.config.observe 'react.detectReactFilePattern', (newValue) ->
contentCheckRegex = null
@disposableReformat = atom.commands.add 'atom-workspace', 'react:reformat-JSX', => @onReformat()
@disposableHTMLTOJSX = atom.commands.add 'atom-workspace', 'react:HTML-... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 204 | 211 | ||
orktes/atom-react:lib/atom-react.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# Bind events
@disposableConfigListener = atom.config.observe 'react.detectReactFilePattern', (newValue) ->
contentCheckRegex = null
@disposableReformat = atom.commands.add 'atom-workspace', 'react:reformat-JSX', => @onReformat()
@disposableHTM... | // Bind events
this.disposableConfigListener = atom.config.observe('react.detectReactFilePattern', function(newValue) {
var contentCheckRegex;
return contentCheckRegex = null;
});
this.disposableReformat = atom.commands.add('atom-workspace', 'react:reformat-JSX', () => {
return this.onReformat();
});
this.dispo... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 204 | 211 |
orktes/atom-react:lib/atom-react.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// Bind events
this.disposableConfigListener = atom.config.observe('react.detectReactFilePattern', function(newValue) {
var contentCheckRegex;
return contentCheckRegex = null;
});
this.disposableReformat = atom.commands.add('atom-workspace', 'react:reformat-JS... | # Bind events
@disposableConfigListener = atom.config.observe 'react.detectReactFilePattern', (newValue) ->
contentCheckRegex = null
@disposableReformat = atom.commands.add 'atom-workspace', 'react:reformat-JSX', => @onReformat()
@disposableHTMLTOJSX = atom.commands.add 'atom-workspace', 'react:HTML-... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 204 | 211 |
orktes/atom-react:lib/atom-react.coffee:5:completion | completion | # Bind events
@disposableConfigListener = atom.config.observe 'react.detectReactFilePattern', (newValue) ->
contentCheckRegex = null | @disposableReformat = atom.commands.add 'atom-workspace', 'react:reformat-JSX', => @onReformat()
@disposableHTMLTOJSX = atom.commands.add 'atom-workspace', 'react:HTML-to-JSX', => @onHTMLToJSX()
@disposableProcessEditor = atom.workspace.observeTextEditors @processEditor.bind(this) | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 946ddb79b604dbd38c25937812095f1368a5ed95 | 473 | https://github.com/orktes/atom-react/blob/946ddb79b604dbd38c25937812095f1368a5ed95/lib/atom-react.coffee | 204 | 211 |
orktes/atom-react:lib/atom-react.coffee:1:raw_corpus | raw_corpus | class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern:
type: 'string'
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3f39e07f31a70e72acb0245f0b8211fbb19ca897 | 473 | https://github.com/orktes/atom-react/blob/3f39e07f31a70e72acb0245f0b8211fbb19ca897/lib/atom-react.coffee | 4 | 53 | ||
orktes/atom-react:lib/atom-react.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'... | var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.l... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3f39e07f31a70e72acb0245f0b8211fbb19ca897 | 473 | https://github.com/orktes/atom-react/blob/3f39e07f31a70e72acb0245f0b8211fbb19ca897/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.js... | class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern:
type: 'string'
... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3f39e07f31a70e72acb0245f0b8211fbb19ca897 | 473 | https://github.com/orktes/atom-react/blob/3f39e07f31a70e72acb0245f0b8211fbb19ca897/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:1:completion | completion | class AtomReact
Subscriber.includeInto(this)
config:
detectReactFilePattern:
type: 'string'
default: '/require\\([\'"]react[\'"]\\)/'
jsxTagStartPattern:
type: 'string'
default: '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern:
type: 'string'
... | editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
return fn.call(editor.languageMode, bufferRow, options) unless editor.getGrammar().scopeName == "source.js.jsx"
scopeDescriptor = @editor.scopeDescriptorForBufferPosition([bufferRow, 0])
decreaseNextLineIndentRegex = @getReg... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3f39e07f31a70e72acb0245f0b8211fbb19ca897 | 473 | https://github.com/orktes/atom-react/blob/3f39e07f31a70e72acb0245f0b8211fbb19ca897/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 54 | 103 | ||
orktes/atom-react:lib/atom-react.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(ed... | ({
patchEditorLangModeSuggestedIndentForBufferRow: function(editor) {
var fn, self;
self = this;
fn = editor.languageMode.suggestedIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.languageMode.suggestedIndentForBufferRow = function(bufferRow, options) {
var complexAtt... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
patchEditorLangModeSuggestedIndentForBufferRow: function(editor) {
var fn, self;
self = this;
fn = editor.languageMode.suggestedIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.languageMode.suggestedIndentForBufferRo... | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
tagStartTest = tagStartRegex.testSync(precedingLine)
decreaseIndentTest = decreaseIndentRegex.testSync(precedingLine)
indent += 1 if tagStartTest and... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has require React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
jsxGrammar = atom.grammars.grammarsByScopeName["sourc... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 104 | 153 | ||
orktes/atom-react:lib/atom-react.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has require React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
... | var extName, jsxGrammar, path;
if (this.isReactEnabledForEditor(editor)) {
path = require('path');
// Check if file extension is .jsx or the file has require React
extName = path.extname(editor.getPath());
if (extName === ".jsx" || (extName === ".js" && this.isReact(editor.getText()))) {
jsxGrammar = atom.... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 104 | 153 |
orktes/atom-react:lib/atom-react.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var extName, jsxGrammar, path;
if (this.isReactEnabledForEditor(editor)) {
path = require('path');
// Check if file extension is .jsx or the file has require React
extName = path.extname(editor.getPath());
if (extName === ".jsx" || (extName === ".js" && th... | return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has require React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
jsxGrammar = atom.grammars.grammarsByScopeName["sourc... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 104 | 153 |
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has require React
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isReact(editor.getText()))
jsxGrammar = atom.grammars.grammarsByScopeName["sourc... | jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = require 'lodash'
editor = atom.workspace.... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4dc5204dc7b069bdf6b2f87c9c7b65a598116674 | 473 | https://github.com/orktes/atom-react/blob/4dc5204dc7b069bdf6b2f87c9c7b65a598116674/lib/atom-react.coffee | 104 | 153 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 0d12d717f11bc26fbda50cda878a7e2f7d619a63 | 473 | https://github.com/orktes/atom-react/blob/0d12d717f11bc26fbda50cda878a7e2f7d619a63/lib/atom-react.coffee | 54 | 103 | ||
orktes/atom-react:lib/atom-react.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(ed... | ({
patchEditorLangModeSuggestedIndentForBufferRow: function(editor) {
var fn, self;
self = this;
fn = editor.languageMode.suggestedIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.languageMode.suggestedIndentForBufferRow = function(bufferRow, options) {
var complexAtt... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 0d12d717f11bc26fbda50cda878a7e2f7d619a63 | 473 | https://github.com/orktes/atom-react/blob/0d12d717f11bc26fbda50cda878a7e2f7d619a63/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
patchEditorLangModeSuggestedIndentForBufferRow: function(editor) {
var fn, self;
self = this;
fn = editor.languageMode.suggestedIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.languageMode.suggestedIndentForBufferRo... | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 0d12d717f11bc26fbda50cda878a7e2f7d619a63 | 473 | https://github.com/orktes/atom-react/blob/0d12d717f11bc26fbda50cda878a7e2f7d619a63/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | patchEditorLangModeSuggestedIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.suggestedIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.suggestedIndentForBufferRow = (bufferRow, options) ->
indent = fn.call(editor.languageMode, bufferRow, options)
return inden... | if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
tagStartTest = tagStartRegex.testSync(precedingLine)
decreaseIndentTest = decreaseIndentRegex.testSync(precedingLine)
indent += 1 if tagStartTest and... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 0d12d717f11bc26fbda50cda878a7e2f7d619a63 | 473 | https://github.com/orktes/atom-react/blob/0d12d717f11bc26fbda50cda878a7e2f7d619a63/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | catch err
# Parsing/formatting the selection failed lets try to parse the whole file but format the selection only
range = selection.getBufferRange().serialize()
# esprima ast line count starts for 1
range[0][0]++
range[1][0]++
jsxformat.setOptions({range: ra... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | d439d27dd164db223ca8b152d6e0b766bfe47603 | 473 | https://github.com/orktes/atom-react/blob/d439d27dd164db223ca8b152d6e0b766bfe47603/lib/atom-react.coffee | 154 | 201 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | catch err
# Parsing/formatting the selection failed lets try to parse the whole file but format the selection only
range = selection.getBufferRange().serialize()
# esprima ast line count starts for 1
range[0][0]++
range[1][0]++
jsxformat.setOptions({range: ra... | # return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
deactivate: ->
@disposableReformat.dispose()
@disposableHTMLTOJSX.dispose()
@disposableProcessEditor.dispose()
@disposa... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | d439d27dd164db223ca8b152d6e0b766bfe47603 | 473 | https://github.com/orktes/atom-react/blob/d439d27dd164db223ca8b152d6e0b766bfe47603/lib/atom-react.coffee | 154 | 201 |
orktes/atom-react:lib/atom-react.coffee:1:raw_corpus | raw_corpus | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 4 | 53 | ||
orktes/atom-react:lib/atom-react.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDe... | var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.l... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.js... | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:1:completion | completion | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
... | not (increaseIndentRegex and increaseIndentRegex.testSync(precedingLine)) and
not @editor.isBufferRowCommented(precedingRow)
currentIndentLevel = @editor.indentationForBufferRow(precedingRow)
currentIndentLevel -= 1 if decreaseIndentRegex and decreaseIndentRegex.testSync(line)
desiredIn... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 4 | 53 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | precedingRow = @buffer.previousNonBlankRow(bufferRow)
return indent if precedingRow < 0
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indent... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 54 | 103 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | precedingRow = @buffer.previousNonBlankRow(bufferRow)
return indent if precedingRow < 0
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indent... | contentCheckRegex ?= /require\(['"]react['"]\)/
return text.match(contentCheckRegex)?
isReactEnabledForEditor: (editor) ->
return editor? && editor.getGrammar().scopeName == "source.js.jsx"
autoSetGrammar: (editor) ->
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 54 | 103 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 104 | 153 | ||
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
... | try
bufStart = selection.getBufferRange().serialize()[0]
jsxformat.setOptions({});
result = jsxformat.format(selection.getText())
selection.insertText(result, autoIndent: true);
editor.setCursorBufferPosition(bufStart)
catch err
# Parsing/formatting th... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 104 | 153 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (edi... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 154 | 187 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (edi... | @disposableProcessEditor.dispose()
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '(?x)
/>\\s*(,|;)?\\s*$
| ^\\s*\\S+.*</[-_\\.A-Za-z0-9]+>$'
atom.config.se... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | c970cebbf5199e5ed4c9c0cf191c74256c134055 | 473 | https://github.com/orktes/atom-react/blob/c970cebbf5199e5ed4c9c0cf191c74256c134055/lib/atom-react.coffee | 154 | 187 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | precedingRow = @buffer.previousNonBlankRow(bufferRow)
return indent if precedingRow < 0
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indent... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | precedingRow = @buffer.previousNonBlankRow(bufferRow)
return indent if precedingRow < 0
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indent... | doc = docblock.parse text;
for b in doc
return true if b[0] == 'jsx'
false
isReactEnabledForEditor: (editor) ->
return editor? && editor.getGrammar().scopeName == "source.js.jsx"
autoSetGrammar: (editor) ->
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if ... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | return if not @isReactEnabledForEditor editor
selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 103 | 152 | ||
orktes/atom-react:lib/atom-react.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
return if not @isReactEnabledForEditor editor
selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
... | var selections;
if (!this.isReactEnabledForEditor(editor)) {
selections = editor.getSelections();
return editor.transact(() => {
var i, jsxOutput, len, results, selection, selectionText;
results = [];
for (i = 0, len = selections.length; i < len; i++) {
selection = selections[i];
try {
... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var selections;
if (!this.isReactEnabledForEditor(editor)) {
selections = editor.getSelections();
return editor.transact(() => {
var i, jsxOutput, len, results, selection, selectionText;
results = [];
for (i = 0, len = selections.length; i < len; i... | return if not @isReactEnabledForEditor editor
selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | return if not @isReactEnabledForEditor editor
selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
... | selections = editor.getSelections()
editor.transact =>
for selection in selections
try
bufStart = selection.getBufferRange().serialize()[0]
jsxformat.setOptions({});
result = jsxformat.format(selection.getText())
selection.insertText(result, autoIndent: true);
... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | originalLineCount = editor.getLineCount()
editor.setText(result)
newLineCount = editor.getLineCount()
firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, last... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 153 | 189 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | originalLineCount = editor.getLineCount()
editor.setText(result)
newLineCount = editor.getLineCount()
firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, last... | @disposableReformat.dispose()
@disposableHTMLTOJSX.dispose()
@disposableProcessEditor.dispose()
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '(?x)
/>\\s*(,... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 4544ad02afd90467f8810b7c20d34c710435c25b | 473 | https://github.com/orktes/atom-react/blob/4544ad02afd90467f8810b7c20d34c710435c25b/lib/atom-react.coffee | 153 | 189 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | precedingRow = @buffer.previousNonBlankRow(bufferRow)
return indent if precedingRow < 0
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
retu... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 41042ee85291b36246877781ee20547d555e6968 | 473 | https://github.com/orktes/atom-react/blob/41042ee85291b36246877781ee20547d555e6968/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | precedingRow = @buffer.previousNonBlankRow(bufferRow)
return indent if precedingRow < 0
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
retu... | doc = docblock.parse text;
for b in doc
return true if b[0] == 'jsx'
false
isReactEnabledForEditor: (editor) ->
return editor? && editor.getGrammar().scopeName == "source.js.jsx"
autoSetGrammar: (editor) ->
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if ... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 41042ee85291b36246877781ee20547d555e6968 | 473 | https://github.com/orktes/atom-react/blob/41042ee85291b36246877781ee20547d555e6968/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:1:raw_corpus | raw_corpus | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 3 | 52 | ||
orktes/atom-react:lib/atom-react.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDe... | var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.jsxPatch) {
return;
}
return editor.l... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 3 | 52 |
orktes/atom-react:lib/atom-react.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var AtomReact;
AtomReact = (function() {
class AtomReact {
constructor() {}
patchEditorLangModeAutoDecreaseIndentForBufferRow(editor) {
var fn, self;
self = this;
fn = editor.languageMode.autoDecreaseIndentForBufferRow;
if (fn.js... | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 3 | 52 |
orktes/atom-react:lib/atom-react.coffee:1:completion | completion | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
return if fn.jsxPatch
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
... | not @editor.isBufferRowCommented(precedingRow)
currentIndentLevel = @editor.indentationForBufferRow(precedingRow)
currentIndentLevel -= 1 if decreaseIndentRegex and decreaseIndentRegex.testSync(line)
desiredIndentLevel = currentIndentLevel - 1
if desiredIndentLevel >= 0 and desiredIndent... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 3 | 52 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | return indent if precedingRow < 0
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
tagStartTest = tagStar... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | return indent if precedingRow < 0
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
tagStartTest = tagStar... | return true if b[0] == 'jsx'
false
isReactEnabledForEditor: (editor) ->
return editor? && editor.getGrammar().scopeName == "source.js.jsx"
autoSetGrammar: (editor) ->
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has the old JSX... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 103 | 152 | ||
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | selections = editor.getSelections()
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
... | for selection in selections
try
bufStart = selection.getBufferRange().serialize()[0]
jsxformat.setOptions({});
result = jsxformat.format(selection.getText())
selection.insertText(result, autoIndent: true);
editor.setCursorBufferPosition(bufStart)
catch e... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | newLineCount = editor.getLineCount()
firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([first... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 153 | 187 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | newLineCount = editor.getLineCount()
firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([first... | @disposableHTMLTOJSX.dispose()
@disposableProcessEditor.dispose()
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '(?x)
/>\\s*(,|;)?\\s*$
| ^\\s*\\S+.*</[-_\\... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 7c5fbf4bde3e3b6d47ab045935b307225679e9ba | 473 | https://github.com/orktes/atom-react/blob/7c5fbf4bde3e3b6d47ab045935b307225679e9ba/lib/atom-react.coffee | 153 | 187 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | return indent if precedingRow < 0
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
indent += 1 if tagStar... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | return indent if precedingRow < 0
if @editor.isBufferRowCommented(bufferRow) and @editor.isBufferRowCommented(precedingRow)
return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
indent += 1 if tagStar... | isReactEnabledForEditor: (editor) ->
return editor? && editor.getGrammar().scopeName == "source.js.jsx"
autoSetGrammar: (editor) ->
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has the old JSX notation
extName = path.extname(edito... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIn... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 103 | 152 | ||
orktes/atom-react:lib/atom-react.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsx... | editor.transact(() => {
var i, jsxOutput, len, results, selection, selectionText;
results = [];
for (i = 0, len = selections.length; i < len; i++) {
selection = selections[i];
try {
selectionText = selection.getText();
jsxOutput = converter.convert(selectionText);
try {
jsxformat... | CoffeeScript | JavaScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
editor.transact(() => {
var i, jsxOutput, len, results, selection, selectionText;
results = [];
for (i = 0, len = selections.length; i < len; i++) {
selection = selections[i];
try {
selectionText = selection.getText();
jsxOutput = converte... | editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIn... | JavaScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | editor.transact =>
for selection in selections
try
selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIn... | bufStart = selection.getBufferRange().serialize()[0]
jsxformat.setOptions({});
result = jsxformat.format(selection.getText())
selection.insertText(result, autoIndent: true);
editor.setCursorBufferPosition(bufStart)
catch err
# Parsing/formatting the selection fa... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (edi... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 153 | 183 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (edi... | @disposableHTMLTOJSX.dispose()
@disposableProcessEditor.dispose()
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*(,|;)?\\s*$'
atom.config.set("react.jsxT... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 1695ca4f99a28ac3410be0e851af3773c6f0329a | 473 | https://github.com/orktes/atom-react/blob/1695ca4f99a28ac3410be0e851af3773c6f0329a/lib/atom-react.coffee | 153 | 183 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (edi... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 535620e9311b694d504699df6fa7e99da5a2aced | 473 | https://github.com/orktes/atom-react/blob/535620e9311b694d504699df6fa7e99da5a2aced/lib/atom-react.coffee | 153 | 179 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | firstChangedLine = range[0][0] - 1
lastChangedLine = range[1][0] - 1 + (newLineCount - originalLineCount)
editor.autoIndentBufferRows(firstChangedLine, lastChangedLine)
# return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (edi... | activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\']* $|\\( [^)"\']* $'
decreaseIndentForNextLinePattern = '/>\\s*(,|;)?\\s*$'
atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.config.set("react.jsxComple... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 535620e9311b694d504699df6fa7e99da5a2aced | 473 | https://github.com/orktes/atom-react/blob/535620e9311b694d504699df6fa7e99da5a2aced/lib/atom-react.coffee | 153 | 179 |
orktes/atom-react:lib/atom-react.coffee:1:raw_corpus | raw_corpus | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
return fn.call(editor.langu... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 3 | 52 | ||
orktes/atom-react:lib/atom-react.coffee:1:completion | completion | class AtomReact
Subscriber.includeInto(this)
constructor: ->
patchEditorLangModeAutoDecreaseIndentForBufferRow: (editor) ->
self = this
fn = editor.languageMode.autoDecreaseIndentForBufferRow
editor.languageMode.autoDecreaseIndentForBufferRow = (bufferRow, options) ->
return fn.call(editor.langu... | currentIndentLevel -= 1 if decreaseIndentRegex and decreaseIndentRegex.testSync(line)
desiredIndentLevel = currentIndentLevel - 1
if desiredIndentLevel >= 0 and desiredIndentLevel < currentIndentLevel
@editor.setIndentationForBufferRow(bufferRow, desiredIndentLevel)
else if not @editor.i... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 3 | 52 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine) and not @editor.isBufferRowCommented(precedingRow)
i... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 53 | 102 | ||
orktes/atom-react:lib/atom-react.coffee:2:completion | completion | return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine) and not @editor.isBufferRowCommented(precedingRow)
i... | autoSetGrammar: (editor) ->
return if @isReactEnabledForEditor editor
path = require 'path'
# Check if file extension is .jsx or the file has the old JSX notation
extName = path.extname(editor.getPath())
if extName is ".jsx" or (extName is ".js" and @isJSX(editor.getText()))
jsxGrammar = ato... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 53 | 102 |
orktes/atom-react:lib/atom-react.coffee:3:raw_corpus | raw_corpus | selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = ... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 103 | 152 | ||
orktes/atom-react:lib/atom-react.coffee:3:completion | completion | selectionText = selection.getText()
jsxOutput = converter.convert(selectionText)
try
jsxformat.setOptions({});
jsxOutput = jsxformat.format(jsxOutput)
selection.insertText(jsxOutput, autoIndent: true);
onReformat: ->
jsxformat = require 'jsxformat'
_ = ... | editor.setCursorBufferPosition(bufStart)
catch err
# Parsing/formatting the selection failed lets try to parse the whole file but format the selection only
range = selection.getBufferRange().serialize()
# esprima ast line count starts for 1
range[0][0]++
range[1... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 103 | 152 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | # return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\'... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 153 | 175 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | # return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\'... | decreaseIndentForNextLinePattern = '/>\\s*(,|;)?\\s*$'
atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.config.set("react.jsxComplexAttributePattern", jsxComplexAttributePattern)
atom.config.set("react.decreaseIndentForNextLinePattern", decreaseIndentForNextLinePattern)
# Bind even... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 3b3119407e6de87e96fc259b66602e61eb51e561 | 473 | https://github.com/orktes/atom-react/blob/3b3119407e6de87e96fc259b66602e61eb51e561/lib/atom-react.coffee | 153 | 175 |
orktes/atom-react:lib/atom-react.coffee:4:raw_corpus | raw_corpus | # return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\'... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 522347e802bdb215a9ad3ee705431b0bd6e412f6 | 473 | https://github.com/orktes/atom-react/blob/522347e802bdb215a9ad3ee705431b0bd6e412f6/lib/atom-react.coffee | 153 | 175 | ||
orktes/atom-react:lib/atom-react.coffee:4:completion | completion | # return back
editor.setCursorBufferPosition([firstChangedLine, range[0][1]])
processEditor: (editor) ->
@patchEditorLangMode(editor)
@autoSetGrammar(editor)
activate: ->
jsxTagStartPattern = '(?x)((^|=|return)\\s*<([^!/?](?!.+?(</.+?>))))'
jsxComplexAttributePattern = '(?x)\\{ [^}"\'... | decreaseIndentForNextLinePattern = '/>\\s*,?\\s*$'
atom.config.set("react.jsxTagStartPattern", jsxTagStartPattern)
atom.config.set("react.jsxComplexAttributePattern", jsxComplexAttributePattern)
atom.config.set("react.decreaseIndentForNextLinePattern", decreaseIndentForNextLinePattern)
# Bind events
... | CoffeeScript | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | 522347e802bdb215a9ad3ee705431b0bd6e412f6 | 473 | https://github.com/orktes/atom-react/blob/522347e802bdb215a9ad3ee705431b0bd6e412f6/lib/atom-react.coffee | 153 | 175 |
orktes/atom-react:lib/atom-react.coffee:2:raw_corpus | raw_corpus | return @editor.indentationForBufferRow(precedingRow)
precedingLine = @buffer.lineForRow(precedingRow)
return indent if not precedingLine?
indent += 1 if tagStartRegex.testSync(precedingLine) and complexAttributeRegex.testSync(precedingLine) and not @editor.isBufferRowCommented(precedingRow)
i... | CoffeeScript | orktes/atom-react | lib/atom-react.coffee | MIT | cbdc69554e7cb49c1a1a9f4c6fa414fc1f40c2b9 | 473 | https://github.com/orktes/atom-react/blob/cbdc69554e7cb49c1a1a9f4c6fa414fc1f40c2b9/lib/atom-react.coffee | 53 | 102 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.