helix icon indicating copy to clipboard operation
helix copied to clipboard

comment-tokens in languages.toml clashes with comment-token (singular) in default languages.toml

Open sdoerner opened this issue 5 months ago • 0 comments

Using SQL as an example, but this applies more generally.

Some SQL comments start with "#" (e.g. Mysql I think). So I tried to modify my languages.toml:

[[language]]
name = "sql"
comment-tokens = ["#", "--"]

Result:

Failed to parse language config: duplicate field `comment-tokens`
in `language`

The default sql language definition includes

comment-token = "--"

Possible solutions I looked at:

  • I couldn't find a way to un-define comment-token in the user languages.toml. (maybe there is one?)
  • Relevant code is roughly here. Seems this is using serde aliases. But at this point, I think the configs are already merged. Probably this needs to be handled earlier to remove the default config option if either of the two versions is present in the user config.
  • Arguably the default languages.toml could be updated to list both tokens for SQL. This would fix the issue for SQL but doesn't solve the customization problem more generally.

sdoerner avatar Sep 09 '24 14:09 sdoerner