jdavisclark / jsformat-atom Goto Github PK
View Code? Open in Web Editor NEWjavascript formatting for the Atom editor
License: MIT License
javascript formatting for the Atom editor
License: MIT License
Currently all tailing newlines are trimmed. However it's often better for developers to leave at least one new line at the end of a document. http://stackoverflow.com/questions/729692/why-should-files-end-with-a-newline
This feature might come as part of .jsbeautifurc
or .editorconfig
since they both support end_with_newline
/ insert_final_newline
options.
This will need some tests before moving to 1.0.0, so that we can make sure things won't break in the future.
open a js file
change the document style to plaintext (because I prefer to not format)
save the document
Atom Version: 1.0.19
System: Mac OS X 10.11.1
Thrown From: jsformat package, v0.9.0
Uncaught TypeError: atom.views.getView(...).append is not a function
At /Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:809
TypeError: atom.views.getView(...).append is not a function
at Object.module.exports.displayUnsupportedLanguageNotification (/Users/santi/.atom/packages/jsformat/lib/format.coffee:153:40)
at Object.module.exports.format (/Users/santi/.atom/packages/jsformat/lib/format.coffee:33:8)
at /Users/santi/.atom/packages/jsformat/lib/format.coffee:110:18
at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:767:18)
at /Users/santi/.atom/packages/jsformat/lib/format.coffee:109:22
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1012:20)
at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1004:19)
at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:584:26)
at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:547:18)
-0:05.5.0 grammar-selector:show (atom-text-editor.editor)
-0:03.0 core:select-all (atom-text-editor.editor.is-focused)
-0:02.5.0 core:paste (atom-text-editor.editor.is-focused)
-0:01.2.0 core:save (atom-text-editor.editor.is-focused)
{
"core": {}
}
# User
atom-html-preview, v0.1.11
atom-jade, v0.3.0
esformatter, v1.13.0
jsformat, v0.9.0
linter, v1.6.0
linter-eslint, v3.0.2
# Dev
No dev packages
I turn this option off but something is resetting it.
I noticed a weird thing with the new update. The cursor seems to always go back exactly one word (\w+) or punctuation.
You can easily reproduce it with format on save:
1-Type in
first.second.third();
2-Save it
3-Repeat number 2 over and over and watch how the cursor moves
It seems to happen in one particular file in one of my projects which makes it weird and hard to reproduce. My Atom is configures with soft tabs and tab length = to 4.
It looks like space after anon function option was removed between 0.6
and 0.7
releases.
Files like a .jshintrc
with lots of aligned comments should be ignored, so I'm adding a field for that. Looking for any other files that should be ignored by default.
@jdc0589 @jeffschwartz @plemarquand any thoughts?
atom.workspaceView is no longer available.
In most cases you will not need the view. See the Workspace docs for
alternatives: https://atom.io/docs/api/latest/Workspace.
If you do need the view, please use atom.views.getView(atom.workspace)
,
which returns an HTMLElement.
Atom.Object.defineProperty.get (/Applications/Atom.app/Contents/Resources/app/src/atom.js:54:11)
Object.displayUnsupportedLanguageNotification (/Users/alan/.atom/packages/jsformat/lib/format.coffee:153:9)
JSFormat should probably obey editorconfig, because it is per project where JSFormat is for all of Atom.
put the cursor back in the correct spot, accounting for whitespace changes.
no one likes it when the editor jumps all over the place when you format code...
This should also keep the cursor in the same location it was prior to formatting.
I don't like 4 spaces personally
You can just hack it in by adding indent_size: 2
under configDefaults
in lib/format.coffee
, but I think I'd much rather be able to configure it in the GUI.
Requiring View
from atom
is no longer supported.
Please require atom-space-pen-views
instead:
{View} = require 'atom-space-pen-views'
Add "atom-space-pen-views": "^2.0.3"
to your package dependencies.
Object.Object.defineProperty.get (/Applications/Atom.app/Contents/Resources/app/exports/atom.js:62:11)
Object.<anonymous> (/Users/matt/.atom/packages/jsformat/lib/not-supported-view.coffee:1:1)
Sometimes (often) when the document is formatted (on save) the cursor is moved to the top of the window. I assume this is because the whole file is 'selected' for formatting, because if I undo the cursor positions it goes back to the bottom of the page and then back to the original position.
It's not the end of the world, but gets quite irritating.
Apart from that I much prefer jsformat over atom-beautify - thanks!
I can fix this temporarily by changing line 73 in lib/format.coffee to
mainCursor.setBufferPosition(currentCursorPosition)
but I suspect this may break formatting of selections?
Atom will no longer load this package after June 1st without changes. There are a couple deprecations on the latest version (0.8.1
) of this package:
atom.views.getView(atom.workspace)
, which returns an HTMLElement.Visit https://gist.github.com/benogle/6d09e295c84b717ef9b4 and search for your package name to see up-to-date deprecations being reported by this package.
See atom/atom#6867 for more info.
Cannot find module 'js-beautify'
Hide Stack Trace
Error: Cannot find module 'js-beautify'
at Module._resolveFilename (module.js:328:15)
at Function.Module._resolveFilename (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\module-cache.js:383:52)
at Function.Module._load (module.js:270:25)
at Module.require (module.js:357:17)
at require (module.js:376:17)
at Object. (C:\Users\rdelaparral.atom\packages\jsformat-atom-master\lib\format.coffee:4:15)
at Object. (C:\Users\rdelaparral.atom\packages\jsformat-atom-master\lib\format.coffee:1:1)
at Module._compile (module.js:452:26)
at Object.requireCoffeeScript (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\node_modules\coffee-cash\lib\coffee-cash.js:85:19)
at Module.load (module.js:347:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:357:17)
at require (module.js:376:17)
at Package.module.exports.Package.requireMainModule (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\package.js:715:34)
at C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\package.js:190:28
at Package.module.exports.Package.measure (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\package.js:167:15)
at Package.module.exports.Package.load (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\package.js:181:12)
at PackageManager.module.exports.PackageManager.loadPackage (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\package-manager.js:373:14)
at PackageManager.module.exports.PackageManager.loadPackages (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\package-manager.js:337:14)
at Atom.module.exports.Atom.startEditorWindow (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\atom.js:670:21)
at Object. (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\window-bootstrap.js:12:8)
at Object. (C:\Users\rdelaparral\AppData\Local\atom\app-1.0.3\resources\app.asar\src\window-bootstrap.js:23:4)
at Module._compile (module.js:452:26)
at Object.loadFile as .js
at Module.load (module.js:347:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:357:17)
at require (module.js:376:17)
at setupWindow (file:///C:/Users/rdelaparral/AppData/Local/atom/app-1.0.3/resources/app.asar/static/index.js:96:23)
at window.onload (file:///C:/Users/rdelaparral/AppData/Local/atom/app-1.0.3/resources/app.asar/static/index.js:36:7)
It would be advantageous to supporting the formatting of JavaScript within <script></script> tags embedded inside of file types other than .js. This would allow embed JavaScript formatting inside of .html/htm documents. The way I envision this working is that some key mapping would be used to trigger the request. The cursor would need to be within the boundaries of an opening/closing pair of script tags which would define the content to be formatted.
when ever I format the document I'm working on with ctrl+alt+f
the cursor jumps to the last line.
This is annoying when the document is longer.
Is there a way to switch off this behaviour?
Reactjs uses jsx and jsx has what looks like html inside the javascript code so when the jsformat package autoformats it doesnt deal with the jsx properly.If its possible to ignore formatting within the return that would be great!!! Here is an example.
var DateFields = React.createClass({
render: function () {
return (
<div>
<input type="hidden" name={this.props.name} value={this.state.value}/>
</div>
);
}
});
When I try to do 'ctrl-alt-f' Atom will prioritize 'editor:fold-section' instead of jsformat:format. I've tried this in JS files and LESS files. Same thing happens. When I do Ctrl+. to see keybinds I clearly see that 'editor:fold-selection' is being used instead of 'jsformat:format', which is listed as second priority.
Atom version 0.198.0
JSFormat verson: 0.8.0
add support for basic formatter settings customization.
e4x is starting to be deprecated by major browsers, and I don't think anyone uses it. Does anyone use e4x?
Not sure how to describe this. I the latest Atom (I have 0.134.0) the formatter is broken and adds a newline after every word to look like this:
var
start =
3;
var
end =
3;
I upgraded to latest jsformat-atom without success. My settings have not changed (and I played around with them). Any ideas?
The context menu CSON format has changed. Please see
https://atom.io/docs/api/latest/ContextMenuManager
Uncaught TypeError: undefined is not a function
Atom Version: 0.156.0
System: Mac OS X 10.10.1
Thrown From: jsformat package, v0.7.14
At /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:121
TypeError: undefined is not a function
at Object.module.exports.format (/Users/jeffrey/.atom/packages/jsformat/lib/format.coffee:30:22)
at /Users/jeffrey/.atom/packages/jsformat/lib/format.coffee:108:18
at History.module.exports.History.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:112:18)
at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:683:27)
at /Users/jeffrey/.atom/packages/jsformat/lib/format.coffee:107:22
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:82:11)
at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:961:20)
at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:954:19)
at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:585:26)
at Object.module.exports.autosavePaneItem (/Applications/Atom.app/Contents/Resources/app/node_modules/autosave/lib/autosave.js:56:80)
at Object.module.exports.autosaveAllPaneItems (/Applications/Atom.app/Contents/Resources/app/node_modules/autosave/lib/autosave.js:64:28)
at /Applications/Atom.app/Contents/Resources/app/node_modules/autosave/lib/autosave.js:25:26
/cc @atom/core
The settings page says: The Preferred Line Length Atom setting is only respected when the Soft Wrap At Preferred Line Length Atom setting is enabled.
I have disabled Soft Wrap, and JSFormat still breaks my lines at 80. I've had to set my preferred line length at 9999 to make sure it doesn't wrap the code.
Error log:
npm http GET https://registry.npmjs.org/event-kit
npm http GET https://registry.npmjs.org/js-beautify
npm http 304 https://registry.npmjs.org/event-kit
npm http 304 https://registry.npmjs.org/js-beautify
npm http GET https://registry.npmjs.org/grim
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/config-chain
npm http GET https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/config-chain
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/grim
npm http GET https://registry.npmjs.org/underscore-plus
npm http GET https://registry.npmjs.org/emissary
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/proto-list
npm http GET https://registry.npmjs.org/ini
npm http GET https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/proto-list
npm http 304 https://registry.npmjs.org/minimist/0.0.8
npm http 304 https://registry.npmjs.org/ini
npm http 304 https://registry.npmjs.org/underscore-plus
npm http 304 https://registry.npmjs.org/emissary
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/mixto
npm http GET https://registry.npmjs.org/property-accessors
npm WARN git config --get remote.origin.url
returned wrong result (https://github.com/Benvie/harmony-collections.git) Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
npm ERR! git clone https://github.com/Benvie/harmony-collections.git Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
npm ERR! Error: Command failed:
npm ERR!
npm ERR! Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
npm ERR!
npm ERR!
npm ERR!
npm ERR! at ChildProcess.exithandler (child_process.js:648:15)
npm ERR! at ChildProcess.emit (events.js:98:17)
npm ERR! at maybeClose (child_process.js:756:16)
npm ERR! at Socket. (child_process.js:969:11)
npm ERR! at Socket.emit (events.js:95:17)
npm ERR! at Pipe.close (net.js:465:12)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues
npm ERR! System Darwin 14.0.0
npm ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/.apmrc" "--userconfig" "/Users/pauldsmith/.atom/.apmrc" "install" "/Users/pauldsmith/.atom/.node-gyp/.atom/.apm/jsformat/0.7.9/package.tgz" "--target=0.18.0" "--arch=x64"
npm ERR! cwd /private/var/folders/kg/7y7k0wh16rj9ws8vb4s66ckw0000gn/T/apm-install-dir-114929-1944-l8m5pd
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.4
npm ERR! code 69
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/mixto
npm http 304 https://registry.npmjs.org/property-accessors
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/kg/7y7k0wh16rj9ws8vb4s66ckw0000gn/T/apm-install-dir-114929-1944-l8m5pd/npm-debug.log
npm ERR! not ok code 0
It would be advantageous to be able to apply formatting to only selected lines.
Whenever i run Jsformat: Format
in any file, I get the following (tried uninstalling/reinstalling & removing settings from config.cson - anything else I should try?) :
(btw, I'm a little new to Atom)
Uncaught TypeError: undefined is not a function
~/.atom/packages/jsformat/lib/format.coffee:153
TypeError: undefined is not a function
at Object.module.exports.displayUnsupportedLanguageNotification (/Users/sua/.atom/packages/jsformat/lib/format.coffee:153:40)
at Object.module.exports.format (/Users/sua/.atom/packages/jsformat/lib/format.coffee:33:8)
at atom-workspace. (/Users/sua/.atom/packages/jsformat/lib/format.coffee:14:64)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:241:29)
at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:520:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:355:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:177:20)
Has anyone noticed that JSFormat has stopped preserving newlines...?
var express = require('express');
var app = express();
var server = app.listen(3000, function() {
console.log('Started server on port %d', port);
});
becomes:
var express = require('express');
var app = express();
var server = app.listen(3000, function() {
console.log('Started server on port %d', port);
});
I have it set to 4 in the Atom config fyi.
In Atom v0.129.0 (OSX) I get a error when I'm closing a tab. The tab is still there but the link is broken (Cannot read property 'getBufferPosition' of undefined
).
Uncaught TypeError: Cannot read property 'dispose' of undefined ~/.atom/packages/jsformat/lib/format.coffee:111
When I close the second tab , the tabs stop responding and I get another error:
Error: Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.
at invariant (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/invariant.js:42:15)
at [object Object].ReactBrowserComponentMixin.getDOMNode (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactBrowserComponentMixin.js:38:9)
at [object Object].boundMethod [as getDOMNode] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
at [object Object].module.exports.React.createClass.isVisible (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:1211:19)
at [object Object].boundMethod [as isVisible] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
at [object Object].module.exports.React.createClass.checkForVisibilityChange (/Applications/Atom.app/Contents/Resources/app/src/editor-component.js:1236:16)
at [object Object].boundMethod [as checkForVisibilityChange] (/Applications/Atom.app/Contents/Resources/app/node_modules/react-atom-fork/lib/ReactCompositeComponent.js:1295:21)
at EditorView.module.exports.EditorView.hide (/Applications/Atom.app/Contents/Resources/app/src/editor-view.js:325:55)
at PaneView.module.exports.PaneView.onActiveItemChanged (/Applications/Atom.app/Contents/Resources/app/src/pane-view.js:339:19)
at /Applications/Atom.app/Contents/Resources/app/src/pane-view.js:3:61
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:71:11)
at Pane.module.exports.Pane.setActiveItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:250:22)
at Pane.module.exports.Pane.addItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:321:14)
at Pane.module.exports.Pane.activateItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:295:14)
at /Applications/Atom.app/Contents/Resources/app/src/workspace.js:351:16
at _fulfilled (/Applications/Atom.app/Contents/Resources/app/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Applications/Atom.app/Contents/Resources/app/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/q/q.js:749:13)
at /Applications/Atom.app/Contents/Resources/app/node_modules/q/q.js:557:44
at flush (/Applications/Atom.app/Contents/Resources/app/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:349:11)
When the package meteor-api is installed, its syntaxt-highlighting 'javascript (meteor)' breaks the .js recognition of jsformat.
No show stopper, because syntaxt-highlighting can bechanged, but not intuitive at all. ;)
It would be advantageous, if we don't have to "copy" the project specific jsbeautify config to the plugin /panel settings. The jsbeautifyrc file should overwrite the plugin/panel settings.
What do you think? I'm alone with this requirement? Or I'm using it currently wrong?
I have my spacing set to 2 soft tabs, when i jsformat, it indents everything in by another 2 spaces. It should not indent twice the amount of spaces.
As the title says...the option is supported by jsbeautifier
-C, --comma-first Put commas at the beginning of new line instead of end
I'd be glad to take any workaround to supply opts to js beautifier in addition to those exposed on the atom ui, too. Thanks.
From @MichaelReeder on December 10, 2014 14:43
Uncaught TypeError: Cannot read property 'dispose' of undefined
Atom Version: 0.154.0
System: Mac OS X 10.9.3
Thrown From: jsformat package
At /Users/michaelreeder/.atom/packages/jsformat/lib/format.coffee:111
TypeError: Cannot read property 'dispose' of undefined
at /Users/michaelreeder/.atom/packages/jsformat/lib/format.coffee:111:48
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:82:11)
at TextBuffer.module.exports.TextBuffer.destroy (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1049:22)
at TextBuffer.module.exports.TextBuffer.release (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1074:14)
at TextEditor.module.exports.TextEditor.destroyed (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:260:19)
at TextEditor.module.exports.Model.destroy (/Applications/Atom.app/Contents/Resources/app/node_modules/theorist/lib/model.js:218:14)
at Pane.module.exports.Pane.destroyItem (/Applications/Atom.app/Contents/Resources/app/src/pane.js:445:18)
at TabBarView.module.exports.TabBarView.closeTab (/Applications/Atom.app/Contents/Resources/app/node_modules/tabs/lib/tab-bar-view.js:267:24)
at TabBarView.module.exports.TabBarView.closeAllTabs (/Applications/Atom.app/Contents/Resources/app/node_modules/tabs/lib/tab-bar-view.js:342:28)
at space-pen-ul.subscriptions.add.atom.commands.add.tabs:close-all-tabs (/Applications/Atom.app/Contents/Resources/app/node_modules/tabs/lib/tab-bar-view.js:67:26)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:243:29)
at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:61)
at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:156:19)
at [object Object].jQuery.fn.trigger (/Applications/Atom.app/Contents/Resources/app/src/space-pen-extensions.js:64:23)
at Ipc.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:70:67)
at Ipc.emit (events.js:110:17)
at process.<anonymous> (/Applications/Atom.app/Contents/Resources/atom/renderer/api/lib/ipc.js:22:29)
at process.emit (events.js:118:17)
at Ipc.sendSync (/Applications/Atom.app/Contents/Resources/atom/renderer/api/lib/ipc.js:39:29)
at Ipc.sendChannelSync (/Applications/Atom.app/Contents/Resources/atom/renderer/api/lib/ipc.js:47:28)
at BrowserWindow.RemoteMemberFunction [as emit] (/Applications/Atom.app/Contents/Resources/atom/renderer/api/lib/remote.js:110:29)
at ContextMenuManager.module.exports.ContextMenuManager.showForEvent (/Applications/Atom.app/Contents/Resources/app/src/context-menu-manager.js:169:33)
at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:138:33)
at HTMLDocument.handler (/Applications/Atom.app/Contents/Resources/app/src/space-pen-extensions.js:112:34)
at HTMLDocument.jQuery.event.dispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4681:9)
at HTMLDocument.elemData.handle (/Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4359:46)
Copied from original issue: atom/atom#4504
Like the title says, with JsFormat installed whenever I save a js file the cursor moves to the end of the file. Its disruptive particularly for someone like me who hammers ctrl+s all the time.
I guess the result of
if @selectionsAreEmpty editor
editor.setText(jsbeautify(editor.getText(), opts))
is it leaves the at the end of the text. Would this work?
cursor = editor.getCursorBufferPosition();
editor.setText(jsbeautify(editor.getText(), opts))
editor.setCursorBufferPosition(cursor);
need to handle the case when no views/editors are open. I feel like there should be a way to configure this via the package/plugin settings, not sure if such an option exists though.
[Enter steps to reproduce below:]
Atom Version: 1.5.3
System: Mac OS X 10.11.3
Thrown From: jsformat package, v0.9.1
Failed to load the jsformat package
At unexpected indentation in /Users/danielrodrigues/.atom/packages/jsformat/lib/format.coffee:154:1
SyntaxError: unexpected indentation
at /Users/danielrodrigues/.atom/packages/jsformat/lib/format.coffee:154:1
-8:42.8.0 pane:show-previous-item (atom-text-editor.editor.is-focused)
-6:32 tree-view:move (li.file.entry.list-item.selected)
-6:29.6.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-5:28.4.0 core:select-all (atom-text-editor.editor.is-focused)
-5:12.4.0 editor:auto-indent (atom-text-editor.editor.is-focused)
-5:09.5.0 core:undo (atom-text-editor.editor.is-focused)
-4:36.4.0 settings-view:install-packages-and-themes (atom-text-editor.editor.is-focused)
-4:11.8.0 core:confirm (atom-text-editor.editor.mini.is-focused)
2x -2:00.1.0 core:backspace (atom-text-editor.editor.is-focused)
-1:36.6.0 core:move-left (atom-text-editor.editor.is-focused)
3x -1:35.6.0 core:backspace (atom-text-editor.editor.is-focused)
-1:30.1.0 core:save (textarea.)
-1:10.3.0 core:backspace (atom-text-editor.editor.is-focused)
-1:03.7.0 core:move-right (atom-text-editor.editor.is-focused)
-1:00.6.0 core:backspace (atom-text-editor.editor.is-focused)
-0:26.8.0 settings-view:install-packages-and-themes (atom-text-editor.editor.is-focused)
{}
# User
jsformat, v0.9.1
jshint, v1.8.3
terminal-plus, v0.14.5
# Dev
No dev packages
would be nice.
The format on save option when set works but the keybinding doesn't.
Latest version of Atom & plugin running on a Mac OS 10.10.1.
Atom's switching event subscription API's, so some things will have to be reworked. The subscriptions can also be bundled and disposed at one time using the new CompositeDisposable
class.
In keymaps/format.cson: Use the atom-workspace
tag instead of the workspace
class.
Import statements in ES6 get treated as object when written as
import {SomeClass} form './some/path'
results in:
import {
SomeClass
}from
'./some/path
Happy to look into this but don't have the time to comb the source, I'd need some sort of pointing in the right direction. I suspect this wouldn't be too involved. I'd didn't noticed but export might be effected also.
Outside of that great little package (wait that sounded bad lol) thx for the hard work!!
Currently, beautify on save always beautifies (and thus, scrolls everything) even if nothing has been changed.
My suggestions is not beautifying anything if the file has already been beautified and has not been changed since the last save.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.