Comments (7)
good point. Do you have any idea to find out the size of the tabs that the user used?
from nixpkgs-fmt.
I don't think we can know how the user has configured tab size by only parsing the file. To that point using spaces might be easier to handle programatically.
We could detect a mix and emit a warning. I'm reminded of eslint's rule.
from nixpkgs-fmt.
Yeah, we currently don't handle tabs at all, and just hard-code two-spaces indentation. I don't know what's the right solution here. The common wisdom is "use spaces", so we can just force-convert tabs to spaces. However, I've recently heard compelling argument to use tabs: it helps accessibility, because people with poor eyesight often want to configure tab size to unusual values.
from nixpkgs-fmt.
However, I've recently heard compelling argument to use tabs: it helps accessibility, because people with poor eyesight often want to configure tab size to unusual values.
That is a great point. If nix expressions does not mandate an indentation style I think we should consider using tabs chiefly to support accessibility.
from nixpkgs-fmt.
Then we would still have the same problem but in reverse :)
The nix code in nixpkgs is formatted with 2 spaces and that acts as our canonical representation of code.
from nixpkgs-fmt.
Then we would still have the same problem but in reverse :)
True! Being idealistic I think we would need to establish a specification for the nix expression language. I quickly scanned the manual but did not find anything about indentation style being mandated.
But the interim would be to come up with a temporary solution. So perhaps forcing the conversion for now.
from nixpkgs-fmt.
The current coding convention for nixpkgs is encoded over here: https://nixos.org/nixpkgs/manual/#sec-syntax
The goal of nixpkgs-fmt is to be adopted as a tool to format nixpkgs. Until that happens the format should stay largely the same as what is being used in nixpkgs.
from nixpkgs-fmt.
Related Issues (20)
- Wrong indentation on multi line if/then/else expression HOT 4
- Full line comment wrongfully converted to same line comment
- Stop enforcing a space in empty containers? HOT 7
- "#dontformat" directive HOT 4
- sample: list of floats formatted surpised me HOT 3
- improve CLI ergonomics when parsing errors occur when using parse flag HOT 1
- [Security] Make formatted expression free from CVE-2021-42574 (Trojan Source) HOT 5
- Misaligned lists of attribute sets HOT 1
- sample: List after in has no indentation
- Second comment line is indented after let … in
- Multi-line strings in let/in-expressions are wrongly indented
- Add a binary to Releases
- Re-release for security updates HOT 2
- Wrong indention for attr set as parameter
- Space removed before comments in multi-line inherit expressions HOT 1
- Add option to choose indention style HOT 2
- Confusing attset merging
- Shell completions HOT 1
- Pre-Commit fails sporadically with `failed to compile nixpkgs-fmt`
- sample: 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 nixpkgs-fmt.