PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.9.3
Code Block Pro – Beautiful Syntax Highlighting v1.9.3
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / kotlin.tmLanguage.json

kotlin.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.9.3, at build/shiki/languages/kotlin.tmLanguage.json

706 lines 16.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "fileTypes": ["kt", "kts"],
3 "foldingStartMarker": "(\\{\\s*(//.*)?$|^\\s*// \\{\\{\\{)",
4 "foldingStopMarker": "^\\s*(\\}|// \\}\\}\\}$)",
5 "name": "kotlin",
6 "patterns": [
7 {
8 "include": "#comments"
9 },
10 {
11 "captures": {
12 "1": {
13 "name": "keyword.other.kotlin"
14 },
15 "2": {
16 "name": "entity.name.package.kotlin"
17 }
18 },
19 "match": "^\\s*(package)\\b(?:\\s*([^ ;$]+)\\s*)?"
20 },
21 {
22 "captures": {
23 "1": {
24 "name": "keyword.other.import.kotlin"
25 },
26 "2": {
27 "name": "storage.modifier.import.java"
28 },
29 "3": {
30 "name": "keyword.other.kotlin"
31 },
32 "4": {
33 "name": "entity.name.type"
34 }
35 },
36 "match": "^\\s*(import)\\s+([^ $.]+(?:\\.(?:[`][^$`]+[`]|[^` $.]+))+)(?:\\s+(as)\\s+([`][^$`]+[`]|[^` $.]+))?",
37 "name": "meta.import.kotlin"
38 },
39 {
40 "include": "#code"
41 }
42 ],
43 "repository": {
44 "annotations": {
45 "patterns": [
46 {
47 "begin": "(@[^ (]+)(\\()?",
48 "beginCaptures": {
49 "1": {
50 "name": "storage.type.annotation.kotlin"
51 },
52 "2": {
53 "name": "punctuation.definition.annotation-arguments.begin.kotlin"
54 }
55 },
56 "end": "(\\)|\\s|$)",
57 "endCaptures": {
58 "1": {
59 "name": "punctuation.definition.annotation-arguments.end.kotlin"
60 }
61 },
62 "name": "meta.declaration.annotation.kotlin",
63 "patterns": [
64 {
65 "captures": {
66 "1": {
67 "name": "constant.other.key.kotlin"
68 },
69 "2": {
70 "name": "keyword.operator.assignment.kotlin"
71 }
72 },
73 "match": "(\\w*)\\s*(=)"
74 },
75 {
76 "include": "#code"
77 },
78 {
79 "match": ",",
80 "name": "punctuation.seperator.property.kotlin"
81 }
82 ]
83 },
84 {
85 "match": "@\\w*",
86 "name": "storage.type.annotation.kotlin"
87 }
88 ]
89 },
90 "builtin-functions": {
91 "patterns": [
92 {
93 "match": "\\b(apply|also|let|takeIf|run|takeUnless|with|print|println)\\b\\s*(?={|\\()",
94 "captures": {
95 "1": {
96 "name": "support.function.kotlin"
97 }
98 }
99 },
100 {
101 "match": "\\b(mutableListOf|listOf|mutableMapOf|mapOf|mutableSetOf|setOf)\\b\\s*(?={|\\()",
102 "captures": {
103 "1": {
104 "name": "support.function.kotlin"
105 }
106 }
107 }
108 ]
109 },
110 "comments": {
111 "patterns": [
112 {
113 "captures": {
114 "0": {
115 "name": "punctuation.definition.comment.kotlin"
116 }
117 },
118 "match": "/\\*\\*/",
119 "name": "comment.block.empty.kotlin"
120 },
121 {
122 "include": "#comments-inline"
123 }
124 ]
125 },
126 "comments-inline": {
127 "patterns": [
128 {
129 "begin": "/\\*",
130 "captures": {
131 "0": {
132 "name": "punctuation.definition.comment.kotlin"
133 }
134 },
135 "end": "\\*/",
136 "name": "comment.block.kotlin"
137 },
138 {
139 "captures": {
140 "1": {
141 "name": "comment.line.double-slash.kotlin"
142 },
143 "2": {
144 "name": "punctuation.definition.comment.kotlin"
145 }
146 },
147 "match": "\\s*((//).*$\\n?)"
148 }
149 ]
150 },
151 "class-literal": {
152 "begin": "(?=\\b(?:class|interface|object)\\s+\\w+)\\b",
153 "end": "(?=\\}|$)",
154 "name": "meta.class.kotlin",
155 "patterns": [
156 {
157 "include": "#keyword-literal"
158 },
159 {
160 "begin": "\\b(class|object|interface)\\b\\s+(\\w+)",
161 "beginCaptures": {
162 "1": {
163 "name": "storage.modifier.kotlin"
164 },
165 "2": {
166 "name": "entity.name.class.kotlin"
167 }
168 },
169 "end": "(?=\\{|\\(|:|$)",
170 "patterns": [
171 {
172 "include": "#keyword-literal"
173 },
174 {
175 "include": "#annotations"
176 },
177 {
178 "include": "#types"
179 }
180 ]
181 },
182 {
183 "begin": "(:)\\s*(\\w+)",
184 "beginCaptures": {
185 "1": {
186 "name": "keyword.operator.declaration.kotlin"
187 },
188 "2": {
189 "name": "entity.other.inherited-class.kotlin"
190 }
191 },
192 "end": "(?={|=|$)",
193 "patterns": [
194 {
195 "include": "#types"
196 }
197 ]
198 },
199 {
200 "include": "#braces"
201 },
202 {
203 "include": "#parens"
204 }
205 ]
206 },
207 "literal-functions": {
208 "begin": "(?=\\b(?:fun)\\b)",
209 "end": "(?=$|=|\\})",
210 "patterns": [
211 {
212 "begin": "\\b(fun)\\b",
213 "beginCaptures": {
214 "1": {
215 "name": "keyword.other.kotlin"
216 }
217 },
218 "end": "(?=\\()",
219 "patterns": [
220 {
221 "captures": {
222 "2": {
223 "name": "entity.name.function.kotlin"
224 }
225 },
226 "match": "([\\.<\\?>\\w]+\\.)?(\\w+|(`[^`]*`))"
227 },
228 {
229 "include": "#types"
230 }
231 ]
232 },
233 {
234 "begin": "(:)",
235 "beginCaptures": {
236 "1": {
237 "name": "keyword.operator.declaration.kotlin"
238 }
239 },
240 "end": "(?={|=|$)",
241 "patterns": [
242 {
243 "include": "#types"
244 }
245 ]
246 },
247 {
248 "include": "#parens"
249 },
250 {
251 "include": "#braces"
252 }
253 ]
254 },
255 "parameters": {
256 "patterns": [
257 {
258 "begin": "(:)",
259 "beginCaptures": {
260 "1": {
261 "name": "keyword.operator.declaration.kotlin"
262 }
263 },
264 "end": "(?=,|=|\\))",
265 "patterns": [
266 {
267 "include": "#types"
268 }
269 ]
270 },
271 {
272 "match": "\\w+(?=:)",
273 "name": "variable.parameter.function.kotlin"
274 },
275 {
276 "include": "#keyword-literal"
277 }
278 ]
279 },
280 "keyword-literal": {
281 "patterns": [
282 {
283 "match": "(\\!in|\\!is|as\\?)",
284 "name": "keyword.operator.kotlin"
285 },
286 {
287 "match": "\\b(in|is|as|assert)\\b",
288 "name": "keyword.operator.kotlin"
289 },
290 {
291 "match": "\\b(const)\\b",
292 "name": "storage.modifier.kotlin"
293 },
294 {
295 "match": "\\b(val|var)\\b",
296 "name": "storage.type.kotlin"
297 },
298 {
299 "match": "\\b(\\_)\\b",
300 "name": "punctuation.definition.variable.kotlin"
301 },
302 {
303 "match": "\\b(data|inline|tailrec|operator|infix|typealias|reified)\\b",
304 "name": "storage.type.kotlin"
305 },
306 {
307 "match": "\\b(external|public|private|protected|internal|abstract|final|sealed|enum|open|annotation|override|vararg|typealias|expect|actual|suspend|yield|out|in)\\b",
308 "name": "storage.modifier.kotlin"
309 },
310 {
311 "match": "\\b(try|catch|finally|throw)\\b",
312 "name": "keyword.control.catch-exception.kotlin"
313 },
314 {
315 "match": "\\b(if|else|when)\\b",
316 "name": "keyword.control.conditional.kotlin"
317 },
318 {
319 "match": "\\b(while|for|do|return|break|continue)\\b",
320 "name": "keyword.control.kotlin"
321 },
322 {
323 "match": "\\b(constructor|init)\\b",
324 "name": "entity.name.function.constructor"
325 },
326 {
327 "match": "\\b(companion|object)\\b",
328 "name": "storage.type.kotlin"
329 }
330 ]
331 },
332 "keyword-operator": {
333 "patterns": [
334 {
335 "match": "\\b(and|or|not|inv)\\b",
336 "name": "keyword.operator.bitwise.kotlin"
337 },
338 {
339 "match": "(==|!=|===|!==|<=|>=|<|>)",
340 "name": "keyword.operator.comparison.kotlin"
341 },
342 {
343 "match": "(=)",
344 "name": "keyword.operator.assignment.kotlin"
345 },
346 {
347 "match": "(:(?!:))",
348 "name": "keyword.operator.declaration.kotlin"
349 },
350 {
351 "match": "(\\?:)",
352 "name": "keyword.operator.elvis.kotlin"
353 },
354 {
355 "match": "(\\-\\-|\\+\\+)",
356 "name": "keyword.operator.increment-decrement.kotlin"
357 },
358 {
359 "match": "(\\-|\\+|\\*|\\/|%)",
360 "name": "keyword.operator.arithmetic.kotlin"
361 },
362 {
363 "match": "(\\+\\=|\\-\\=|\\*\\=|\\/\\=)",
364 "name": "keyword.operator.arithmetic.assign.kotlin"
365 },
366 {
367 "match": "(\\!|\\&\\&|\\|\\|)",
368 "name": "keyword.operator.logical.kotlin"
369 },
370 {
371 "match": "(\\.\\.)",
372 "name": "keyword.operator.range.kotlin"
373 }
374 ]
375 },
376 "keyword-punctuation": {
377 "patterns": [
378 {
379 "match": "(::)",
380 "name": "punctuation.accessor.reference.kotlin"
381 },
382 {
383 "match": "(\\?\\.)",
384 "name": "punctuation.accessor.dot.safe.kotlin"
385 },
386 {
387 "match": "(\\.)",
388 "name": "punctuation.accessor.dot.kotlin"
389 },
390 {
391 "match": "(\\,)",
392 "name": "punctuation.seperator.kotlin"
393 },
394 {
395 "match": "(\\;)",
396 "name": "punctuation.terminator.kotlin"
397 }
398 ]
399 },
400 "keyword-constant": {
401 "patterns": [
402 {
403 "match": "\\b(true|false|null|class)\\b",
404 "name": "constant.language.kotlin"
405 },
406 {
407 "match": "\\b(this|super)\\b",
408 "name": "variable.language.kotlin"
409 },
410 {
411 "match": "\\b(0(x|X)[0-9A-Fa-f_]*)[L]?\\b",
412 "name": "constant.numeric.hex.kotlin"
413 },
414 {
415 "match": "\\b(0(b|B)[0-1_]*)[L]?\\b",
416 "name": "constant.numeric.binary.kotlin"
417 },
418 {
419 "match": "\\b([0-9][0-9_]*\\.[0-9][0-9_]*[fFL]?)\\b",
420 "name": "constant.numeric.float.kotlin"
421 },
422 {
423 "match": "\\b([0-9][0-9_]*[fFL]?)\\b",
424 "name": "constant.numeric.integer.kotlin"
425 }
426 ]
427 },
428 "literal-string": {
429 "patterns": [
430 {
431 "begin": "\"",
432 "beginCaptures": {
433 "0": {
434 "name": "punctuation.definition.string.begin.kotlin"
435 }
436 },
437 "end": "\"",
438 "endCaptures": {
439 "0": {
440 "name": "punctuation.definition.string.end.kotlin"
441 }
442 },
443 "name": "string.quoted.double.kotlin",
444 "patterns": [
445 {
446 "include": "#string-content"
447 }
448 ]
449 }
450 ]
451 },
452 "literal-raw-string": {
453 "patterns": [
454 {
455 "begin": "\"\"\"",
456 "beginCaptures": {
457 "0": {
458 "name": "punctuation.definition.string.begin.kotlin"
459 }
460 },
461 "end": "\"\"\"",
462 "endCaptures": {
463 "0": {
464 "name": "punctuation.definition.string.end.kotlin"
465 }
466 },
467 "name": "string.quoted.triple.kotlin",
468 "patterns": [
469 {
470 "include": "#string-content"
471 }
472 ]
473 }
474 ]
475 },
476 "string-content": {
477 "patterns": [
478 {
479 "name": "constant.character.escape.newline.kotlin",
480 "match": "\\\\\\s*\\n"
481 },
482 {
483 "name": "constant.character.escape.kotlin",
484 "match": "\\\\(x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|.)"
485 },
486 {
487 "begin": "(\\$)(\\{)",
488 "beginCaptures": {
489 "1": {
490 "name": "punctuation.definition.keyword.kotlin"
491 },
492 "2": {
493 "name": "punctuation.section.block.begin.kotlin"
494 }
495 },
496 "end": "\\}",
497 "endCaptures": {
498 "0": {
499 "name": "punctuation.section.block.end.kotlin"
500 }
501 },
502 "name": "entity.string.template.element.kotlin",
503 "patterns": [
504 {
505 "include": "#code"
506 }
507 ]
508 }
509 ]
510 },
511 "types": {
512 "patterns": [
513 {
514 "match": "\\b(Nothing|Any|Unit|String|CharSequence|Int|Boolean|Char|Long|Double|Float|Short|Byte|Array|List|Map|Set|dynamic)\\b(\\?)?",
515 "name": "support.class.kotlin"
516 },
517 {
518 "match": "\\b(IntArray|BooleanArray|CharArray|LongArray|DoubleArray|FloatArray|ShortArray|ByteArray)\\b(\\?)?",
519 "name": "support.class.kotlin"
520 },
521 {
522 "match": "((?:[a-zA-Z]\\w*\\.)*[A-Z]+\\w*[a-z]+\\w*)(\\?)",
523 "name": "entity.name.type.class.kotlin",
524 "patterns": [
525 {
526 "include": "#keyword-punctuation"
527 },
528 {
529 "include": "#types"
530 }
531 ]
532 },
533 {
534 "match": "\\b(?:[a-z]\\w*(\\.))*[A-Z]+\\w*\\b",
535 "captures": {
536 "1": {
537 "name": "keyword.operator.dereference.kotlin"
538 }
539 },
540 "name": "entity.name.type.class.kotlin"
541 },
542 {
543 "begin": "\\(",
544 "beginCaptures": {
545 "0": {
546 "name": "punctuation.section.group.begin.kotlin"
547 }
548 },
549 "end": "\\)",
550 "endCaptures": {
551 "0": {
552 "name": "punctuation.section.group.end.kotlin"
553 }
554 },
555 "patterns": [
556 {
557 "include": "#types"
558 }
559 ]
560 },
561 {
562 "include": "#keyword-punctuation"
563 },
564 {
565 "include": "#keyword-operator"
566 }
567 ]
568 },
569 "parens": {
570 "patterns": [
571 {
572 "begin": "\\(",
573 "beginCaptures": {
574 "0": {
575 "name": "punctuation.section.group.begin.kotlin"
576 }
577 },
578 "end": "\\)",
579 "endCaptures": {
580 "0": {
581 "name": "punctuation.section.group.end.kotlin"
582 }
583 },
584 "name": "meta.group.kotlin",
585 "patterns": [
586 {
587 "include": "#keyword-punctuation"
588 },
589 {
590 "include": "#parameters"
591 },
592 {
593 "include": "#code"
594 }
595 ]
596 }
597 ]
598 },
599 "braces": {
600 "patterns": [
601 {
602 "begin": "\\{",
603 "beginCaptures": {
604 "0": {
605 "name": "punctuation.section.group.begin.kotlin"
606 }
607 },
608 "end": "\\}",
609 "endCaptures": {
610 "0": {
611 "name": "punctuation.section.group.end.kotlin"
612 }
613 },
614 "name": "meta.block.kotlin",
615 "patterns": [
616 {
617 "include": "#code"
618 }
619 ]
620 }
621 ]
622 },
623 "brackets": {
624 "patterns": [
625 {
626 "begin": "\\[",
627 "beginCaptures": {
628 "0": {
629 "name": "punctuation.section.brackets.begin.kotlin"
630 }
631 },
632 "end": "\\]",
633 "endCaptures": {
634 "0": {
635 "name": "punctuation.section.brackets.end.kotlin"
636 }
637 },
638 "name": "meta.brackets.kotlin",
639 "patterns": [
640 {
641 "include": "#code"
642 }
643 ]
644 }
645 ]
646 },
647 "code": {
648 "patterns": [
649 {
650 "include": "#comments"
651 },
652 {
653 "include": "#comments-inline"
654 },
655 {
656 "include": "#annotations"
657 },
658 {
659 "include": "#class-literal"
660 },
661 {
662 "include": "#parens"
663 },
664 {
665 "include": "#braces"
666 },
667 {
668 "include": "#brackets"
669 },
670 {
671 "include": "#keyword-literal"
672 },
673 {
674 "include": "#types"
675 },
676 {
677 "include": "#keyword-operator"
678 },
679 {
680 "include": "#keyword-constant"
681 },
682 {
683 "include": "#keyword-punctuation"
684 },
685 {
686 "include": "#builtin-functions"
687 },
688 {
689 "include": "#literal-functions"
690 },
691 {
692 "include": "#builtin-classes"
693 },
694 {
695 "include": "#literal-raw-string"
696 },
697 {
698 "include": "#literal-string"
699 }
700 ]
701 }
702 },
703 "scopeName": "source.kotlin",
704 "uuid": "d9380650-5edc-447d-8dbd-98838c7d0adf"
705 }
706