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

Topiary integration as nickel format #1371

Merged
merged 6 commits into from
Jul 13, 2023
Merged

Topiary integration as nickel format #1371

merged 6 commits into from
Jul 13, 2023

Conversation

vkleen
Copy link
Contributor

@vkleen vkleen commented Jun 16, 2023

Add a nickel format subcommand to the CLI, gated behind the format feature flag. The nix flake outputs nickel and nickel-static enable format by default.

The nickel format subcommand is a thin wrapper around Topiary and embeds the required tree-sitter queries for Nickel formatting.

Status:

  • Formatting with Topiary
  • Don't vendor the tree-sitter query file, depends on upstream Topiary support
  • Static executables

@github-actions github-actions bot temporarily deployed to pull request June 16, 2023 14:01 Inactive
Base automatically changed from separate-cli-crate to master June 16, 2023 17:09
@github-actions github-actions bot temporarily deployed to pull request June 20, 2023 08:09 Inactive
@github-actions github-actions bot temporarily deployed to pull request June 20, 2023 08:43 Inactive
Improve error reporting for `nickel format`

nix build with topiary

Use upstream topiary query export
@github-actions github-actions bot temporarily deployed to pull request July 12, 2023 08:39 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 12, 2023 13:00 Inactive
@vkleen
Copy link
Contributor Author

vkleen commented Jul 12, 2023

I'm marking this as ready for review, even though static linking isn't quit figured out yet. The formatting subcommand is gated behind a feature flag and currently disabled for the static build. We can enable the feature flag for the static build once we figure out how to get it to work.

@vkleen vkleen marked this pull request as ready for review July 12, 2023 15:25
@github-actions github-actions bot temporarily deployed to pull request July 12, 2023 15:28 Inactive
Copy link
Member

@yannham yannham left a comment

Choose a reason for hiding this comment

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

The structure of the CLI looks better like this 👍 I'm requesting changes to not forget to disable the format feature for now, until we figure out the static build story.

cli/Cargo.toml Outdated Show resolved Hide resolved
flake.nix Outdated
nickel-lang-cli = buildPackage { pname = "nickel-lang-cli"; };
nickel-lang-cli = buildPackage {
pname = "nickel-lang-cli";
extraBuildArgs = "--features format";
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want to disable it by default for this PR, until we figure out the static binary build story?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can keep it enabled for the normal CLI build, and just disable it for the static binary. That way at least nix run github:tweag/nickel gets the formatting feature.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, what I understood as "principle of least surprise" from the last planning meeting was that the binary built/run from nix with the default command and the one provided as a static binary shouldn't differ, as you should expect as a user. I would vote for disabling everywhere for now, but just merge it, so that this PR doesn't drift away from the master branch.

Copy link
Member

Choose a reason for hiding this comment

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

It's what I meant. But I don't think you need to choose how you're going to handle it before you release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, I've disabled the format feature for the nix build 👍

@github-actions github-actions bot temporarily deployed to pull request July 12, 2023 16:32 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 12, 2023 16:39 Inactive
@github-actions github-actions bot temporarily deployed to pull request July 13, 2023 10:16 Inactive
@vkleen vkleen enabled auto-merge July 13, 2023 10:30
@vkleen vkleen added this pull request to the merge queue Jul 13, 2023
Merged via the queue into master with commit 997e344 Jul 13, 2023
@vkleen vkleen deleted the topiary-integration branch July 13, 2023 11:28
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.

3 participants