Coder Social home page Coder Social logo

Comments (15)

drewhamlett avatar drewhamlett commented on June 11, 2024 1

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.

GarthDB avatar GarthDB commented on June 11, 2024

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.

drewhamlett avatar drewhamlett commented on June 11, 2024

Tab size 4 is 4 tabs. Unless you think it should work the other way?

from brackets-beautify.

redmunds avatar redmunds commented on June 11, 2024

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.

drewhamlett avatar drewhamlett commented on June 11, 2024

@redmunds Thanks! Good explanation.

from brackets-beautify.

redmunds avatar redmunds commented on June 11, 2024

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.

drewhamlett avatar drewhamlett commented on June 11, 2024

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.

redmunds avatar redmunds commented on June 11, 2024

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.

GarthDB avatar GarthDB commented on June 11, 2024

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.

drewhamlett avatar drewhamlett commented on June 11, 2024

@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.

redmunds avatar redmunds commented on June 11, 2024

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.

drewhamlett avatar drewhamlett commented on June 11, 2024

@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.

redmunds avatar redmunds commented on June 11, 2024

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.

drewhamlett avatar drewhamlett commented on June 11, 2024

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.

redmunds avatar redmunds commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.