Skip to content

Add syntax highlighting for Moonscript - #4229

Open
darltrash wants to merge 1 commit into
micro-editor:masterfrom
darltrash:master
Open

darltrash wants to merge 1 commit into
micro-editor:masterfrom
darltrash:master

Conversation

@darltrash

Copy link
Copy Markdown

Adds syntax highlighting for the Moonscript programming language

@darltrash

Copy link
Copy Markdown
Author

In case anyone wants to try it right now, you can copy the new file into ~/.config/micro/syntax/ :)

@Andriamanitra Andriamanitra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very familiar with Moonscript but the syntax seems to work alright with the files I tested.

Comment on lines +19 to +23
# Long bracket strings like [[ ... ]] or [==[ ... ]==]
- constant.string:
start: "\\[=*\\["
end: "\\]=*\\]"
rules: []

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would work better as separate rules for [[ ... ]] and [==[ ... ]==]. I assume the main reason to use [==[ ... ]==] is to include ]] somewhere inside so you don't want that to end the string.

Comment on lines +32 to +35
- default:
start: "#\\{"
end: "\\}"
rules: []

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to simply match #\\{[^\\}]*\\} because handling of regions inside regions is currently pretty buggy in our highlighter.

Example of said bugs causing weird things to happen:
screenshot of a part of a comment getting highlighted when it's on the same line as a string interpolation

@JoeKar

JoeKar commented Sep 17, 2026

Copy link
Copy Markdown
Member

But how does this syntax differ from the others we've rejected in the past?

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.

3 participants