Giter VIP home page Giter VIP logo

vscodebeautify's People

Contributors

admosity avatar hookyqr avatar igornovozhilov avatar keale2 avatar sensehack avatar stephen-ullom avatar tallyb avatar wabisabit avatar wormeyman avatar zilioti avatar zsohnvlocity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscodebeautify's Issues

Unable to beautify the js code in html files

Versions:
beautify - 0.4.1
vsCode - 1.5.2

Settings:

"beautify.onSave": true,
    "beautify.JSfiles": [
        "html",
        "js",
        "json",
        "jsbeautifyrc",
        "jshintrc"
    ]

Before Formatting:
image

After Formatting:
image

As you can see, the alignment/formatting of js code inside the html file is not working. Where as if its in a .js file, its working like charm.

function indent

15
the chekEmail function and checkPhone function in the same level, but have indent.
how can I do with it?

Unreadable content after beautify when using Vash (expressjs view engine)

Hi, thanks for your extension. it's really useful.

But there is a problem, I'm using Vash and I defined .vash extension to be an html file (because vscode doesn't support vash yet). also I using your extension as well.

In vash file when I try to beautify, the js blocks combines together. (I know it's not a real bug, but not really good for me), btw when I try to beautify the same content using jsbeautifier.org, the result is too better and more readable (of course the result is not perfect).

Is there any way to prevent combining vash blocks on beautify?

Example of vash (that I wish after beautify still I see this structure)

@html.extend('layout',function(model){
    @html.block('body',function(model){
        <h1>@model.title</h1>
        <p>@model.content</p>
    })
})

Result (using VSCodeBeautify)

@html.extend('layout',function(model){ @html.block('body',function(model){
<h1>@model.title</h1>
<p>@model.content</p>
}) })

Result (using jsbeautifier.org)

@html.extend('layout', function(model) {
    @html.block('body', function(model) { <
        h1 > @model.title < /h1> <
            p > @model.content < /p>
    })
})

For more complex structure the result will be really unreadable.

Using js formatting for typescript

I was testing js beautify on typescript files .
the results were pretty good.

in the pr #37 i solved the issue of manually selecting js for formatting every time.

without this ,it would always popup a selector menu to select from js , html & css.

No handler found for the command: 'HookyQR.beautify'

I am using beautify 0.0.3 with VSCode 0.10.3 and getting
"No handler found for the command: 'HookyQR.beautify'" warning whenever trying to run Beautify. Extention isn't working as well through it works if I used js-beautify through cmdline.

Duplication

When formatting code via context menu > 'Format Code', the last line of the file is being duplicated.

This was occurring in both html and js files.

Had to uninstall the extension so can't provide any examples

Beautify removes new lines between LESS rules

Hey there,

although I defined "newline_between_rules": true in my .jsbeautifyrc, the Beautify extension removes those new lines and thus would transform this

.state:hover {
    .btn-variant();

    &.state-lead {
        .btn-variant(warning);
    }

    &.state-proposed {
        .btn-variant(info);
    }
}

into this:

.state:hover {
    .btn-variant();
    &.state-lead {
        .btn-variant(warning);
    }
    &.state-proposed {
        .btn-variant(info);
    }
}

โ€ฆ which is not what I wanted, of course. Did I configure something wrong or is this a bug?

Here's my complete .jsbeautifyrc:

{
    "end_with_newline": true,
    "indent_level": 0,
    "indent_with_tabs": true,
    "max_preserve_newlines": 2,
    "preserve_newlines": true,
    "wrap_line_length": 0,
    "js": {
        "brace_style": "collapse",
        "break_chained_methods": false,
        "indent_with_tabs": true,
        "jslint_happy": false,
        "jslint_happy_align_switch_case": false,
        "space_after_anon_function": false,
        "space_before_conditional": true,
        "space_in_empty_paren": false,
        "space_in_paren": false
    },
    "html": {
        "brace_style": "collapse",
        "wrap_attributes_indent_size": 4,
        "unformatted": ["a", "sub", "sup", "b", "i", "u"]
    },
    "css": {
        "convert_quotes": "single",
        "newline_between_rules": true,
        "selector_separator_newline": true,
        "space_around_selector_separator": true
    }
}

Add Beautify on Save

I know VS Code does some beautification as text it entered into the editor but a beautify on save feature would be great for files that are opened but not changed. Can this be added to this extension or is it more suited as a feature in the main VSCode app? If it is something easy to add then it would be great to have it in your extension.

Global .jsbeautifyrc file?

I've had a look through the documentation and the issues here but I can't seem to find how to add a single global .jsbeautifyrc file for all projects. Is this possible? In particular I prefer no space between an anonymous function and its parentheses. Thank you

Typescript spaces with generic type

I don't know if this can be solved within the scope of this project, since it seems to be typescript specific. But whenever i place a use something like: let myArray :Array<string> = [] and i beatify it it changes to 'let myArray :Array < string > = []'

.jsbeautifyrc file not being used

I am trying to make VSCodeBeautify take my .jsbeautifyrc file into account inside a Node.JS project.
I cannot seem to find the right place.
I've tried putting it at the root of the folder opened in VSCode.
I've tried putting it inside the .vscode folder.
I've tried putting it at the same level as the package.json.
I've tried restarting VSCode couple times.

None of theses locations seems to do anything.

Here's my .jsbeautifyrc file

// Documentation: https://github.com/einars/js-beautify/
{
    "indent_size": 2,
    "indent_char": " ",
    "eol": "\n",
    "indent_level": 0,
    "indent_with_tabs": false,
    "preserve_newlines": true,
    "max_preserve_newlines": 10,
    "jslint_happy": false,
    "space_after_anon_function": false,
    "brace_style": "collapse",
    "keep_array_indentation": false,
    "keep_function_indentation": false,
    "space_before_conditional": true,
    "break_chained_methods": false,
    "eval_code": false,
    "unescape_strings": false,
    "wrap_line_length": 0,
    "wrap_attributes": "auto",
    "wrap_attributes_indent_size": 4,
    "end_with_newline": false
}

License

Can you add your license file to the project root directory

Keyboard shortcut.

Why I haven't any keyboard shortcut (Alt+Shift+F doesn't work) in my VSCode?

