Elffuss BraidHub

kikocis/continue public

ed46f5b1432f · 12.1 KiBRawPermalink
1{
2 "scopeName": "source.go",
3 "name": "Go",
4 "comment": "Go language",
5 "fileTypes": [
6 "go"
7 ],
8 "foldingStartMarker": "({|\\()\\s*$",
9 "foldingStopMarker": "(}|\\))\\s*$",
10 "patterns": [
11 {
12 "comment": "Block comments",
13 "begin": "/\\*",
14 "end": "\\*/",
15 "captures": {
16 "0": {
17 "name": "punctuation.definition.comment.go"
18 }
19 },
20 "name": "comment.block.go"
21 },
22 {
23 "comment": "Line comments",
24 "begin": "//",
25 "beginCaptures": {
26 "0": {
27 "name": "punctuation.definition.comment.go"
28 }
29 },
30 "end": "$",
31 "name": "comment.line.double-slash.go"
32 },
33 {
34 "comment": "Interpreted string literals",
35 "begin": "\"",
36 "beginCaptures": {
37 "0": {
38 "name": "punctuation.definition.string.begin.go"
39 }
40 },
41 "end": "\"",
42 "endCaptures": {
43 "0": {
44 "name": "punctuation.definition.string.end.go"
45 }
46 },
47 "name": "string.quoted.double.go",
48 "patterns": [
49 {
50 "include": "#string_escaped_char"
51 },
52 {
53 "include": "#string_placeholder"
54 }
55 ]
56 },
57 {
58 "comment": "Raw string literals",
59 "begin": "`",
60 "beginCaptures": {
61 "0": {
62 "name": "punctuation.definition.string.begin.go"
63 }
64 },
65 "end": "`",
66 "endCaptures": {
67 "0": {
68 "name": "punctuation.definition.string.end.go"
69 }
70 },
71 "name": "string.quoted.raw.go",
72 "patterns": [
73 {
74 "include": "#string_placeholder"
75 }
76 ]
77 },
78 {
79 "comment": "Syntax error receiving channels",
80 "match": "<\\-([\\t ]+)chan\\b",
81 "captures": {
82 "1": {
83 "name": "invalid.illegal.receive-channel.go"
84 }
85 }
86 },
87 {
88 "comment": "Syntax error sending channels",
89 "match": "\\bchan([\\t ]+)<-",
90 "captures": {
91 "1": {
92 "name": "invalid.illegal.send-channel.go"
93 }
94 }
95 },
96 {
97 "comment": "Syntax error using slices",
98 "match": "\\[\\](\\s+)",
99 "captures": {
100 "1": {
101 "name": "invalid.illegal.slice.go"
102 }
103 }
104 },
105 {
106 "comment": "Syntax error numeric literals",
107 "match": "\\b0[0-7]*[89]\\d*\\b",
108 "name": "invalid.illegal.numeric.go"
109 },
110 {
111 "comment": "Built-in functions",
112 "match": "\\b(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\\b(?=\\()",
113 "name": "support.function.builtin.go"
114 },
115 {
116 "comment": "Function declarations",
117 "match": "^(\\bfunc\\b)(?:\\s+(\\([^\\)]+\\)\\s+)?([a-zA-Z_]\\w*)(?=\\())?",
118 "captures": {
119 "1": {
120 "name": "keyword.function.go"
121 },
122 "2": {
123 "patterns": [
124 {
125 "include": "#brackets"
126 },
127 {
128 "include": "#operators"
129 }
130 ]
131 },
132 "3": {
133 "name": "entity.name.function"
134 }
135 }
136 },
137 {
138 "comment": "Functions",
139 "match": "(\\bfunc\\b)|([a-zA-Z_]\\w*)(?=\\()",
140 "captures": {
141 "1": {
142 "name": "keyword.function.go"
143 },
144 "2": {
145 "name": "support.function.go"
146 }
147 }
148 },
149 {
150 "comment": "Floating-point literals",
151 "match": "(\\.\\d+([Ee][-+]\\d+)?i?)\\b|\\b\\d+\\.\\d*(([Ee][-+]\\d+)?i?\\b)?",
152 "name": "constant.numeric.floating-point.go"
153 },
154 {
155 "comment": "Integers",
156 "match": "\\b((0x[0-9a-fA-F]+)|(0[0-7]+i?)|(\\d+([Ee]\\d+)?i?)|(\\d+[Ee][-+]\\d+i?))\\b",
157 "name": "constant.numeric.integer.go"
158 },
159 {
160 "comment": "Language constants",
161 "match": "\\b(true|false|nil|iota)\\b",
162 "name": "constant.language.go"
163 },
164 {
165 "comment": "Package declarations",
166 "match": "(?<=package)\\s+([a-zA-Z_]\\w*)",
167 "captures": {
168 "1": {
169 "name": "entity.name.package.go"
170 }
171 }
172 },
173 {
174 "comment": "Single line import declarations",
175 "match": "(?<=import)(\\s+((?!\\s+\")[^\\s]*)?\\s*)((\")([^\"]*)(\"))",
176 "captures": {
177 "2": {
178 "name": "entity.alias.import.go"
179 },
180 "3": {
181 "name": "string.quoted.double.go"
182 },
183 "4": {
184 "name": "punctuation.definition.string.begin.go"
185 },
186 "5": {
187 "name": "entity.name.import.go"
188 },
189 "6": {
190 "name": "punctuation.definition.string.end.go"
191 }
192 }
193 },
194 {
195 "comment": "Multiline import declarations",
196 "begin": "(?<=import)\\s+(\\()",
197 "beginCaptures": {
198 "1": {
199 "name": "punctuation.other.bracket.round.go"
200 }
201 },
202 "patterns": [
203 {
204 "match": "((?!\\s+\")[^\\s]*)?\\s+((\")([^\"]*)(\"))",
205 "captures": {
206 "1": {
207 "name": "entity.alias.import.go"
208 },
209 "2": {
210 "name": "string.quoted.double.go"
211 },
212 "3": {
213 "name": "punctuation.definition.string.begin.go"
214 },
215 "4": {
216 "name": "entity.name.import.go"
217 },
218 "5": {
219 "name": "punctuation.definition.string.end.go"
220 }
221 }
222 }
223 ],
224 "end": "\\)",
225 "endCaptures": {
226 "0": {
227 "name": "punctuation.other.bracket.round.go"
228 }
229 }
230 },
231 {
232 "comment": "Type declarations",
233 "match": "(?<=type)\\s+([a-zA-Z_]\\w*)",
234 "captures": {
235 "1": {
236 "name": "entity.name.type.go"
237 }
238 }
239 },
240 {
241 "comment": "Shorthand variable declaration and assignments",
242 "match": "[a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*(?=\\s*:=)",
243 "captures": {
244 "0": {
245 "patterns": [
246 {
247 "match": "[a-zA-Z_]\\w*",
248 "name": "variable.other.assignment.go"
249 },
250 {
251 "include": "#delimiters"
252 }
253 ]
254 }
255 }
256 },
257 {
258 "comment": "Assignments to existing variables",
259 "match": "(?<!var )\\s*([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)(?=\\s*=[^=])",
260 "captures": {
261 "1": {
262 "patterns": [
263 {
264 "match": "[a-zA-Z_]\\w*",
265 "name": "variable.other.assignment.go"
266 },
267 {
268 "include": "#delimiters"
269 }
270 ]
271 }
272 }
273 },
274 {
275 "comment": "Single line variable declarations/assignments",
276 "match": "(?<=var)\\s+(.*)$",
277 "captures": {
278 "1": {
279 "patterns": [
280 {
281 "include": "#variables"
282 }
283 ]
284 }
285 }
286 },
287 {
288 "comment": "Multiline variable declarations/assignments",
289 "begin": "(\\bvar\\b)\\s+(\\()",
290 "beginCaptures": {
291 "1": {
292 "name": "keyword.var.go"
293 },
294 "2": {
295 "name": "punctuation.other.bracket.round.go"
296 }
297 },
298 "end": "\\)",
299 "endCaptures": {
300 "0": {
301 "name": "punctuation.other.bracket.round.go"
302 }
303 },
304 "patterns": [
305 {
306 "include": "#variables"
307 },
308 {
309 "include": "$self"
310 }
311 ]
312 },
313 {
314 "comment": "Terminators",
315 "match": ";",
316 "name": "punctuation.terminator.go"
317 },
318 {
319 "include": "#brackets"
320 },
321 {
322 "include": "#delimiters"
323 },
324 {
325 "include": "#keywords"
326 },
327 {
328 "include": "#operators"
329 },
330 {
331 "include": "#runes"
332 },
333 {
334 "include": "#storage_types"
335 }
336 ],
337 "repository": {
338 "brackets": {
339 "patterns": [
340 {
341 "match": "\\{|\\}",
342 "name": "punctuation.other.bracket.curly.go"
343 },
344 {
345 "match": "\\(|\\)",
346 "name": "punctuation.other.bracket.round.go"
347 },
348 {
349 "match": "\\[|\\]",
350 "name": "punctuation.other.bracket.square.go"
351 }
352 ]
353 },
354 "delimiters": {
355 "patterns": [
356 {
357 "match": ",",
358 "name": "punctuation.other.comma.go"
359 },
360 {
361 "match": "\\.(?!\\.\\.)",
362 "name": "punctuation.other.period.go"
363 },
364 {
365 "match": ":(?!=)",
366 "name": "punctuation.other.colon.go"
367 }
368 ]
369 },
370 "keywords": {
371 "patterns": [
372 {
373 "comment": "Flow control keywords",
374 "match": "\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\b",
375 "name": "keyword.control.go"
376 },
377 {
378 "match": "\\bchan\\b",
379 "name": "keyword.channel.go"
380 },
381 {
382 "match": "\\bconst\\b",
383 "name": "keyword.const.go"
384 },
385 {
386 "match": "\\bfunc\\b",
387 "name": "keyword.function.go"
388 },
389 {
390 "match": "\\binterface\\b",
391 "name": "keyword.interface.go"
392 },
393 {
394 "match": "\\bimport\\b",
395 "name": "keyword.import.go"
396 },
397 {
398 "match": "\\bmap\\b",
399 "name": "keyword.map.go"
400 },
401 {
402 "match": "\\bpackage\\b",
403 "name": "keyword.package.go"
404 },
405 {
406 "match": "\\bstruct\\b",
407 "name": "keyword.struct.go"
408 },
409 {
410 "match": "\\btype\\b",
411 "name": "keyword.type.go"
412 },
413 {
414 "match": "\\bvar\\b",
415 "name": "keyword.var.go"
416 }
417 ]
418 },
419 "operators": {
420 "comment": "Note that the order here is very important!",
421 "patterns": [
422 {
423 "match": "(\\*|&)(?=\\w)",
424 "name": "keyword.operator.address.go"
425 },
426 {
427 "match": "<\\-",
428 "name": "keyword.operator.channel.go"
429 },
430 {
431 "match": "\\-\\-",
432 "name": "keyword.operator.decrement.go"
433 },
434 {
435 "match": "\\+\\+",
436 "name": "keyword.operator.increment.go"
437 },
438 {
439 "match": "(==|!=|<=|>=|<[^<]|>[^>])",
440 "name": "keyword.operator.comparison.go"
441 },
442 {
443 "match": "(&&|\\|\\||!)",
444 "name": "keyword.operator.logical.go"
445 },
446 {
447 "match": "(=|\\+=|\\-=|\\|=|\\^=|\\*=|/=|:=|%=|<<=|>>=|&\\^=|&=)",
448 "name": "keyword.operator.assignment.go"
449 },
450 {
451 "match": "(\\+|\\-|\\*|/|%)",
452 "name": "keyword.operator.arithmetic.go"
453 },
454 {
455 "match": "(&(?!\\^)|\\||\\^|&\\^|<<|>>)",
456 "name": "keyword.operator.arithmetic.bitwise.go"
457 },
458 {
459 "match": "\\.\\.\\.",
460 "name": "keyword.operator.ellipsis.go"
461 }
462 ]
463 },
464 "runes": {
465 "patterns": [
466 {
467 "match": "\\'(\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})|\\p{Any})\\'",
468 "name": "constant.other.rune.go"
469 },
470 {
471 "match": "\\'.*\\'",
472 "name": "invalid.illegal.unknown-rune.go"
473 }
474 ]
475 },
476 "storage_types": {
477 "patterns": [
478 {
479 "match": "\\bbool\\b",
480 "name": "storage.type.boolean.go"
481 },
482 {
483 "match": "\\bbyte\\b",
484 "name": "storage.type.byte.go"
485 },
486 {
487 "match": "\\berror\\b",
488 "name": "storage.type.error.go"
489 },
490 {
491 "match": "\\b(complex(64|128)|float(32|64)|u?int(8|16|32|64)?)\\b",
492 "name": "storage.type.numeric.go"
493 },
494 {
495 "match": "\\brune\\b",
496 "name": "storage.type.rune.go"
497 },
498 {
499 "match": "\\bstring\\b",
500 "name": "storage.type.string.go"
501 },
502 {
503 "match": "\\buintptr\\b",
504 "name": "storage.type.uintptr.go"
505 }
506 ]
507 },
508 "string_escaped_char": {
509 "patterns": [
510 {
511 "match": "\\\\([0-7]{3}|[abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})",
512 "name": "constant.character.escape.go"
513 },
514 {
515 "match": "\\\\[^0-7xuUabfnrtv\\'\"]",
516 "name": "invalid.illegal.unknown-escape.go"
517 }
518 ]
519 },
520 "string_placeholder": {
521 "patterns": [
522 {
523 "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]",
524 "name": "constant.other.placeholder.go"
525 }
526 ]
527 },
528 "variables": {
529 "comment": "First add tests and make sure existing tests still pass when changing anything here!",
530 "patterns": [
531 {
532 "match": "([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)\\s*(=.*)",
533 "captures": {
534 "1": {
535 "patterns": [
536 {
537 "match": "[a-zA-Z_]\\w*",
538 "name": "variable.other.assignment.go"
539 },
540 {
541 "include": "#delimiters"
542 }
543 ]
544 },
545 "2": {
546 "patterns": [
547 {
548 "include": "$self"
549 }
550 ]
551 }
552 }
553 },
554 {
555 "match": "([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)(\\s+[\\*]?[a-zA-Z_]\\w*\\s*)(=.*)",
556 "captures": {
557 "1": {
558 "patterns": [
559 {
560 "match": "[a-zA-Z_]\\w*",
561 "name": "variable.other.assignment.go"
562 },
563 {
564 "include": "#delimiters"
565 }
566 ]
567 },
568 "2": {
569 "patterns": [
570 {
571 "include": "$self"
572 }
573 ]
574 },
575 "3": {
576 "patterns": [
577 {
578 "include": "$self"
579 }
580 ]
581 }
582 }
583 },
584 {
585 "match": "([a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*)(\\s+[\\[\\]\\*]{0,3}[a-zA-Z_]\\w*\\s*[^=].*)",
586 "captures": {
587 "1": {
588 "patterns": [
589 {
590 "match": "[a-zA-Z_]\\w*",
591 "name": "variable.other.declaration.go"
592 },
593 {
594 "include": "#delimiters"
595 }
596 ]
597 },
598 "2": {
599 "patterns": [
600 {
601 "include": "$self"
602 }
603 ]
604 }
605 }
606 }
607 ]
608 }
609 },
610 "version": "https://github.com/atom/language-go/commit/d941ce3155b500e65b4d7fbc53ea51b9c92ec1cb"
611}