Add tuareg interface mode#327
Open
PizieDust wants to merge 4 commits into
Open
Conversation
|
@monnier do you possibly have any time to look at this? If not, if you are able to grant commit rights, perhaps you could give them to me so I can review and merge it? Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This PR introduces a new major-mode for
.mliand.eliomifiles as an opt-in featureThe necessity for this change comes from working on adding support for OCaml navigation in Combobulate.
Background
Tuareg uses one major-mode for
.mliand.mlfiles, of which both file types have a separate tree-sitter grammar.In Combobulate, we define two combobulate languages:
ocamlandocaml-interface, to handle both file types.However, since with Tuareg we have a single major-mode for both file types, this led to an issue where when we activate Combobulate, the wrong parser is created in the buffer, as both parsers are able to attach to
tuareg-mode. Introducing a newtuareg-interface-modemeans we can disambiguate the Combobulate languages based on what the major mode is.Method
By taking advantage of Emacs' standard
define-derived-modemacro, we have definedtuareg-interface-modeas a child mode oftuareg-mode. Because of how Emacs constructs derived modes:tuareg-interface-modewill automatically inherit all parent behaviors (indentation engine, syntax tables, highlighting configurations, font-locks, and the keymaptuareg-mode-map).tuareg-mode-hookwhen loaded, meaning any existing third-party packages or user configurations (like LSP, Merlin, etc.) hooked intotuareg-mode-hookwill continue working seamlessly for.mlifiles.major-modevalue of'tuareg-interface-modeand runstuareg-interface-mode-hook.Usage
In your emacs config:
(tuareg-use-interface-mode t)