turbo-editors/turbo-golopublic Fork 0
79b67fdd82d26f23a6b97e39c1f063d475cbbc49
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-golo.git
git clone ssh://git@rickub.com/turbo-editors/turbo-golo.git

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

snippets.toml · 145 lines · 3.0 KBTOML Blame HistoryRaw
📦 Turbo Golo d710c1b k33g yesterday1# turbo-golo 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, golo, html, javascript, markdown, toml, xml,
10# yaml. Leave it out and the snippet is offered everywhere.
11#
12# Bodies are indented with two spaces, which is what every example in the
13# GoloScript documentation and its own templates use. Golo has no formatter to
14# disagree with, so the convention is the only authority there is.
15#
16# Every Golo body below is written in single quotes — '''…''' rather than
17# """…""" — because a Golo string carries \n and \" the way a Go string does,
18# and TOML would interpret those escapes in a basic string before the editor
19# ever saw them. In a literal string a backslash is just a backslash, which is
20# what a Golo snippet needs.
21#
22# Your own snippets, shared across every project, go in:
23# /Users/k33g/Library/Application Support/turbo-golo/snippets.toml
24
25[[snippet]]
26name = "module"
27group = "Golo"
28languages = ["golo"]
29body = '''
30module hello.World
31
32function main = |args| {
33 println("Hello, Golo!")
34}'''
35
36[[snippet]]
37name = "main"
38group = "Golo"
39languages = ["golo"]
40body = '''
41function main = |args| {
42 println("Hello, Golo!")
43}'''
44
45[[snippet]]
46name = "function"
47group = "Golo"
48languages = ["golo"]
49body = '''
50function name = |a, b| {
51 return a + b
52}'''
53
54[[snippet]]
55name = "closure"
56group = "Golo"
57languages = ["golo"]
58body = '''
59let f = |x| -> x * 2'''
60
61[[snippet]]
62name = "struct"
63group = "Golo"
64languages = ["golo"]
65body = '''
66struct Point = { x, y }'''
67
68[[snippet]]
69name = "union"
70group = "Golo"
71languages = ["golo"]
72body = '''
73union Shape = {
74 Circle = { radius }
75 Rect = { width, height }
76}'''
77
78[[snippet]]
79name = "augment"
80group = "Golo"
81languages = ["golo"]
82body = '''
83augment Point {
84 function describe = |this| -> "(" + this: x() + ", " + this: y() + ")"
85}'''
86
87[[snippet]]
88name = "match"
89group = "Golo"
90languages = ["golo"]
91body = '''
92let label = match {
93 when n < 0 then "negative"
94 when n == 0 then "zero"
95 otherwise "positive"
96}'''
97
98[[snippet]]
99name = "foreach"
100group = "Golo"
101languages = ["golo"]
102body = '''
103foreach item in list[1, 2, 3] {
104 println(item)
105}'''
106
107[[snippet]]
108name = "for"
109group = "Golo"
110languages = ["golo"]
111body = '''
112for (var i = 0, i < 10, i = i + 1) {
113 println(i)
114}'''
115
116[[snippet]]
117name = "try"
118group = "Golo"
119languages = ["golo"]
120body = '''
121try {
122 throw "boom"
123} catch (e) {
124 println("caught: \"" + e + "\"")
125} finally {
126 println("done")
127}'''
128
129[[snippet]]
130name = "comprehension"
131group = "Golo"
132languages = ["golo"]
133body = '''
134let squares = list[x * x foreach x in range(1, 6) when x > 2]'''
135
136[[snippet]]
137group = "General"
138name = "Hello"
139body = "Hello!!!"
140
141[[snippet]]
142group = "Markdown"
143name = "Image"
144languages = ["markdown"]
145body = "![img](./pictures)"