Closed aantron closed 1 year ago
Is it possible to support such extensions?
I don't see any problem technically. The existing warning should be changed to "extension should not start with a dot".
Another use case is for cppo as it would allow defining .cppo.ml
as an extension for a cppo dialect (in the case where the preprocessing command only depends on static info like the ocaml version number).
Another use case is for cppo as it would allow defining
.cppo.ml
as an extension for a cppo dialect (in the case where the preprocessing command only depends on static info like the ocaml version number).
Thinking a bit more about this, there is a choice to make because today Dune decides what is the dialect of a file just by looking at its extension (ie the stuff after the last dot), so .cppo.ml
is interepreted as being an OCaml file (not a dialect). If we want to do what is suggested here, we will have to change this logic a bit. Perhaps it is enough to to look at everything that comes after the first dot (instead of the last one), but it will be a breaking change.
Another use case is for cppo as it would allow defining
.cppo.ml
as an extension for a cppo dialect (in the case where the preprocessing command only depends on static info like the ocaml version number).Thinking a bit more about this, there is a choice to make because today Dune decides what is the dialect of a file just by looking at its extension (ie the stuff after the last dot), so
.cppo.ml
is interepreted as being an OCaml file (not a dialect). If we want to do what is suggested here, we will have to change this logic a bit. Perhaps it is enough to to look at everything that comes after the first dot (instead of the last one), but it will be a breaking change.
Actually I was a bit confused; I think everything should work without too much trouble, see #7782
Desired Behavior
Dream currently recommends
.eml.ml
files, to take advantage of partial syntax highlighting of their ML parts. This is currently not possible with(dialect)
:results in
Is it possible to support such extensions?
Example
See https://github.com/aantron/dream/pull/228#issuecomment-1557242558.