Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworking nufmt #7

Merged
merged 5 commits into from
May 30, 2023
Merged

Reworking nufmt #7

merged 5 commits into from
May 30, 2023

Conversation

AucaCoyan
Copy link
Contributor

Hi!

I still have to resolve some issues, and tests and other things, that's why this is still a draft

@fdncred
Copy link
Collaborator

fdncred commented May 23, 2023

Thanks. Looks good so far. Just ping me when you're ready for a review.

Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've started having a little look 😌

Note
files not reviewed at all

  • formatting.rs
  • lib.rs
  • main.rs

src/config.rs Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to help reviewing this file, is this a bad or a good file? 😏

Copy link
Contributor Author

@AucaCoyan AucaCoyan May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I committed it as is. The reality is that if you open with vs code the extension of nushell complains in a couple lines. I'm not sure what to do with it yet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm okok

we might want to have a closer look at it when we decide to use it 👍

@fdncred
Copy link
Collaborator

fdncred commented May 24, 2023

There's also a work-in-progress style guide here nushell/nushell.github.io#904

@AucaCoyan
Copy link
Contributor Author

Hello! I'm doing some progress. It is still quite messy, and with a lot of TODOs.
I managed to:

  • make a cli that accept (many) files and one config
  • read the file (in bytes)
  • parse if it's correct nu lang
  • match many tokens of the nu_parser::FlatShape (I have issues with some of them)
  • write out the file passed to the CLI prompt. (So it formats the file in place)

I still have to:

  • resolve every FlatShape enum pending
  • be able to pass a string into the CLI (and format it)
  • starting from a "whitespace-cleaned" file insert the whitespace according to the config (4 spaces, 100 max characters, configurable)

To resolve some specific questions, I will head for the nushell discord. Anyone is welcome to participate!

@amtoine
Copy link
Member

amtoine commented May 30, 2023

@AucaCoyan
is there at least an nufmt we can run?

if it's the case, i'd vote to land this and address the missing points in follow up PRs 😌

@AucaCoyan
Copy link
Contributor Author

is there at least an nufmt we can run?

if it's the case, i'd vote to land this and address the missing points in follow up PRs 😌

Yes!
You can clone the repo and run
cargo run -- folder\your-file.nu

or, if you want the trace log,
RUST_LOG="trace" cargo run -- folder\your-file.nu

@fdncred
Copy link
Collaborator

fdncred commented May 30, 2023

I'm fine with landing this as a step in the right direction, with a mind to keep iterating on it until we get it to where we want it to be.

@AucaCoyan
Copy link
Contributor Author

Ok! I will keep working, for sure!
I will mark this PR to review and submit issues to point the places to improve / fix

@AucaCoyan AucaCoyan marked this pull request as ready for review May 30, 2023 19:40
@fdncred
Copy link
Collaborator

fdncred commented May 30, 2023

nice initial work!

@fdncred fdncred merged commit 09046a4 into nushell:main May 30, 2023
@AucaCoyan AucaCoyan mentioned this pull request May 31, 2023
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants