Comments (5)
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.
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.
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.
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.
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)
- Wrong indentation in shell-mode HOT 4
- 1/253 relevant lines HOT 5
- dtrt-indent-try-set-offset doesn't set generic indent variables HOT 1
- check adjacent-files like vim-sleuth HOT 2
- Advice is active regardless of whether the mode is active HOT 5
- Overriding tab setting for hard tabbed file HOT 11
- do nothing when editor-config is activated HOT 4
- Issue with protobuf-mode HOT 3
- Delay for running dtrt-indent HOT 5
- Adapting tab mode to file content not working HOT 7
- Add guess-style to related work section of readme
- Support for different js-mode offset variables HOT 5
- How to install this? HOT 3
- Feature request: Infer additional variable in web-mode
- web-mode support doesn't work well for heterogeneous indent types HOT 4
- Improve analysis of files with consistent indentation where offset is guessed wrongly due to merging HOT 2
- Error while processing typescript files HOT 3
- Guess indentation for new files in a project HOT 3
- Support `typescript-ts-base-mode` and thus `tsx-ts-mode`? HOT 1
- Compilation warnings under Emacs 29.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dtrt-indent.