Skip to content

Warn about old dune grammars and fix dune completion - #117

Merged
bbatsov merged 2 commits into
mainfrom
dune-followups
Nov 3, 2026
Merged

bbatsov merged 2 commits into
mainfrom
dune-followups

Conversation

@bbatsov

@bbatsov bbatsov commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Follow-ups to #93. With a dune grammar from before 0.1.0 most of the highlighting fails (Emacs 31 turns it off and suggests downgrading the grammar, 29 and 30 error while fontifying), so neocaml-dune now says once to reinstall it. Completion still goes by paren depth rather than the parse tree, since it runs on half-typed input, and the fields of fields like foreign_stubs have no tables yet, so they get nothing rather than the wrong names.

Fixes #92

Grammars installed from tree-sitter-dune's master before 0.1.0 don't
wrap fields in stanza_field nodes, which the font-lock rules name. Emacs
31 then turns most of the highlighting off with a warning that suggests
downgrading the grammar, and Emacs 29 and 30 signal errors while
fontifying. So neocaml-dune now says, once a session, to reinstall the
grammar, as neocaml-mode does for outdated OCaml grammars.
Field names were offered at the head of any list inside a stanza, so
the values of fields got them too, e.g. the tags of a package. Now
they're only offered where a field goes: right inside a stanza (also
one in a subdir), or inside a profile of an env stanza, right inside
which the profile names are offered instead. Fields don't get offered
inside other fields, as there are no tables of those yet.

dune-project's package stanza gets its own fields, which stay out of
the fallback for the stanzas the tables don't know. Inside an action
field, and inside the actions that take actions, the action names are
offered. Atoms can have # and ? in them now, for copy# and diff?.
@bbatsov
bbatsov merged commit 3261e64 into main Nov 3, 2026
4 checks passed
@bbatsov
bbatsov deleted the dune-followups branch November 3, 2026 10:00
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.

dune completion offers field names inside field values

1 participant