Skip to content

Commit

Permalink
Fix inconsistant syntax tokens (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
znck committed Oct 20, 2022
1 parent 4675185 commit e7bdf73
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 40 deletions.
1 change: 1 addition & 0 deletions extensions/vscode-vue/demo/samples/Example1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<div />
<web-component />
<VueComponent />
<Vue.Component />

Attributes:
<div attr="value" />
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode-vue/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ for embedding Vue template DSL in markdown.
## Creating Themes

This extension provides detailed token and scope information which can be
used to create better VS Code themes. Find more details on [project wiki](https://github.com/znck/vue-developer-experience/wiki/Theme-Guide).
used to create better VS Code themes. Find more details in [docs](https://vuedx.com/guide/creating-vscode-themes).

## How to get help

Expand Down
75 changes: 37 additions & 38 deletions extensions/vscode-vue/syntaxes/vue-html.tmLanguage.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RegExp
# buitldin directive: v-(text|html|show|if|else|else-if|for|on|bind|model|slot|pre|once|cloak)
# builtin directive: v-(text|html|show|if|else|else-if|for|on|bind|model|slot|pre|once|cloak)

name: Vue HTML
scopeName: text.html.vue-html
Expand Down Expand Up @@ -127,19 +127,18 @@ repository:
patterns:
- match: ({{[\s]*}})
name: invalid.illegal.interpolation.missing-expression.vue-html
- name: meta.interpolation
- name: meta.interpolation.vue-html
begin: ({{)
end: (}})
beginCaptures:
1: { name: punctuation.definition.tag.interpolation.begin.vue-html }
endCaptures:
1: { name: punctuation.definition.tag.interpolation.end.vue-html }
patterns:
- name: meta.embedded.source.expression.js
include: source.js#expression
- name: meta.embedded.source.expression.ts
include: source.ts#expression

directive:
name: meta.directive.vue-html
patterns:
- include: '#invalid-directive-missing-value'
- include: '#invalid-directive-unexpected-value'
Expand All @@ -159,7 +158,7 @@ repository:
name: invalid.illegal.directive.missing-value.vue-html
match: v-(text|html|show|if|else-if|for|on|bind|model)(?=[\s\/>])

invalid-directive-unxepected-value:
invalid-directive-unexpected-value:
name: invalid.illegal.directive.missing-value.vue-html
match: v-(pre|once|cloak|else)(=)(("[^"]*")|('[^']*')|([^\s\/>]))*

Expand Down Expand Up @@ -195,15 +194,15 @@ repository:

directive-builtin-conditionals:
patterns:
- name: meta.directive.$2.vue-html
- name: meta.directive.$3.vue-html
begin: ((v-)(if|else-if))(=)
end: (?=[\s\/>])
beginCaptures:
0: { name: support.other.directive.builtin.vue-html }
1: { name: keyword.control.conditional.vue-html }
2: { name: punctuation.definition.directive.prefix.vue-html }
3: { name: entity.name.directive.vue-html }
4: { name: punctuation.separater.key-value.vue-html }
4: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'
- name: meta.directive.else.vue-html
Expand All @@ -224,12 +223,11 @@ repository:
1: { name: keyword.control.loop.vue-html }
2: { name: punctuation.definition.directive.prefix.vue-html }
3: { name: entity.name.directive.vue-html }
4: { name: punctuation.separater.key-value.vue-html }
4: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'

directive-builtin-bind:
name: meta.directive.bind.vue-html
patterns:
- name: meta.directive.bind.shorthand.vue-html
begin: ([:.^])
Expand All @@ -243,10 +241,11 @@ repository:
- begin: (=)
end: (?=[\s\/>])
beginCaptures:
1: { name: punctuation.separater.key-value.vue-html }
1: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'
- begin: ((v-)(bind))
- name: meta.directive.bind.vue-html
begin: ((v-)(bind))
end: (?=[\s\/>])|(?<=["'])
beginCaptures:
0: { name: support.other.directive.builtin.vue-html }
Expand All @@ -258,7 +257,7 @@ repository:
- begin: (=)
end: (?=[\s\/>])
beginCaptures:
1: { name: punctuation.separater.key-value.vue-html }
1: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'
- begin: (:)
Expand All @@ -270,7 +269,6 @@ repository:
- include: '#directive-argument'

directive-builtin-on:
name: meta.directive.on.vue-html
patterns:
- name: meta.directive.on.shorthand.vue-html
begin: (@)
Expand All @@ -284,10 +282,11 @@ repository:
- begin: (=)
end: (?=[\s\/>])
beginCaptures:
1: { name: punctuation.separater.key-value.vue-html }
1: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'
- begin: ((v-)(on))
- name: meta.directive.on.vue-html
begin: ((v-)(on))
end: (?=[\s\/>])|(?<=["'])
beginCaptures:
0: { name: support.other.directive.builtin.vue-html }
Expand All @@ -299,7 +298,7 @@ repository:
- begin: (=)
end: (?=[\s\/>])
beginCaptures:
1: { name: punctuation.separater.key-value.vue-html }
1: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'
- begin: (:)
Expand All @@ -311,7 +310,6 @@ repository:
- include: '#directive-argument'

directive-builtin-slot:
name: meta.directive.slot.vue-html
patterns:
- name: meta.directive.slot.shorthand.vue-html
begin: (#)
Expand All @@ -324,10 +322,11 @@ repository:
- begin: (=)
end: (?=[\s\/>])
beginCaptures:
1: { name: punctuation.separater.key-value.vue-html }
1: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'
- begin: ((v-)(slot))
- name: meta.directive.slot.vue-html
begin: ((v-)(slot))
end: (?=[\s\/>])|(?<=["'])
beginCaptures:
0: { name: support.other.directive.builtin.vue-html }
Expand All @@ -338,7 +337,7 @@ repository:
- begin: (=)
end: (?=[\s\/>])
beginCaptures:
1: { name: punctuation.separater.key-value.vue-html }
1: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-expression'
- begin: (:)
Expand All @@ -350,9 +349,9 @@ repository:
- include: '#directive-argument'

directive-builtin-model:
name: meta.directive.model.vue-html
patterns:
- begin: ((v-)(model))
- name: meta.directive.model.vue-html
begin: ((v-)(model))
end: (?=[\s\/>])|(?<=["'])
beginCaptures:
0: { name: support.other.directive.builtin.vue-html }
Expand Down Expand Up @@ -381,7 +380,7 @@ repository:
0: { name: support.other.directive.builtin.vue-html }
1: { name: punctuation.definition.directive.prefix.vue-html }
2: { name: entity.name.directive.vue-html }
3: { name: punctuation.separater.key-value.vue-html }
3: { name: punctuation.separator.key-value.vue-html }
patterns:
- include: '#directive-modifier'
- begin: (=)
Expand Down Expand Up @@ -420,33 +419,33 @@ repository:

directive-modifier:
patterns:
- name: meta.directive.modifier.vue-html
- name: meta.directive-modifier.vue-html
match: (\.)([^.\/>=\s]+)
captures:
0: { name: meta.directive.modifier.$2.vue-html }
0: { name: meta.directive-modifier.$2.vue-html }
1:
name: punctuation.definition.tag.directive.modifier.begin.vue-html
2: { name: variable.other.directive.modifier.vue-html }

directive-argument:
patterns:
- name: meta.directive.dynamic-argument.vue-html
- name: meta.directive-argument.vue-html
begin: (\[)
end: (\])
beginCaptures:
0: { name: meta.brace.square.vue-html }
1:
name: punctuation.definition.tag.directive.dynamic-argument.begin.vue-html
name: punctuation.definition.tag.directive-argument.begin.vue-html
endCaptures:
0: { name: meta.brace.square.vue-html }
1:
name: punctuation.definition.tag.directive.dynamic-argument.end.vue-html
name: punctuation.definition.tag.directive-argument.end.vue-html
patterns:
- name: meta.embedded.source.expression.js
- name: meta.embedded.source.expression.ts
while: (?=[^\]])
include: source.js#expression
include: source.ts#expression
- match: (?i)([a-z0-9-]+)
name: meta.directive.argument.vue-html
name: meta.directive-argument.vue-html
captures:
0: { name: variable.other.directive.argument.vue-html }

Expand All @@ -462,9 +461,9 @@ repository:
endCaptures:
1: { name: punctuation.definition.string.quoted.double.end.vue-html }
patterns:
- name: meta.embedded.source.expression.js
- name: meta.embedded.source.expression.ts
while: (?=[^"])
include: source.js#expression
include: source.ts#expression
- begin: (')
end: (')
beginCaptures:
Expand All @@ -473,25 +472,25 @@ repository:
endCaptures:
1: { name: punctuation.definition.string.single.double.end.vue-html }
patterns:
- name: meta.embedded.source.expression.js
- name: meta.embedded.source.expression.ts
while: (?=[^'])
include: source.js#expression
include: source.ts#expression

attribute:
patterns:
- name: meta.attribute.$1.vue-html
begin: (?<=[^=])\b([a-zA-Z0-9:_-]+)(=)(?=["'])
beginCaptures:
1: { name: entity.other.attribute-name.vue-html }
2: { name: punctuation.separater.key-value.vue-html }
2: { name: punctuation.separator.key-value.vue-html }
end: (?=\4[\s/>])
patterns:
- { include: '#string' }
- name: meta.attribute.$1.vue-html
match: (?<=[^=])\b([a-zA-Z0-9:_-]+)(=)([^\s\f\0"'`<>]+)
captures:
1: { name: entity.other.attribute-name.vue-html }
2: { name: punctuation.separater.key-value.vue-html }
2: { name: punctuation.separator.key-value.vue-html }
3: { name: string.unquoted.vue-html }
- name: meta.attribute.$1.vue-html
match: (?<=[^=])\b([a-zA-Z0-9:_-]+)\b
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A set of tools for better developer experience aka Vue Developer Experience or V

## Getting Started

To start using VueDX, install one of the follwing extensions:
To start using VueDX, install one of the following extensions:

- Visual Studio Code
- [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=znck.vue-language-features)
Expand Down

0 comments on commit e7bdf73

Please sign in to comment.