stephenkeep / brackets-pretty-json Goto Github PK
View Code? Open in Web Editor NEWMake Your Json Pretty
Make Your Json Pretty
Whenever I run the pretty json command it scrolls me back up to the top of the file. It would be preferable if it stayed in the same place in the document after the command has run. If it helps I am on Brackets Mac sprint 41.
It would be great if you could have the reverse function, that is to turn many lines of JSON to one line.
I am editing some files which are one line, so I use your extension to turn it into many lines for readability. However to turn it back to one line I have use external tools.
Cheers
Cannot assign Shift-Cmd-P to PrettyJson.MakePrettyJson. It is already assigned to python-pep8.run /command/KeyBindingManager.js:463
I assume that Shift-Ctrp-B should be ok for this. I'm thinking B should come from beautiful, so there is no conflict.
In the past days I was trying to write a brackets extension to lint json for myself.
For it I used https://github.com/zaach/jsonlint too and I was able to overwrite the error to have something more useful for me.
Since I used your extension and saw you do some custom parsing I decided to file this issue.
I'm not sure it is correct or documented but still something I think is useful.
(I changed a bit my code so I'm not sure everything is still correct)
linter.js
var jsonlint = require('jsonlint');
var parser = jsonlint.parser;
parser.parseError = parser.lexer.parseError = function (str, hash) {
var err = new Error(str);
err.line = hash.loc.first_line;
err.col = hash.loc.last_column;
err.token = hash.token;
err.expected = hash.expected;
throw err;
};
linterDomain.js
function cmdLintFile(text, fullPath, options) {
try {
jsonlinter.parse(text, options);
} catch (e) {
var message = 'Expecting: ' + e.expected.join(' or ') + '. Found: \'' + e.token + '\'.';
var error = {
pos: {
line: e.line - 1,
ch: e.col
},
message: message,
type: domainName + '.type'
};
error.e = e;
var remapped = { errors: [error] };
return remapped;
}
return null;
}
FWIW I filed a similar issue at ingorichter/de.richter.brackets.jsonlint#4
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.