Code Monkey home page Code Monkey logo

Comments (7)

zimbatm avatar zimbatm commented on June 1, 2024

good point. Do you have any idea to find out the size of the tabs that the user used?

from nixpkgs-fmt.

 avatar commented on June 1, 2024

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.

matklad avatar matklad commented on June 1, 2024

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.

 avatar commented on June 1, 2024

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.

zimbatm avatar zimbatm commented on June 1, 2024

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.

 avatar commented on June 1, 2024

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.

zimbatm avatar zimbatm commented on June 1, 2024

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)

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.