|
| 1 | +%YAML 1.2 |
| 2 | +--- |
| 3 | +name: Vue Component |
| 4 | +file_extensions: [vue] |
| 5 | +scope: text.html.vue |
| 6 | + |
| 7 | +contexts: |
| 8 | + main: |
| 9 | + - match: '<!--' |
| 10 | + scope: punctuation.definition.comment.begin.html |
| 11 | + push: |
| 12 | + - meta_scope: comment.block.html |
| 13 | + - match: "-->" |
| 14 | + scope: punctuation.definition.comment.begin.html |
| 15 | + pop: true |
| 16 | + |
| 17 | + - include: template_langs |
| 18 | + - match: '(<)(template).*(>)' |
| 19 | + captures: |
| 20 | + 1: punctuation.definition.tag.begin.html |
| 21 | + 2: entity.name.tag.custom.html |
| 22 | + 3: punctuation.definition.tag.begin.html |
| 23 | + push: 'scope:text.html.basic' |
| 24 | + with_prototype: |
| 25 | + - match: '(</)(template).*(>)' |
| 26 | + captures: |
| 27 | + 1: punctuation.definition.tag.begin.html |
| 28 | + 2: entity.name.tag.custom.html |
| 29 | + 3: punctuation.definition.tag.begin.html |
| 30 | + pop: true |
| 31 | + - include: template_content |
| 32 | + - include: scripts |
| 33 | + - include: styles |
| 34 | + |
| 35 | + template_langs: |
| 36 | + - match: (<)(template)\b[^>]*(lang)\s*=\s*([\'\"]pug[\'\"])\s*.*(>) |
| 37 | + captures: |
| 38 | + 1: punctuation.definition.tag.begin.html |
| 39 | + 2: entity.name.tag.script.html |
| 40 | + 3: entity.other.attribute-name.html |
| 41 | + 4: string.quoted.double.html |
| 42 | + 5: meta.tag.script.end.html |
| 43 | + embed: scope:text.pug |
| 44 | + escape: (</)(template)(>) |
| 45 | + escape_captures: |
| 46 | + 1: punctuation.definition.tag.begin.html |
| 47 | + 2: entity.name.tag.script.html |
| 48 | + 3: meta.tag.script.end.html |
| 49 | + |
| 50 | + template_content: |
| 51 | + - match: (?:^|\s+)(v-\S+|:\S+|@\S+)\b\s*(=)\s*(")\s* |
| 52 | + captures: |
| 53 | + 1: entity.other.attribute-name.event.html |
| 54 | + 2: punctuation.separator.key-value.html |
| 55 | + 3: punctuation.definition.string.begin.html string.quoted.double.html |
| 56 | + push: |
| 57 | + - match: '"' |
| 58 | + scope: punctuation.definition.string.end.html string.quoted.double.html |
| 59 | + pop: true |
| 60 | + - include: scope:source.js |
| 61 | + - match: '{{' |
| 62 | + embed: 'scope:source.js' |
| 63 | + escape: '}}' |
| 64 | + |
| 65 | + scripts: |
| 66 | + - match: (<)(script)\b[^>]*(lang)\s*=\s*([\'\"]coffee[\'\"])\s*.*(>) |
| 67 | + captures: |
| 68 | + 1: punctuation.definition.tag.begin.html |
| 69 | + 2: entity.name.tag.script.html |
| 70 | + 3: entity.other.attribute-name.html |
| 71 | + 4: string.quoted.double.html |
| 72 | + 5: meta.tag.script.end.html |
| 73 | + embed: scope:source.coffee |
| 74 | + escape: (</)(script)(>) |
| 75 | + escape_captures: |
| 76 | + 1: punctuation.definition.tag.begin.html |
| 77 | + 2: entity.name.tag.script.html |
| 78 | + 3: meta.tag.script.end.html |
| 79 | + # If no lang is set, fall back to js |
| 80 | + - match: (<)(script).*(>) |
| 81 | + captures: |
| 82 | + 1: punctuation.definition.tag.begin.html |
| 83 | + 2: entity.name.tag.script.html |
| 84 | + 3: entity.other.attribute-name.html |
| 85 | + 4: string.quoted.double.html |
| 86 | + 5: meta.tag.script.end.html |
| 87 | + embed: scope:source.js |
| 88 | + escape: (</)(script)(>) |
| 89 | + escape_captures: |
| 90 | + 1: punctuation.definition.tag.begin.html |
| 91 | + 2: entity.name.tag.script.html |
| 92 | + 3: meta.tag.script.end.html |
| 93 | + |
| 94 | + styles: |
| 95 | + - match: (<)(style)\b[^>]*(lang)\s*=\s*([\'\"]stylus[\'\"])\s*.*(>) |
| 96 | + captures: |
| 97 | + 1: punctuation.definition.tag.begin.html |
| 98 | + 2: entity.name.tag.script.html |
| 99 | + 3: entity.other.attribute-name.html |
| 100 | + 4: string.quoted.double.html |
| 101 | + 5: meta.tag.script.end.html |
| 102 | + embed: scope:source.stylus |
| 103 | + escape: (</)(style).*(>) |
| 104 | + escape_captures: |
| 105 | + 1: punctuation.definition.tag.begin.html |
| 106 | + 2: entity.name.tag.script.html |
| 107 | + 3: meta.tag.script.end.html |
| 108 | + - match: (<)(style)\b[^>]*(lang)\s*=\s*([\'\"]sass[\'\"])\s*.*(>) |
| 109 | + captures: |
| 110 | + 1: punctuation.definition.tag.begin.html |
| 111 | + 2: entity.name.tag.script.html |
| 112 | + 3: entity.other.attribute-name.html |
| 113 | + 4: string.quoted.double.html |
| 114 | + 5: meta.tag.script.end.html |
| 115 | + embed: scope:source.sass |
| 116 | + escape: (</)(style).*(>) |
| 117 | + escape_captures: |
| 118 | + 1: punctuation.definition.tag.begin.html |
| 119 | + 2: entity.name.tag.script.html |
| 120 | + 3: meta.tag.script.end.html |
| 121 | + - match: (<)(style)\b[^>]*(lang)\s*=\s*([\'\"]scss[\'\"])\s*.*(>) |
| 122 | + captures: |
| 123 | + 1: punctuation.definition.tag.begin.html |
| 124 | + 2: entity.name.tag.script.html |
| 125 | + 3: entity.other.attribute-name.html |
| 126 | + 4: string.quoted.double.html |
| 127 | + 5: meta.tag.script.end.html |
| 128 | + embed: scope:source.scss |
| 129 | + escape: (</)(style).*(>) |
| 130 | + escape_captures: |
| 131 | + 1: punctuation.definition.tag.begin.html |
| 132 | + 2: entity.name.tag.script.html |
| 133 | + 3: meta.tag.script.end.html |
| 134 | + - match: (<)(style).*(>) |
| 135 | + captures: |
| 136 | + 1: punctuation.definition.tag.begin.html |
| 137 | + 2: entity.name.tag.script.html |
| 138 | + 3: meta.tag.script.end.html |
| 139 | + embed: scope:source.css |
| 140 | + escape: (</)(style).*(>) |
| 141 | + escape_captures: |
| 142 | + 1: punctuation.definition.tag.begin.html |
| 143 | + 2: entity.name.tag.script.html |
| 144 | + 3: meta.tag.script.end.html |
| 145 | + |
| 146 | + |
| 147 | + |
0 commit comments