Skip to content

Commit

Permalink
Merge pull request #10 from wawandco/fix-syntax
Browse files Browse the repository at this point in the history
[FIX]: Adding parameter Highlighting and fixing single quote Issue
  • Loading branch information
paganotoni authored Nov 25, 2022
2 parents 68da6f8 + e90a4c4 commit 1ff071a
Show file tree
Hide file tree
Showing 3 changed files with 228 additions and 25 deletions.
19 changes: 16 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Visho",
"publisher": "wawandco-tools",
"description": "A plush extension for VScode",
"version": "main",
"version": "0.0.1",
"icon": "assets/visho.png",
"repository": {
"type": "git",
Expand Down Expand Up @@ -52,6 +52,19 @@
"application/xhtml+xml"
],
"configuration": "./language-configuration.json"
,
"configurationDefaults": {
"plush": {
"editor.semanticHighlighting.enabled": true
}
}
}
],
"commands":[
{
"command": "visho.hello",
"title": "Hello",
"enablement": "true"
}
],
"grammars": [
Expand All @@ -60,12 +73,12 @@
"scopeName": "text.html.plush",
"path": "./syntaxes/plush.tmLanguage.json",
"embeddedLanguages": {
"text.html meta.embedded.block.html meta.tag": "html",
"source.html": "html",
"source.css": "css",
"source.js": "javascript"
},
"tokenTypes": {
"meta.tag string.quoted": "other"
"meta.tag": "other"
}
}
]
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export function activate(context: vscode.ExtensionContext) {
// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
let disposable = vscode.commands.registerCommand('visho.helloWorld', () => {
let disposable = vscode.commands.registerCommand('visho.hello', () => {
// The code you place here will be executed every time your command is executed
// Display a message box to the user
vscode.window.showInformationMessage('Hello World from Visho!');
vscode.window.showInformationMessage('Hello from Visho!');
});

context.subscriptions.push(disposable);
}


Expand Down
228 changes: 209 additions & 19 deletions syntaxes/plush.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,23 @@
{
"include": "#keyword"
},
{
"include": "#function"
},
{
"include": "#operator"
},
{
"include": "text.html.basic"
},
{
"include": "#strings"
},
{
"include": "#variable"
},
{
"include": "boolean"
}
]
},
Expand All @@ -100,11 +112,18 @@
"name": "keyword.plush"
},
{
"match": "(?i)(true|false)",
"name": "markup.italic.plush"
},
{
"begin": "\"",
"match": "\b[0-9]\b",
"name": "constant.numeric.plush"
}
]
},
"boolean":{
"match": "(?i)(true|false)",
"name": "markup.italic.plush"
},
"strings":{
"patterns": [
{ "begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.plush"
Expand Down Expand Up @@ -147,25 +166,86 @@
}
},
"name": "string.quoted.other.plush"
},
{
"match": "\b[0-9]\b",
"name": "constant.numeric.plush"
},
}
]
},
"function":{
"name":"meta.function.method.with-arguments.plush",
"patterns": [
{
"match": "[A-Za-z0-9_-]+(\\()",
"captures": {
"0": {
"name": "entity.name.function.plush"
"begin": "(\\\\)?(?<![a-zA-Z0-9_\\x{7f}-\\x{10ffff}])([a-zA-Z_\\x{7f}-\\x{10ffff}][a-zA-Z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(\\()",
"beginCaptures": {
"1": {
"patterns": [
]
},
"2": {
"patterns": [
{
"match": "(?i)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*",
"name": "entity.name.function.plush"
}
]
},
"3": {
"name": "punctuation.definition.arguments.begin.bracket.round.plush",
"patterns": [
{
"include": "#parens"
},
{
"include": "#braces"
},
{
"include": "#named-arguments"
}
]
}
},
"end": "\\)|(?=\\?>)",
"endCaptures": {
"0": {
"name": "punctuation.definition.arguments.end.bracket.round.plush"
}
},
"patterns": [
{
"include": "#named-arguments"
},
{
"include": "#strings"
},
"1": {
"name": "punctuation.bracket.plush"
{
"include": "#variable"
},
{
"include": "$self"
},
{
"include": "boolean"
},
{
"include": "#operator"
}
}
]
},
{
"include": "#named-arguments"
},
{
"match": "\b[A-Za-z0-9_-]\b",
"name": "meta.parameter.type.variable",
"include": "meta.function.method.with-arguments.plush"
}
]
},
"variable":{
"patterns": [
{
"match": "([_$[:alpha:]][_$[:alnum:]]*)",
"name": "variable.name.plush"
},
{
"include": "#boolean"
}
]
},
Expand All @@ -180,6 +260,116 @@
"name":"keyword.operator.new.plush"
}
]
}
},
"parens": {
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.section.function.begin.plush"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.section.function.end.plush"
}
},
"patterns": [
{
"include": "#named-arguments"
},
{
"include": "#braces"
},
{
"include": "$self"
}
]
},
"braces": {
"begin": "\\{",
"beginCaptures": {
"0": {
"name": "punctuation.section.function.begin.plush"
}
},
"end": "\\}",
"endCaptures": {
"0": {
"name": "punctuation.section.function.end.plush"
}
},
"patterns": [
{
"include": "#parens"
},
{
"include": "#named-arguments"
},
{
"include": "$self"
}
]
},
"brackets": {
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "punctuation.section.function.begin.plush"
}
},
"end": "\\]",
"endCaptures": {
"0": {
"name": "punctuation.section.function.end.plush"
}
},
"patterns": [
{
"include": "#braces"
},
{
"include": "#parens"
},
{
"include": "#named-arguments"
},
{
"include": "$self"
}
]
},
"named-arguments": {
"match": "(?i)(?<=|\\(|,)\\s*([A-Za-z0-9_-]*)\\s*(:)(?!:)\\s*([A-Za-z0-9_-]*)",
"captures": {
"1": {
"name": "entity.other.attribute-name"
},
"2": {
"name": "punctuation.separator.colon.plush"
},
"3": {
"name": "variable.parameter.plush",
"patterns": [
{
"include": "#function"
},
{
"include": "#variable"
},
{
"include": "#keyword"
},
{
"include": "#operator"
},
{
"include": "boolean"
}
]
}
}

}
}
}

0 comments on commit 1ff071a

Please sign in to comment.