Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript formatting changed with version 2014.10.02.07.33.10 #162

Closed
harlyq opened this issue Oct 2, 2014 · 3 comments
Closed

Typescript formatting changed with version 2014.10.02.07.33.10 #162

harlyq opened this issue Oct 2, 2014 · 3 comments

Comments

@harlyq
Copy link

harlyq commented Oct 2, 2014

With version 2014.10.02.07.33.10, typescript appears as (formatting settings listed below):

class Test {
    blah: string[];

    foo(): number {
        return 0;
    }

        bar(): number {  // <-- why is this indented?
        return 0;
    }
}

With the previous version the same code would appear as:

class Test {
    blah: string[];

    foo(): number {
        return 0;
    }

    bar(): number {
        return 0;
    }
}

Seems to be related to the presence of the : character, removing some of the type information will fix the formatting. Is there a different configuration that will work with typescript?

options:
{
  // Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
  // Documentation: https://github.com/einars/js-beautify/
  "html": {
    "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
    "brace_style": "collapse", // "expand", "end-expand", "expand-strict"
    "indent_char": " ",
    "indent_handlebars": false, // e.g. {{#foo}}, {{/foo}}
    "indent_inner_html": false,
    "indent_scripts": "keep", // "separate", "normal"
    "indent_size": 4,
    "max_preserve_newlines": 10,
    "preserve_newlines": true,
    "unformatted": ["a", "sub", "sup", "b", "i", "u", "pre"],
    "wrap_line_length": 0
  },
  "css": {
    "allowed_file_extensions": ["css", "scss", "sass", "less"],
    "end_with_newline": false,
    "indent_char": " ",
    "indent_size": 4,
    "selector_separator": " ",
    "selector_separator_newline": false
  },
  "js": {
    "allowed_file_extensions": ["js", "json", "jshintrc", "ts"],
    "brace_style": "collapse", // "expand", "end-expand", "expand-strict"
    "break_chained_methods": false,
    "e4x": false,
    "eval_code": false,
    "indent_char": " ",
    "indent_level": 0,
    "indent_size": 4,
    "indent_with_tabs": false,
    "jslint_happy": false,
    "keep_array_indentation": false,
    "keep_function_indentation": false,
    "max_preserve_newlines": 10,
    "preserve_newlines": true,
    "space_before_conditional": true,
    "space_in_paren": false,
    "unescape_strings": false,
    "wrap_line_length": 0
  }
}
@harlyq harlyq changed the title Typescript formatting incorrect with version 2014.10.02.07.33.10 Typescript formatting changed with version 2014.10.02.07.33.10 Oct 2, 2014
@victorporof
Copy link
Owner

Looks like something regressed in https://github.com/beautify-web/js-beautify Please file a bug there.

@harlyq
Copy link
Author

harlyq commented Oct 3, 2014

Created beautifier/js-beautify#552

@harlyq
Copy link
Author

harlyq commented Oct 4, 2014

fix will appear in js-beautify 1.5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants