Fix up atom package

This commit is contained in:
James Long committed 2017-01-09 23:44:12 -05:00
1 parent dd8dda101d
commit b553718aee
3 files changed
+24 -19

No files matched your search

+18 -13
View File
@@ -71,8 +71,12 @@ module.exports = {
if (!editor.getBuffer().isModified())
return;
// var formatOnSave = atom.config.get('prettier.formatOnSave', {scope: editor.getRootScopeDescriptor()})
// if (!formatOnSave) return
var formatOnSave = atom.config.get("prettier-atom.formatOnSave", {
scope: editor.getRootScopeDescriptor()
});
if (!formatOnSave)
return;
// Set the relative path based on the file's nearest package.json.
// If no package.json is found, use path verbatim.
var relativePath;
@@ -88,17 +92,18 @@ module.exports = {
}
}.bind(this)
);
if (editor.editorElement) {
window.addEventListener("resize", e => {
const { width } = window.document.body.getBoundingClientRect();
const columns = width /
editor.editorElement.getDefaultCharacterWidth() |
0;
console.log(width, columns);
this.format({ selection: false, printWidth: columns });
});
}
// Uncomment this to format on resize. Not ready yet. :)
//
// if (editor.editorElement) {
// window.addEventListener("resize", e => {
// const { width } = window.document.body.getBoundingClientRect();
// const columns = width /
// editor.editorElement.getDefaultCharacterWidth() |
// 0;
// console.log(width, columns);
// this.format({ selection: false, printWidth: columns });
// });
// }
},
config: { formatOnSave: { type: "boolean", default: false } }
};
+5 -5
View File
@@ -1,21 +1,21 @@
{
"name": "jscodefmt-atom",
"main": "./lib/jscodefmt.js",
"name": "prettier-atom",
"main": "./lib/prettier.js",
"version": "0.0.1",
"description": "Format file contents using jscodefmt",
"description": "Format file contents using prettier",
"keywords": [
"javascript",
"formatter"
],
"activationCommands": [],
"repository": "https://github.com/stephenkubovic/atom-standard-formatter",
"repository": "https://github.com/jlongster/prettier",
"license": "MIT",
"engines": {
"atom": ">=0.174.0 <2.0.0"
},
"dependencies": {
"find-root": "^0.1.1",
"jscodefmt": "^0.0.1"
"prettier": "0.0.2"
},
"devDependencies": {}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "0.0.1",
"version": "0.0.2",
"bin": {
"prettier": "./bin/prettier"
},