turbo-editors/turbo-jspublic Fork 0
v1.0.0
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-js.git
git clone ssh://git@rickub.com/turbo-editors/turbo-js.git

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

snippets.toml.tmpl · 103 lines · 2.1 KBCheetah Blame HistoryRaw
📦 Turbo JS 91999d1 k33g 12h ago1# turbo-js 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# %s. 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: javascript, json, toml, yaml, markdown, html, xml, dockerfile,
10# bash. Leave it out and the snippet is offered everywhere.
11#
12# Bodies indent with two spaces, which is what Prettier writes by default; a
13# tab here would be reformatted away the first time `npx prettier --write`
14# runs, which is a diff nobody asked for.
15#
16# Your own snippets, shared across every project, go in:
17# %s
18
19[[snippet]]
20name = "import"
21group = "JavaScript"
22languages = ["javascript"]
23body = 'import { name } from "node:module";'
24
25[[snippet]]
26name = "require"
27group = "JavaScript"
28languages = ["javascript"]
29body = 'const name = require("node:module");'
30
31[[snippet]]
32name = "async function"
33group = "JavaScript"
34languages = ["javascript"]
35body = """
36async function name() {
37 const result = await promise;
38 return result;
39}"""
40
41[[snippet]]
42name = "try / catch"
43group = "JavaScript"
44languages = ["javascript"]
45body = """
46try {
47} catch (error) {
48 console.error(error);
49}"""
50
51[[snippet]]
52name = "class"
53group = "JavaScript"
54languages = ["javascript"]
55body = """
56class Name {
57 #field;
58
59 constructor(field) {
60 this.#field = field;
61 }
62}"""
63
64[[snippet]]
65name = "for of"
66group = "JavaScript"
67languages = ["javascript"]
68body = """
69for (const item of items) {
70}"""
71
72[[snippet]]
73name = "test"
74group = "JavaScript"
75languages = ["javascript"]
76body = """
77import { test } from "node:test";
78import assert from "node:assert/strict";
79
80test("it works", () => {
81 assert.equal(1 + 1, 2);
82});"""
83
84[[snippet]]
85name = "scripts"
86group = "JSON"
87languages = ["json"]
88body = """
89"scripts": {
90 "start": "node main.js",
91 "test": "node --test"
92}"""
93
94[[snippet]]
95group = "General"
96name = "Hello"
97body = "Hello!!!"
98
99[[snippet]]
100group = "Markdown"
101name = "Image"
102languages = ["markdown"]
103body = "![img](./pictures)"