GithubHelp home page GithubHelp logo

Comments (5)

Glavin001 avatar Glavin001 commented on September 18, 2024

Just got it working:

image

In the example above, it is for HTML.

from atom-beautify.

Glavin001 avatar Glavin001 commented on September 18, 2024

Removed https://github.com/donaldpipowitch/atom-beautify/blob/45352dd90591826e72054536f671b9eb074a9843/lib/atom-beautify.js#L154-L156 because it was incorrectly merging all of the options together.

for (key in externalOptions) {
      _.merge(collectedConfig, externalOptions[key]);
}

Important: This will result in previous usage of nested configurations no longer merging, such as using the indent_size of js when applying to a HTML file.

from atom-beautify.

Glavin001 avatar Glavin001 commented on September 18, 2024

I just noticed that the indent_char is being overridden to "" (empty string).

image

You can even see it in the screenshot in previous comments, final options versus the getOptions result in the console log.


The afflicting code is the cleanOptions:

function cleanOptions(data, types) {
  nopt.clean(data, types);
  return data;
}

Which really just calls https://github.com/npm/nopt

from atom-beautify.

Glavin001 avatar Glavin001 commented on September 18, 2024

I am going to temporarily comment out the lines that use nopt, as it is definitely the issue.

Currently working on Handlebars support (see #13) and commenting it out makes everything work:

Before:

{{#if}}
{{#each}}
{{#if}}
content
{{/if}}
{{#if}}
content
{{/if}}
{{/each}}
{{/if}}

After (with nopt disabled):

{{#if}}
  {{#each}}
    {{#if}}
      content
    {{/if}}
    {{#if}}
      content
    {{/if}}
  {{/each}}
{{/if}}

from atom-beautify.

Glavin001 avatar Glavin001 commented on September 18, 2024

See npm/nopt#38 (comment)

I have an object like the following:

{
  'indent_char': ' '
}

Where indent_char is a space character (' ').
After using nopt to clean, it is now an empty string, ''.
The same error occurs when using tab, '\t'.
Using underscore, '_', works as expected.

from atom-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.