nufmt icon indicating copy to clipboard operation
nufmt copied to clipboard

`nufmt` roadmap

Open AucaCoyan opened this issue 2 years ago • 4 comments

We have the repo in the nushell org 🍾 . Now we need more structure to keep moving forward. As we work in issues and features, we can edit the list.

⚠️ restructure the project

Because of the new-nu-parser coming, and the issue with DeclIds we need to restructure a lot of the parser as it is today. I don't know how long this is going to be, but we have to have some patience. Let me investigate until I can plan what to do and when 📆

❗ TODO

  • ⚠ resolve all the FlatShapes in #13 (see above)
    • [x] #35
    • [ ] there are still some missing shapes
  • [ ] with the file formatted as (--minified), we need to add the indentation
  • [ ] make configurable with Config struct
  • [ ] limit the max characters to Config
  • [ ] and endings of ;, if they are relevant to nushell logic (delete them if they are unnecessary, like python)
  • [ ] option to write the files in place or output another file
  • [ ] Format reports are nice. Add them!
  • [ ] public the cargo package
  • [ ] add the nixpkg auto-publish workflow
  • [ ] Make it available as a GitHub Action
  • [ ] add some ignore comment (# nufmt ignore)

✅ Done:

  • [x] make clippy happy
    • #12
  • [x] accept to format a string, not just files.
    • #15
  • [x] clean /examples/ folder and move them into tests. Add benchmarks
    • #16
  • [x] adjust README.md
    • [x] add the supported nu version
    • [x] add badges
    • #16
  • [x] #17
    • [x] #18
  • [x] check if the last line is a new line and, if false, add one.
    • #28
  • [x] examine the input path: Is it a file? format it. Is it a directory? format the .nu files and skip the other files
    • #47

AucaCoyan avatar May 31 '23 22:05 AucaCoyan

Given the slow progress of nufmt, does it make sense to adopt topiary-nushell as nufmt for now? Once it's ready, this codebase could replace it down the line (similar to the plan for https://github.com/nushell/new-nu-parser), as using the real nu engine is undoubtedly more powerful.

See also https://github.com/blindFS/topiary-nushell/issues/37

ItsHarper avatar Nov 20 '25 22:11 ItsHarper

I recommend topiary-nushell frequently because it's so good right now. However, I'm not sure I'd adopt it as the official one because it does not use the nushell parser. It uses tree-sitter which nushell does not use. So, there's a chance these two parsers could/do diverge. I'm sure there are already things that are implemented in either parser that the other doesn't really support right now.

What we need is more contributors to nufmt.

fdncred avatar Nov 20 '25 22:11 fdncred

What we need is more contributors to nufmt.

Agreed, but new-nu-parser is of higher priority IMHO.

blindFS avatar Nov 21 '25 05:11 blindFS

Agreed, but new-nu-parser is of higher priority IMHO.

Ya, you're probably right since nushell's parser isn't lossless. All it takes is a dedicated few to finish it and start implementing it.

fdncred avatar Nov 21 '25 12:11 fdncred