comments tag into a new line

Hi, when I use beautify in visual studio code on mac the comment tag goes into the line, I would like to have inline as the current code. Is possible to change it? Any ideas?

current:

</li><!-- /Dropdown -->

after beautify

</li>
<!-- /Dropdown -->

Use file spacing preferences by default

I prefer tabs with everything I edit, but Beautify converts these to spaces when I beautify my file. Most of the time I am editing loose files around my filesystem, so I can't create a .jsbeautifyrc.

Is there a way/can there be a feature to use the spacing preferences set up within VS Code?

image

Either this, or a way to have default preferences set up in settings.json?

Beautify deletes necessary spaces in escaped LESS that brings to compilation error

Dear developer,

Could you pleae try to beautify the following less file:

@sbtChatMessageDialogFooterHeight: 80px;
.sbtChatMessagePopupList {
    overflow: auto;
    height: ~"calc( 100% - @{sbtChatMessageDialogFooterHeight} )";
}

Once saved it removes very important space here:
height:~"calc(

that leads to LESS compiler error.

Could you please solve that?

I had to deactive your extension temporarily.

Looking forward to having it back

Thanks!

Petr.

[Feature request] Add support for C# code.

Basically, it's the same as JS, with some exceptions:

private const int SPIF_SENDWININICHANGE = 2; is beautifyied to

private
const int SPIF_SENDWININICHANGE = 2;

but should remain the same.

Same thing for @"Control Panel\Desktop" beautifyied as @ "Control Panel\Desktop"

There might be more, but I didn't found them.

code is broken and uglified onSave

Why does my code get uglified and broken on auto save?

This:

return ( 
    <div>
      <SearchBar />
    </div>
);

becomes this:

return ( <
    div >
    <
    SearchBar / >
    <
    /div>
  );
{
    "beautify.onSave": true
}

Am I missing something in the settings? Or does it not work with jsx?

Manually formatting with Shift + Opt + F works fine though...

Extra spaces are not applied same way as jsbeautifier.org

From previous editors I always got a space before and after > in css.

This works on http://jsbeautifier.org/ :

.main.row > .column.segment {
  width: 100 % ;
  flex: 1;
  overflow: auto;
  margin - bottom: 0!important;
}

but not with beautifier in vscode:

.main.row>.column .segment {
  width: 100%;
  flex: 1;
  overflow: auto;
  margin-bottom: 0 !important;
}

