Skip to content

Commit

Permalink
Merge pull request vuejs#2404 from Antti/add-slim-support
Browse files Browse the repository at this point in the history
Add slim syntax highlighting
  • Loading branch information
octref authored Oct 30, 2020
2 parents 13a28f0 + 69f0a65 commit b624efb
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- 🙌 Add `vti version` command. Thanks to contribution from [@andrewisaburden](https://github.com/andrewisaburden). #2337.
- 🙌 Complete with `?.` for optional properies in completion. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2326 and #2357.
- 🙌 Respect typescript language settings. Thanks to contribution from [@yoyo930021](https://github.com/yoyo930021). #2109 and #2375.
- 🙌 Slim syntax highlighting. Thanks to contribution from [@Antti](https://github.com/Antti).

### 0.28.0 | 2020-09-23 | [VSIX](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/octref/vsextensions/vetur/0.28.0/vspackage)

Expand Down
1 change: 1 addition & 0 deletions client/grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const SCOPES: { [lang: string]: string } = {
html: 'text.html.basic',
pug: 'text.pug',
haml: 'text.haml',
slim: 'text.slim',
css: 'source.css',
scss: 'source.css.scss',
less: 'source.css.less',
Expand Down
1 change: 1 addition & 0 deletions docs/highlighting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Vetur supports syntax highlighting for the following languages:
| `<template lang="jade">` | `pug` |
| `<template lang="haml">` | `haml` | [Better Haml](https://marketplace.visualstudio.com/items?itemName=karunamurti.haml) or [Ruby Haml](https://marketplace.visualstudio.com/items?itemName=vayan.haml) |
| `<template lang="slm">` | `slm` | [Slm Syntax](https://marketplace.visualstudio.com/items?itemName=mrmlnc.vscode-slm) |
| `<template lang="slim">` | `slim` | [Slim](https://marketplace.visualstudio.com/items?itemName=sianglim.slim) |
| `<style>` | `css` |
| `<style lang="postcss">` | `postcss` |
| `<style lang="scss">` | `scss` |
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
"text.jade.slm": "slm",
"text.pug": "jade",
"text.haml": "haml",
"text.slim": "slim",
"text.html.liquid": "liquid",
"source.css": "css",
"source.css.scss": "scss",
Expand Down
86 changes: 86 additions & 0 deletions syntaxes/vue-generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,49 @@
],
"uuid": "5512c10d-4cc5-434c-b8fc-53b912f55ab3",
"patterns": [
{
"begin": "(<)(slim)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.style.html"
}
},
"end": "(</)(slim)(>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.style.html"
},
"3": {
"name": "punctuation.definition.tag.end.html"
}
},
"patterns": [
{
"include": "#tag-stuff"
},
{
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=</slim>)",
"contentName": "text.slim",
"patterns": [
{
"include": "text.slim"
}
]
}
]
},
{
"begin": "(<)(i18n)",
"beginCaptures": {
Expand Down Expand Up @@ -255,6 +298,49 @@
}
]
},
{
"begin": "(<)(template)\\b(?=[^>]*lang=('slim'|\"slim\"))(?![^/>]*/>\\s*$)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.template.html"
}
},
"end": "(</)(template)(>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.template.html"
},
"3": {
"name": "punctuation.definition.tag.end.html"
}
},
"patterns": [
{
"include": "#tag-stuff"
},
{
"contentName": "text.slim",
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=</template>)",
"patterns": [
{
"include": "text.slim"
}
]
}
]
},
{
"begin": "(<)(template)\\b(?=[^>]*lang=('slm'|\"slm\"))(?![^/>]*/>\\s*$)",
"beginCaptures": {
Expand Down
43 changes: 43 additions & 0 deletions syntaxes/vue.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,49 @@
}
]
},
{
"begin": "(<)(template)\\b(?=[^>]*lang=('slim'|\"slim\"))(?![^/>]*/>\\s*$)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.template.html"
}
},
"end": "(</)(template)(>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.template.html"
},
"3": {
"name": "punctuation.definition.tag.end.html"
}
},
"patterns": [
{
"include": "#tag-stuff"
},
{
"contentName": "text.slim",
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=</template>)",
"patterns": [
{
"include": "text.slim"
}
]
}
]
},
{
"begin": "(<)(template)\\b(?=[^>]*lang=('slm'|\"slm\"))(?![^/>]*/>\\s*$)",
"beginCaptures": {
Expand Down
20 changes: 20 additions & 0 deletions syntaxes/vue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ patterns:
patterns:
- include: text.haml

# slim
- begin: (<)(template)\b(?=[^>]*lang=('slim'|"slim"))(?![^/>]*/>\s*$)
beginCaptures:
'1': { name: punctuation.definition.tag.begin.html }
'2': { name: entity.name.tag.template.html }
end: (</)(template)(>)
endCaptures:
'1': { name: punctuation.definition.tag.begin.html }
'2': { name: entity.name.tag.template.html }
'3': { name: punctuation.definition.tag.end.html }
patterns:
- include: '#tag-stuff'
- contentName: text.slim
begin: (>)
beginCaptures:
'1': { name: punctuation.definition.tag.end.html }
end: (?=</template>)
patterns:
- include: text.slim

# slm
- begin: (<)(template)\b(?=[^>]*lang=('slm'|"slm"))(?![^/>]*/>\s*$)
beginCaptures:
Expand Down

0 comments on commit b624efb

Please sign in to comment.