Giter Site home page Giter Site logo

Comments (5)

rrthomas avatar rrthomas commented on July 28, 2024

The logic is working as intended. You can set dtrt-indent-max-merge-deviation to, in this case, 9.00. If you'd like to suggest an improvement to the logic, please do!

from dtrt-indent.

aaronjensen avatar aaronjensen commented on July 28, 2024

It doesn't take into account the indentation rules of a file? It seems like things after "rules": { have 2 * indent-size.

from dtrt-indent.

rrthomas avatar rrthomas commented on July 28, 2024

Sorry, I don't understand what you mean by "indentation rules". Maybe read the docstring of dtrt-indent-max-merge-deviation, if you haven't already?

from dtrt-indent.

aaronjensen avatar aaronjensen commented on July 28, 2024

I was (incorrectly, it seems) assuming that dtrt-indent took into account how files are meant to be indented rather than just counting whitespace and guessing.

In other words, it could look at a json file like:

{
  foo: {
    bar: 3
  }
}

and know, that because indentation typically happens after a line ends w/ {, that the indentation setting must be 2. I'm sure that that would be a rather tricky and probably hard thing to implement, so I totally get why it works the way it does.

I set dtrt-indent-max-merge-deviation to 9.0 and I'll see how it goes. I really only ever have problems w/ eslint/tslint json rule files because of their particular shape. Thanks much for the help.

from dtrt-indent.

rrthomas avatar rrthomas commented on July 28, 2024

Yes, dtrt-indent is dumb; on the other hand, it's already quite complicated, and trying to infer how files are "meant to be" indented is probably a mug's game. If you have files that have explicit information on how they're supposed to be indented, that's fine, don't use dtrt-indent on them, and enforce their indentation (as fmt or go fmt do). dtrt-indent is meant for use when this information isn't available.

Closing.

from dtrt-indent.

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.