Comments (30)
It's in the wrong format there.
See this for an example of the right format.
from atom-beautify.
Ah, that is one correct schema, but I'm using the format that allows setting CSS and HTML options in conjunction with the JS ones.
See: https://github.com/einars/js-beautify#css--html
from atom-beautify.
I see no such format there, but will test it manually soon. If js-beautify works with that config, I'll implement it soon. However, according to the sources, it shouldn't work.
from atom-beautify.
Yeah, it's not well documented unfortunately, but it should work. I can dig around some more to see if I can find better docs! 👍
from atom-beautify.
I'm sorry to tell you, but I tested it manually, putting the mentioned config file and a test .js file in the same directory. js-beautify
, the package behind this one, does not handle that config format.
from atom-beautify.
Issue closing in 3...2...1... last comments?
from atom-beautify.
Interesting. How do you plan on allowing people to configure their CSS and HTML options?
The format I'm using works with Sublime HTMLPrettify (https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options), so maybe you could accept both schemas to increase interoperability?
If you'd accept that, I can work on a PR...
from atom-beautify.
Hm, that sublime plugin (I'm a sublime user too) uses its own logic for separating different beautifier configurations in one file. Although it's a logical approach, it's not supported officially by js-beautifier
. If you want to do a PR, please create it in a way that the plugin would be able to recognize both format. It's somewhat messy, and you'll probably sweat blood with config-chain (extra logic would need to be added there after parsing).
If so, good luck. If not, I'd create it somewhen, that config-chain stuff is a mess anyway, so I could ditch it.
from atom-beautify.
The format I'm using works with Sublime HTMLPrettify
This should probably be something which should be officially supported by js-beautify. Maybe you can create an issue their? // cc @einars
from atom-beautify.
There is actually an open issue upstream (beautifier/js-beautify#391).
It appears that there is an unofficial standard forming around projects wrapping js-beautify supporting all 3 languages preferences in their .jsbeautifyrc
.
I agree it would be best to get this unofficial standard officially supported in the core library. In the meantime perhaps at least supporting the JS portion of JSON configs with sub-objects would be good.
from atom-beautify.
It seems they still didn't make a decision about which way to go there, either to create a new project (beautify-web), or update the functionality with jsbeautify. (I'd take the latter approach).
In the meantime I'm not sure if we should provide this functionality on top of that library.
from atom-beautify.
Interesting. Well, I would go the other way and create a new project for that like "beautify-web", because "jsbeautify" is so misleading, if it not just beautifies JavaScript.
On the other hand... if you just want to beautify JavaScript there are other projects which are a little bit more promising: jscs (which will support auto-formatting in the future) or esformatter.
from atom-beautify.
@gvn Could you check out the new examples folder? It looks like the nested settings still don't work: https://github.com/donaldpipowitch/atom-beautify/tree/master/examples/nested-jsbeautifyrc
I used "indent_size"
with a value of 2
for JS, 4
for CSS and 6
for HTML, but after merging every setting seems to become 2
?
from atom-beautify.
Hmm, yeah I can see why. Everything is getting flattened down to a single level and indent_size
is the same property name used by all 3 formatters, so they get merged together to a single shared value. There are a few other properties with shared names too, like indent-char
.
I'm wondering how this is supposed to be differentiated in the original non-nested schema.
For the nested one I can see about preventing them from being merged together somehow...
from atom-beautify.
I didn't looked to much into the SublimeText plugin and how they do that, but I thought that was the purpose of the nested configuration so a user can choose to use different indent_char
and indent_size
dependent on file type? Isn't that the case?
from atom-beautify.
Honestly I didn't realize you could put all language config at the same level to begin with! I thought you had to nest them. But yeah, that's probably why they did it (also, organization).
I'll see if I can get another PR together soon to enable varying same-name properties between languages.
from atom-beautify.
Let me add some information here.
When you pushed the PR, I looked into it and already have seen that it would not work. You were listening for nested objects in the configuration, and while the assumption is right, the configuration for each type (html/css/js) can be nested further.
My suggestion would be to check if the parsed json has "html", "js", or "css" keys, and then use the appropriate key.
from atom-beautify.
I have a sense of how to add this functionality, but it may be a week or so until I get a chance to put a patch together...
from atom-beautify.
I was a little bit to fast and already merged it with master (normally I'm not the maintainer of a project, but a contributor^^), but it isn't released yet. I think we can wait a week :)
from atom-beautify.
The same issue existed before the patch I believe. Or at least you couldn't
set different spacing by language anyway. Thanks for your patience!
On Wednesday, May 21, 2014, Donald Pipowitch [email protected]
wrote:
I was a little bit to fast and already merged it with master (normally I'm
not the maintainer of a project, but a contributor^^), but it isn't
released yet. I think we can wait a week :)—
Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-43850283
.
Sent from gPhone
from atom-beautify.
Yeah, you're right. You couldn't set a different spacing by language before either :)
from atom-beautify.
Btw, when I bumped the version number in package.json
lately, the package didn't get updated on my atom. Actually, it is still on the one old version before I committed my first PR (2.0.4). apm update
does nothing.
Are there any hooks needed to be installed in the repo to get the package synchronized? If yes, are they set up correctly?
from atom-beautify.
Yeah, you need to set up apm correctly. I think it was with this command: $ apm dev atom-beautify
(see here). Than you can use $ apm publish patch|minor|major
to release a new version and increase the version number. You don't need to edit the package.json
manually.
But there was a small problem with the version number, because I tried to publish my package even before I had a valid Atom account. (I thought the account was only needed to download Atom and not to publish packages. Yes, I made this package before I had access to Atom itself ;) ) Bummer. I think it was fixed by now.
from atom-beautify.
What's the status of this issue? This 58a375f may have resolved it. Let me know.
from atom-beautify.
#9 (comment) should be implemented IMHO.
from atom-beautify.
Can we close this? Or make clear what is TODO? 😄
from atom-beautify.
I see you're really active, implement the solution in my comment and let this be done then :)
from atom-beautify.
I thought I already did? 58a375f
The options file was not working at all for me, so I fixed it a while back. It detects if the configuration file is either nested or simple (detection code was there before) and then merges in the correct respective configurations -- js
key for JavaScript
, html
for HTML
, etc.
Is this what UX you intended, @karolyi ?
from atom-beautify.
Update:
the configuration for each type (html/css/js) can be nested further.
I have a little change to make 😄.
I prefer your idea over what was there (that checked first level values if Objects):
My suggestion would be to check if the parsed json has "html", "js", or "css" keys, and then use the appropriate key.
Consider it done 👍.
from atom-beautify.
It's done, thx :)
from atom-beautify.
Related Issues (20)
- Javascript space before paren HOT 1
- Failed to activate the atom-beautify package HOT 3
- beautify HOT 1
- download failed HOT 1
- Cannot beautify Velocity file HOT 1
- Installed but not listed on packages tab HOT 1
- dart language not support HOT 1
- Could not find 'uncrustify'. The program may not be installed. HOT 1
- 0 I've been trying to install atom-beautify on my Windows 10 x64 machine, but I keep getting this error : npm ERR! code Z_BUF_ERROR npm ERR! errno -5 npm ERR! zlib: unexpected end of file npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\*****\.atom\.apm\_logs\2019-01-18T06_40_37_988Z-debug.log Googling about it, I found this is an issue that has been raised but closed without much in the way of resolution : https://github.com/Glavin001/atom-beautify/issues/2240 I tried uninstalling and reinstalling Atom, and also deleting the .apm folder and giving it another go, and then trying to install previous versions of atom-beautify using the following, apm install [email protected] apm install [email protected] But nothing seems to work, and I get the same error with a Deprecation warning on the latter. Has anyone else encounteredd this issue, are there any known work-arounds for it? HOT 1
- Atom-beautiful
- atom-beautify
- cant go futher of this HOT 1
- network is unreachable
- it was not installing HOT 1
- PHP beautify problem HOT 1
- How can I solve this problem ? HOT 2
- facing error HOT 2
- Not working :( HOT 1
- i
- Object.<anonymous> is deprecated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-beautify.