turbo-editors/turbo-moonbitpublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-moonbit.git
git clone ssh://git@rickub.com/turbo-editors/turbo-moonbit.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

📦 Turbo MoonBit cc1f595 · on main · k33g · 9h ago
snippets.toml.tmpl · 106 lines · 2.4 KBCheetah Blame HistoryRaw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
# turbo-moonbit snippets.
#
# Each [[snippet]] becomes one line of the Snippets menu. Snippets sharing a
# group appear together in a submenu of that name; one with no group goes into
# %s. A snippet is inserted at the cursor, and every line after the
# first is indented to match the line you inserted it on.
#
# languages restricts a snippet to files of those kinds, by the names the
# editor uses: bash, dockerfile, html, javascript, markdown, moonbit, toml,
# xml, yaml. Leave it out and the snippet is offered everywhere.
#
# Bodies are indented with two spaces, which is what `moon fmt` writes. Running
# the formatter over a file indented any other way rewrites the whole file, so
# a snippet that disagrees with it turns one insertion into a large diff.
#
# Every MoonBit body below is written in single quotes — '''…''' rather than
# """…""" — because MoonBit interpolates with \{…}, and a backslash before a
# brace is not a valid escape in a TOML basic string. In a literal string a
# backslash is just a backslash, which is exactly what a MoonBit snippet needs.
#
# Your own snippets, shared across every project, go in:
#   %s

[[snippet]]
name = "main"
group = "MoonBit"
languages = ["moonbit"]
body = '''
fn main {
  println("Hello, MoonBit!")
}'''

[[snippet]]
name = "test"
group = "MoonBit"
languages = ["moonbit"]
body = '''
test "it works" {
  assert_eq(1 + 1, 2)
}'''

[[snippet]]
name = "struct"
group = "MoonBit"
languages = ["moonbit"]
body = '''
struct Point {
  x : Int
  y : Int
} derive(Eq)'''

[[snippet]]
name = "enum"
group = "MoonBit"
languages = ["moonbit"]
body = '''
enum Shape {
  Circle(Double)
  Rect(Double, Double)
} derive(Debug)'''

[[snippet]]
name = "match"
group = "MoonBit"
languages = ["moonbit"]
body = '''
match value {
  Some(x) => "got \{x}"
  None => "nothing"
}'''

[[snippet]]
name = "trait impl"
group = "MoonBit"
languages = ["moonbit"]
body = '''
impl Show for Point with fn output(self, logger) {
  logger.write_string("Point(\{self.x}, \{self.y})")
}'''

[[snippet]]
name = "loop"
group = "MoonBit"
languages = ["moonbit"]
body = '''
for i = 0, acc = 0 {
  if i > n { break acc } else { continue i + 1, acc + i }
}'''

[[snippet]]
name = "guard"
group = "MoonBit"
languages = ["moonbit"]
body = '''
guard xs.length() > 0 else { fail("empty") }'''

[[snippet]]
group = "General"
name = "Hello"
body = "Hello!!!"

[[snippet]]
group = "Markdown"
name = "Image"
languages = ["markdown"]
body = "![img](./pictures)"