From 9e0f8013438ae0ff5eb08f93ba1c1f8802320250 Mon Sep 17 00:00:00 2001 From: Nixinova Date: Mon, 1 Jun 2020 20:01:17 +1200 Subject: [PATCH] 1.2.0 --- .gitignore | 1 + .vscodeignore | 1 + CHANGELOG.md | 10 +++ README.md | 2 +- package.json | 2 +- syntaxes/novasheets.tmLanguage.json | 125 +++++++++++++++++++++------- 6 files changed, 109 insertions(+), 32 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b6103a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +colors.txt \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore index 19bbe78..f5be647 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,3 +1,4 @@ .vscode/** .vscode-test/** .gitignore +colors.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index e4a8c8c..4dd3316 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 1.2.0 +- Added argument syntax highlighting. +- Added error checking for illegal characters. +- Added syntax highlighting for CSS at-rules and `!important`. +- Changed color of variable declarator `@var`. +- Changed internal code to be more semantically correct. +- Changed string parsing to include the quotes in the syntax highlighting. +- Removed numeric syntax highlighting. +- Fixed string parsing allowing alternating quotation marks. + ## 1.1.1 - Fixed syntax highlighting of comments appearing as variable contents. - Fixed function and has color syntax highlighting. diff --git a/README.md b/README.md index 389de9d..ad18429 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is a [VSCode](https://github.com/microsoft/vscode) extension for [NovaSheet - Syntax highlighting for NovaSheet syntax, including NovaSheets variables and comments as well as CSS content. # Installation -Search "NovaSheets" in the VSCode Marketplace ([direct link](https://marketplace.visualstudio.com/items?itemName=Nixinova.novasheets)), then click "Install". +This extension is available in the [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=Nixinova.novasheets). # Usage Just load a `.nss` or `.nss.txt` file in VSCode and NovaSheets syntax highlighting should occur. diff --git a/package.json b/package.json index 3e564e6..f89c88d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Syntax highligher for NovaSheet files", "publisher": "Nixinova", "repository": "NovaSheets-vscode", - "version": "1.1.1", + "version": "1.2.0", "engines": { "vscode": "^1.45.0" }, diff --git a/syntaxes/novasheets.tmLanguage.json b/syntaxes/novasheets.tmLanguage.json index 5389eae..e85c5f4 100644 --- a/syntaxes/novasheets.tmLanguage.json +++ b/syntaxes/novasheets.tmLanguage.json @@ -4,61 +4,107 @@ "scopeName": "source.nss", "patterns": [ { - "include": "#keywords" + "include": "#variables" + }, + { + "include": "#seperator" + }, + { + "include": "#comments" + }, + { + "include": "#css" + }, + { + "include": "#patterns" } ], "repository": { - "keywords": { + "variables": { "patterns": [ { - "match": "^\\s*(@var)\\s(.+?)(\\s//.+|)$", + "match": "^\\s*(@var)\\s([^\\]=)]+?)(\\|[^\\]=)]+?)?(\\s//.+|)$", "captures": { "1": { - "name": "keyword.control.at-rule.media.css" + "name": "keyword.variable.declarator" }, "2": { - "name": "keyword.other.unit.css" + "name": "keyword.other.unit.variable.nsss" }, "3": { - "name": "comment.block.css" + "name": "keyword.control.variable.attribute.nss" + }, + "4": { + "name": "comment.inline.nss" } } }, { - "match": "(\\$\\()(.+?)(?:(\\s//.+$)|(\\)))", + "match": "(\\$\\()(.+?)(\\|.*?)?(?:(\\s//.+$)|(\\)))", "captures": { "1": { - "name": "entity.name.tag.wildcard.css" + "name": "keyword.variable.substitutor.nss" }, "2": { - "name": "keyword.other.unit.css" + "name": "keyword.other.unit.variable.nss" }, "3": { - "name": "comment.block.css" + "name": "keyword.control.variable.attribute.nss" }, "4": { - "name": "entity.name.tag.wildcard.css" + "name": "comment.inline.nss" + }, + "5": { + "name": "keyword.variable.substitutor.nss" } } }, + { + "match": "(\\$\\[)(.+?)(\\|.*?)?(?:(\\s//.+$)|(\\]))", + "captures": { + "1": { + "name": "keyword.variable.substitutor.nss" + }, + "2": { + "name": "keyword.control.variable.attribute.nss" + }, + "3": { + "name": "invalid.illegal.nss" + }, + "4": { + "name": "comment.inline.nss" + }, + "5": { + "name": "keyword.variable.substitutor.nss" + } + } + } + ] + }, + "separator": { + "patterns": [ { "match": "\\s*---\\s*", - "name": "header" - }, + "name": "header.seperator.nss" + } + ] + }, + "comments": { + "patterns": [ { "match": "(\\s|^)//.+$", - "name": "comment.block.css" + "name": "comment.inline.nss" }, { "match": "/\\*.+\\*/", "name": "comment.block.css" - }, - { - "match": "[0-9]+", - "name": "constant.numeric.css" - }, + } + ] + }, + "css": { + "patterns": [ { - "match": "(.+){", + "match": "([^@][^{}]*){", "captures": { "1": { "name": "entity.other.attribute-name.class.css" @@ -66,32 +112,51 @@ } }, { - "match": "([a-z-]+):", + "match": "([a-z-]+?([^a-z-; ]*?)[a-z-]+?[^\\\\]):", "captures": { "1": { "name": "support.type.property-name.css" + }, + "2": { + "name": "invalid.illegal.css" } } }, { - "match": "(?:\\\"|')(.+)?(?:\\\"|')", + "match": "([a-z-]+)\\s*\\(", "captures": { "1": { - "name": "string.quoted.double.css" + "name": "support.function.css" } } }, { - "match": "([a-z-]+)\\s*\\(", - "captures": { - "1": { - "name": "support.function.misc.css" - } - } + "match": "@[a-z]+", + "name": "keyword.control.at-rule" + }, + { + "match": "'.+?[^\\\\]'|\\\".+?[^\\\\]\\\"|\\\"\\\"|''", + "name": "string.quoted" }, { "match": "#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}", - "name": "support.constant.color.current.css" + "name": "string.unquoted.color.hash.css" + }, + { + "match": "!\\s*important", + "name": "string.regexp" + } + ] + }, + "other": { + "patterns": [ + { + "match": "[-;,.+*/!%(){}a-zA-Z0-9]", + "name": "entity.constant.character" + }, + { + "match": ".", + "name": "invalid" } ] }