Comments (15)
Hi, this should be changed now. It was loading the tab/space settings on startup but wasn't getting new settings if they were changed.
from brackets-beautify.
Still seems a bit odd. I assume when I have tab size 4 it should use one
tab (with a size of 4), but it is putting in 4 tabs.
from brackets-beautify.
Tab size 4 is 4 tabs. Unless you think it should work the other way?
from brackets-beautify.
To answer your question to @GarthDB, in Brackets if your setting is for Tabs, then 1 tab is always used to indent. The "4" means that tabs stops are 4 spaces (so editor knows how to display a Tab char). So, if you want to use Tabs and indent 8 spaces, you don't have to insert 2 Tabs, just change the tab stop to be 8.
from brackets-beautify.
@redmunds Thanks! Good explanation.
from brackets-beautify.
I notice another bug. The indent size for spaces/tabs is crossed. I have to change the Tabs size to update the number of Spaces indented :)
Cool Extension! I'm planning to show it at the Brackets Sprint 18 Review meeting today. I'll fix these bugs first :)
from brackets-beautify.
Cool. I wonder why that is the case? I noticed it too, but if you look at the code, I'm pulling the settings for the editor(or at least I think I am)
var _useTabs = Editor.getUseTabChar();
var _indent_size = Editor.getTabSize();
var _indent_unit = Editor.getIndentUnit();
if (_useTabs) {
var _indent_char = '\t';
var indent = _indent_size;
} else {
var _indent_char = ' ';
var indent = _indent_unit;
}
Cool, if you want to provide the necessary changes that would be great. I really just wanted to show people what I was using. I have to have a formatter to code. :)
from brackets-beautify.
First, you don't need getTabSize() because it's only used by the editor. Also, the indent
intermediate variable seems to be unnecessary and confusing, so I removed it. Try this:
var _useTabs = Editor.getUseTabChar();
var _indent_size;
var _indent_char;
if (_useTabs) {
_indent_char = '\t';
_indent_size = 1;
} else {
_indent_char = ' ';
_indent_size = Editor.getIndentUnit();
}
You'll need to replace indent
with _indent_size
in a few places.
Also, there are a few JSLint errors that you should fix, so turn it on using: View > JSLint.
Let me know if you have any questions.
from brackets-beautify.
gotcha, awesome.
On Mon, Dec 17, 2012 at 11:29 AM, drewhjava [email protected]:
Hi, this should be changed now. It was loading the tab/space settings on
startup but wasn't getting the changed settings.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-11457219.
from brackets-beautify.
@redmunds thanks for your help! I actually used Textmate to develop this and I usually use JSHint. I went ahead and pushed your changes and fixed the errors.
I was thinking about adding a preference panel possibly. Not sure if that would make sense, since change the settings is pretty easy.
from brackets-beautify.
Excellent. Thank you for contributing to Brackets.
I don't think you need a preferences panel for Brackets. You can update the preferences for tab vs spaces, and number of space right in the Brackets status bar and your extension picks up the new settings on the next execution!
from brackets-beautify.
@redmunds I was thinking more for the JSbeautify settings. I just put in the ones I use.
This is a list of the settings.
opt_preserve_newlines
opt_break_chained_methods
opt_max_preserve_newlines
opt_jslint_happy //this is function () instead of function() without the space
opt_keep_array_indentation
opt_space_before_conditional
opt_unescape_strings
Probably just makes sense to let the user edit the file, or have a separate json file with the settings.
from brackets-beautify.
Ah. Sounds cool.
What do you think about changing the shortcut? Ctrl-Shift-F is already used in Brackets for one of my most used features which is Find in Files.
I would love the ability to also be able to "uglify" (or minify) my code. Seems like beautify and uglify should be in the same extension.
from brackets-beautify.
Changing the shortcut sounds good. I used that command because it seems the most common for formatting. Cmd + Shift + L is another one I've seen.
What do you think about this?
I could add minification via uglifyjs. Good idea.
I'll go ahead and throw in selected text beautification/minification too.
from brackets-beautify.
I put a page on the Brackets wiki to list all shortcuts being used by Brackets and Extensions:
https://github.com/adobe/brackets/wiki/Brackets-Shortcuts
Cmd-Shift-L seems to be available. Be sure to update that page with your shortcut.
from brackets-beautify.
Related Issues (20)
- Mapping Nunjucks (njk) to HTML HOT 1
- Extra space added at the end of the tag HOT 3
- brackets-beautify inserts a space in import(...) HOT 1
- not beautifying certain tags in html HOT 2
- SVG file seems to be ignored HOT 1
- Annoying space char HOT 1
- Error SAVE BEAUTIFY in ASP HOT 5
- Beautifier is breaking css urls HOT 2
- Move brackets-beautify to beautifier github org HOT 1
- HTML inside JS in an HTML document break when formatted during Live Preview HOT 8
- Beautify inserts space before exclamation mark in comment <!-- in <style> HOT 2
- Brackets Beautify scrambles IIFE style JS code HOT 2
- php variable inside a js script is being formatted HOT 4
- Can't beautify php HOT 3
- Feature request: python formatting HOT 1
- Preserve Tab Spacing inside tags HOT 1
- JSX support HOT 7
- Extra space added in nullish coalescing operator (??) for javascript HOT 8
- No line break on beautify for XML element if tag name is 'code' HOT 1
- How to download the extension as a zip
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 brackets-beautify.