turbo-editors/turbo-moonbitpublic Fork 0
v1.0.3
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.

snippets.toml · 106 lines · 2.5 KBTOML Blame HistoryRaw
📦 Turbo MoonBit cc1f595 k33g yesterday1# turbo-moonbit snippets.
2#
3# Each [[snippet]] becomes one line of the Snippets menu. Snippets sharing a
4# group appear together in a submenu of that name; one with no group goes into
5# General. A snippet is inserted at the cursor, and every line after the
6# first is indented to match the line you inserted it on.
7#
8# languages restricts a snippet to files of those kinds, by the names the
9# editor uses: bash, dockerfile, html, javascript, markdown, moonbit, toml,
10# xml, yaml. Leave it out and the snippet is offered everywhere.
11#
12# Bodies are indented with two spaces, which is what `moon fmt` writes. Running
13# the formatter over a file indented any other way rewrites the whole file, so
14# a snippet that disagrees with it turns one insertion into a large diff.
15#
16# Every MoonBit body below is written in single quotes — '''…''' rather than
17# """…""" — because MoonBit interpolates with \{…}, and a backslash before a
18# brace is not a valid escape in a TOML basic string. In a literal string a
19# backslash is just a backslash, which is exactly what a MoonBit snippet needs.
20#
21# Your own snippets, shared across every project, go in:
22# /Users/k33g/Library/Application Support/turbo-moonbit/snippets.toml
23
24[[snippet]]
25name = "main"
26group = "MoonBit"
27languages = ["moonbit"]
28body = '''
29fn main {
30 println("Hello, MoonBit!")
31}'''
32
33[[snippet]]
34name = "test"
35group = "MoonBit"
36languages = ["moonbit"]
37body = '''
38test "it works" {
39 assert_eq(1 + 1, 2)
40}'''
41
42[[snippet]]
43name = "struct"
44group = "MoonBit"
45languages = ["moonbit"]
46body = '''
47struct Point {
48 x : Int
49 y : Int
50} derive(Eq)'''
51
52[[snippet]]
53name = "enum"
54group = "MoonBit"
55languages = ["moonbit"]
56body = '''
57enum Shape {
58 Circle(Double)
59 Rect(Double, Double)
60} derive(Show)'''
61
62[[snippet]]
63name = "match"
64group = "MoonBit"
65languages = ["moonbit"]
66body = '''
67match value {
68 Some(x) => "got \{x}"
69 None => "nothing"
70}'''
71
72[[snippet]]
73name = "trait impl"
74group = "MoonBit"
75languages = ["moonbit"]
76body = '''
77impl Show for Point with fn output(self, logger) {
78 logger.write_string("Point(\{self.x}, \{self.y})")
79}'''
80
81[[snippet]]
82name = "loop"
83group = "MoonBit"
84languages = ["moonbit"]
85body = '''
86loop (0, 0) {
87 (i, acc) => if i > n { break acc } else { continue (i + 1, acc + i) }
88}'''
89
90[[snippet]]
91name = "guard"
92group = "MoonBit"
93languages = ["moonbit"]
94body = '''
95guard xs.length() > 0 else { fail("empty") }'''
96
97[[snippet]]
98group = "General"
99name = "Hello"
100body = "Hello!!!"
101
102[[snippet]]
103group = "Markdown"
104name = "Image"
105languages = ["markdown"]
106body = "![img](./pictures)"