-
Notifications
You must be signed in to change notification settings - Fork 112
feat: defines a tree-sitter based Motoko mode for Emacs #5043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains 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
I have |
ggreif
approved these changes
Apr 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubber-stamping! I see a surprisingly small amount of code, but I'm happy to test it. (Looks like the grammar repo has the meat.)
e61ee69
to
41225a4
Compare
@Mergifyio refresh |
✅ Pull request refreshed |
Good stuff! |
@Mergifyio refresh |
✅ Pull request refreshed |
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.
Motivation
The existing
motoko-model.el
in this repo is based onswift-mode
, which is a bit sad.With Emacs 29+ we finally got built-in tree-sitter support, so now it's relatively easy to get nice syntax highlighting and auto-indentation behaviour. Most of the actual work was done by this grammar author: https://github.com/polychromatist/tree-sitter-motoko
This is pretty bare-bones, but I intend on adding a few rules here or there as I spot things that don't highlight or indent nicely.
Setup
Add this line to your config:
and run
treesit-install-language-grammar
, passmotoko
as the grammar name and https://github.com/christoph-dfinity/tree-sitter-motoko as the grammar repo. The remaining prompts can stay as defaults.Afterwards opening
.mo
files should give you highlighted files with basic indentation support.