I tried with only the "indent_size": 2, and also all default settings from js-beautify git hub instruction.

Beautify on save isn't triggered with additional configured extensions

let refType = doc.languageId;

if (refType === 'javascript') refType = 'js';
if (['json', 'js', 'html', 'css'].indexOf(refType) === -1) return;

It looks like the above lines of code need to be altered to used the "beautify.HTMLfiles", "beautify.CSSfiles", "beautify.JSfiles" user settings. I have the following in my settings file but the saving the handlebars file does not run the beautifier:

"beautify.HTMLfiles": [
    "htm",
    "html",
    "hbs"
]

How does this work with SCSS files? Is .jsbeautifyrc ignored?

I'm trying to figure out why this extension seems to ignore my .jsbeautifyrc file settings for scss files. Right now, I have this:

{
    "end_with_newline": true,
    "indent_level": 0,
    "indent_with_tabs": true,
    "max_preserve_newlines": 2,
    "preserve_newlines": true,
    "wrap_line_length": 0,
    "newline_between_rules": true,
    "convert_quotes": "single",
    "js": {
        "brace_style": "collapse",
        "break_chained_methods": false,
        "indent_with_tabs": true,
        "jslint_happy": false,
        "jslint_happy_align_switch_case": false,
        "space_after_anon_function": false,
        "space_before_conditional": true,
        "space_in_empty_paren": false,
        "space_in_paren": false
    },
    "html": {
        "brace_style": "collapse",
        "wrap_attributes_indent_size": 4,
        "unformatted": ["a", "sub", "sup", "b", "i", "u"]
    },
    "css": {
        "convert_quotes": "single",
        "newline_between_rules": true,
        "selector_separator_newline": true,
        "space_around_selector_separator": true,
        "indent_size": 16
    }
}

So I have newline_between_rules set to true by default. But when I save my scss file, it removes all the new lines. Also it doesn't convert my quotes to single quotes. I have the .jsbeautifyrc file in the same directory as my .scss file. What am I doing wrong?

Also, this extension seems to be Beautifying my .scss files on save even if I remove them from the array:

"beautify.CSSfiles": [
    "css"
],

Also I tried this:

"beautify.onSaveIgnore": [
        //don't beautify any file in any 'minified' directory, at any depth:
        "**/minified/**",
        //don't minify any file that contains '.min.', '_min.', '-min.' in the filename (This is the default ignore setting):
        "**/*+(.|_|-)min.*",
        "scss"
    ]

And my SCSS files are STILL being Beautified on save.

Can anyone give me some insight here? Am I hitting some bugs or just completely misunderstanding how this thing works?

Support for custom onSave values

I tried adding the .vue extension to beautify.onSave but this warns me that this isnt an acceptable value and it won't auto beautify vue files on save. Manually running beautify does work.

beautify.onSave saving loop

When in set
"beautify.onSave": true

on save vscode starts to constantly save and change the file repedeatly times. Only way to stop it, is to switch to another file.
This is really annoying since the file is constantly marked as saved/nonsaved and also clears the undo history.

No support for SASS/SCSS

Hi,

Seems like your extension doesn't support SASS/SCSS files, right, or I missed something?

I'm using latest version of VSCode & VSCodeBeautify

Thanks !

.vscode folder

It would be good if I could place the .jsbeautifyrc-file in the .vscode-folder together with other extension files. The root would be cleaner.

However I'm not sure if .vscode is a standard folder but "Spelling and Grammar Checking" by Sean McBreen is using that path.

Can't identify xml file even if defined in .jsbeautifyrc file

If I have this section in my .jsbeautifyrc file:

    "html": {
        "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"]
         }

I still get prompted every time I try to format an xml file:

Couldn't determine type to beautify, please choose.

Mulitline fomating in import statement

Hello,
I wirte example before and after code formating:
before:
import { Mongo } from 'meteor/mongo;
after:

import { 
  Mongo
} from 'meteor/mongo;

This problem occurred also available for atom verssion.

Best Regards,
Paul

JS - commented out code is indented one extra time

I've run into a small issue with this extension regarding commented-out code. Say I have a block of code like this:

const a
const b
// const c
const d
const e

Upon running Beautify, it is formatted to look like this:

const a
const b
  // const c
const d
const e

I don't want the commented code to be indented, I want it to remain in line with the code surrounding it. Is there any way to prevent this behavior?

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.