Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lachieh committed Jul 16, 2018
0 parents commit ea7673b
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Set default behavior to automatically normalize line endings.
* text=auto

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
*.vsix
.DS_Store
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Change Log
All notable changes to the "perch-language-support" extension will be documented in this file.

## 1.0.0
- Initial release
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Perch Language Support

This package adds support for perch template tags inside of HTML files.

## Features

Feel free to suggest other improvements and suggestions. Pull Requests for bugs, improvements and features are welcome.

* [x] Language Support inside of HTML files.
* [ ] Add Snippets
* [ ] Disable JS linter while inside the `source.perch` scope.
* [ ] Intellisense
* [ ] Hover to see docs for built-in tags
* [ ] Validators for built-in tags

## Known Issues

This scope works inside of embedded script tags (i.e. `<script>`), though the [js] linter gets confused about syntax inside them.

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release release
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "perch-language-support",
"displayName": "Perch Language Support",
"description": "Language Support for the Perch CMS Template files",
"version": "0.0.1",
"publisher": "lachieh",
"engines": {
"vscode": "^1.25.0"
},
"categories": [
"Programming Languages",
"Snippets"
],
"contributes": {
"grammars": [{
"scopeName": "text.html.perch",
"injectTo": [ "text.html.basic" ],
"path": "./syntaxes/perch.tmLanguage.json"
}]
}
}
198 changes: 198 additions & 0 deletions syntaxes/perch.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Perch Template",
"injectionSelector": "L:text.html.basic, source.js",
"scopeName": "text.html.perch",
"patterns": [
{
"name": "source.perch",
"begin": "(</?perch:)([A-Za-z-]+)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html.perch"
},
"2": {
"name": "entity.name.tag.block.any.html.perch"
}
},
"end": "(/?>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html.perch"
}
},
"patterns": [
{
"include": "#tag-stuff"
}
]
}
],
"repository": {
"entities": {
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.entity.html.perch"
},
"3": {
"name": "punctuation.definition.entity.html.perch"
}
},
"match": "(&)([a-zA-Z0-9]+|#[0-9]+|#[xX][0-9a-fA-F]+)(;)",
"name": "constant.character.entity.html.perch"
},
{
"match": "&",
"name": "invalid.illegal.bad-ampersand.html.perch"
}
]
},
"string-double-quoted": {
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.html.perch"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.html.perch"
}
},
"name": "string.quoted.double.html.perch",
"patterns": [
{
"include": "#entities"
}
]
},
"string-single-quoted": {
"begin": "'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.html.perch"
}
},
"end": "'",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.html.perch"
}
},
"name": "string.quoted.single.html.perch",
"patterns": [
{
"include": "#entities"
}
]
},
"tag-generic-attribute": {
"patterns": [{
"match": "(?<=[^=])\\b([a-zA-Z0-9:-]+)",
"name": "entity.other.attribute-name.html.perch"
}]
},
"tag-id-attribute": {
"begin": "\\b(id)\\b\\s*(=)",
"captures": {
"1": {
"name": "entity.other.attribute-name.id.html.perch"
},
"2": {
"name": "punctuation.separator.key-value.html.perch"
}
},
"end": "(?!\\G)(?<='|\"|[^\\s<>/])",
"name": "meta.attribute-with-value.id.html.perch",
"patterns": [
{
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.html.perch"
}
},
"contentName": "meta.toc-list.id.html.perch",
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.html.perch"
}
},
"name": "string.quoted.double.html.perch",
"patterns": [
{
"include": "#embedded-code"
},
{
"include": "#entities"
}
]
},
{
"begin": "'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.html.perch"
}
},
"contentName": "meta.toc-list.id.html.perch",
"end": "'",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.html.perch"
}
},
"name": "string.quoted.single.html.perch",
"patterns": [
{
"include": "#embedded-code"
},
{
"include": "#entities"
}
]
},
{
"captures": {
"0": {
"name": "meta.toc-list.id.html.perch"
}
},
"match": "(?<==)(?:[^\\s<>/'\"]|/(?!>))+",
"name": "string.unquoted.html.perch"
}
]
},
"tag-stuff": {
"patterns": [
{
"include": "#tag-id-attribute"
},
{
"include": "#tag-generic-attribute"
},
{
"include": "#string-double-quoted"
},
{
"include": "#string-single-quoted"
},
{
"include": "#unquoted-attribute"
}
]
},
"unquoted-attribute": {
"patterns": [
{
"match": "(?<==)(?:[^\\s<>/'\"]|/(?!>))+",
"name": "string.unquoted.html.perch"
}
]
}
}
}

0 comments on commit ea7673b

Please sign in to comment.