Skip to content

Conversation

@mkatychev
Copy link
Member

@mkatychev mkatychev commented Nov 10, 2025

Set built-in language configs with a priority of "default"

Resolves #1124

Description

New built-in config behaviour caused merge priority collisions with existing configs.

This PR sets the merge priority of the built-in configuration to default for all languages

Checklist

Checklist before merging, wherever relevant:

  • CHANGELOG.md updated
  • Documentation (The Topiary Book, README.md, etc.) up-to-date
  • Updated regression tests

@Niols
Copy link
Contributor

Niols commented Nov 10, 2025

Tested commit d8c9abc and it does seem to fix #1124 for me.

@mkatychev
Copy link
Member Author

@tweag/topiary-core-team we'll need to cut a release for this fix so that 0.7.x is again forwards compatible

@Niols
Copy link
Contributor

Niols commented Nov 15, 2025

Is there anything that's needed to make this PR land on main? Can I help in any way?

@mkatychev
Copy link
Member Author

Hi @Niols I was on vacation so the release was a bit delayed. I should have it out for review tomorrow.

@Niols
Copy link
Contributor

Niols commented Nov 15, 2025

Oh. Sorry, I didn't want to put pressure on your vacation or anything! I was just curious why the PR wasn't on main (I rely on the flake myself).

@yannham
Copy link
Contributor

yannham commented Nov 15, 2025

This has the effect of making all of languages overridden whenever one defines just another language. That is, if the configuration is merged with a custom configuration of the form languages.mybar = {..}, all prebuilt languages will be wiped out, and only mybar will remain. Is that the expected behavior?

@mkatychev
Copy link
Member Author

This has the effect of making all of languages overridden whenever one defines just another language. That is, if the configuration is merged with a custom configuration of the form languages.mybar = {..}, all prebuilt languages will be wiped out, and only mybar will remain. Is that the expected behavior?

@yannham I'm assuming the built-in values should have the lowest merge priority individually, to your point though we should have every language field have its own default value.

Nice catch!

@mkatychev mkatychev changed the title fix(config): set built-in config with a priority of "default" fix(config): Set built-in language configs with a priority of "default" Nov 15, 2025
@mkatychev
Copy link
Member Author

@yannham Thanks again for the per language default observation, I confirmed that the approach does indeed behave as desired.

@mkatychev mkatychev marked this pull request as ready for review November 15, 2025 22:38
Copy link
Member

@Xophmeister Xophmeister left a comment

Choose a reason for hiding this comment

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

Looks good; thanks @mkatychev 🙏

I've set the release date, in the CHANGELOG for tomorrow. I can sort that out 👍

@mkatychev mkatychev merged commit 37993f0 into tweag:main Nov 18, 2025
11 checks passed
@toastal
Copy link
Contributor

toastal commented Nov 25, 2025

I now get

$ topiary format -M -C .topiary.ncl lib/name.ml
[2025-11-25T17:31:57Z ERROR topiary::error] Nickel error: Other(
        "missing field `extensions`",
    )

when trying my usual configuration

{
	languages = {
		bash.indent | priority 1 = "	",
		css.indent | priority 1 = "	",
		json.indent | priority 1 = "	",
		nickel.indent | priority 1 = "	",
		ocaml.indent | priority 1 = "	",
		ocaml_interface.indent | priority 1 = "	",
		ocamllex.indent | priority 1 = "	",
		rust.indent | priority 1 = "	",
		toml.indent | priority 1 = "	",
	},
}

@toastal
Copy link
Contributor

toastal commented Nov 25, 2025

Reverting nixpkgs to 1r3cbzi0zgfcw1mjl8piss4xbhwmwpd3l22pjjc0hlvrpsrs73f8, the commit before 0.7.1 was merged, works. Am I missing something about how this is now set up? This doesn’t seem like a minor change.

@mkatychev
Copy link
Member Author

Hmm oh boy, looks like the fix broker the other things. @toastal the config above reproduces the issue I take it?

@toastal
Copy link
Contributor

toastal commented Nov 26, 2025

@mkatychev … yeah, my Nickel is a bit rusty at this point, but maybe something isn’t squaring right for me

@mkatychev
Copy link
Member Author

Thanks for bringing this up, I'll look into it first thing tomorrow

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.

Breaking change in configuration some time ago -- grammar.source.path stopped being supported

5 participants