Skip to content

Commit

Permalink
1.3.0
Browse files Browse the repository at this point in the history
- Add code formatter
- Change file extensions
- Add highlighting for simple breakpoints
- Fix many bugs
  • Loading branch information
Nixinova committed Jan 18, 2021
1 parent 67e62db commit 37d491d
Show file tree
Hide file tree
Showing 8 changed files with 420 additions and 161 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.vscode
*.local.*
22 changes: 19 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
# Changelog

## 1.3.0
- Added code formatter.
- Added syntax highlighting for simple breakpoints.
- Added `.nvss` as an applicable file extension.
- Readded automatic indentation.
- Updated syntax highlighting of CSS declaration substitutions.
- Removed `.nss`, `.nss.txt`, and `.novasheets` as applicable file extensions.
- Changed URL syntax highlighting to apply colouring as well as an underline.
- Fixed numeric syntax highlighting not applying to negative exponents.
- Fixed object getter syntax highlighting not being applied when its selector contains spaces.
- Fixed CSS property syntax highlighting not being applied when the property name contains trailing whitespace.
- Fixed declaration substitution syntax highlighting not being applied when containing leading whitespace.
- Fixed built-in function syntax highlighting not being applied when the variable name contains leading whitespace.
- Fixed at-rule syntax highlighting getting overwritten.
- Refactored code to be compiled from a YAML tmLanguage file.

## 1.2.5
- Added syntax highlighting for CSS declaration substitutions.
- Added syntax highlighting for object getter notaton.
- Added `.novasheet` and `.novasheets` as valid file extensions.
- Added `.novasheet` and `.novasheets` as applicable file extensions.

## 1.2.4
- Added syntax highlighting for static comments (`/*/ text /*/`) and parsed comments (`/*[ ]*/`).
Expand Down Expand Up @@ -50,10 +66,10 @@
- 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.
- Refactored internal code to be more semantically correct.

## 1.1.1
- Fixed syntax highlighting of comments appearing as variable contents.
Expand All @@ -65,4 +81,4 @@
- Replaced themes with direct semantic colorization from the default theme.

## 1.0.0
- Added NovaSheets Light & Dark Themes which support syntax highlighting.
- Added NovaSheets Light & Dark Themes which support syntax highlighting.
42 changes: 42 additions & 0 deletions formatters/formatter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var vscode = require("vscode")

function activate(context) {
console.log('NovaSheets formatter activated')
const formatter = vscode.languages.registerDocumentFormattingEditProvider('novasheets', {
provideDocumentFormattingEdits: function (document) {
let output = document.getText()

// Variable declarations
.replace(/@var\s+([^|=]+)\s*(=\s*)?/g, (_, name, eq) => '@var ' + name.trim() + (eq ? ' = ' : ''))
.replace(/(?<!\n)\s*@endvar/g, '\n@endvar')

// Variable substitutions
.replace(/\$\( */g, '$( ')
.replace(/(?<=(?:\$\(|\))[^()]+) *\)/g, ' )')
.replace(/\$\(\s+([^$()|]+)\s+\)/g, '$($1)')
.replace(/ *\| */g, ' | ')
.replace(/(?<=\|)(.*?) *=\s*/g, '$1 = ')
.replace(/^ ([|)])/gm, '$1')

// Parser constants
.replace(/@const\s+([A-Z]+)\s+(true|false|\d+)/g, '@const $1 $2')

// CSS
.replace(/(?<=[{(][^})]*)([a-z-]+)\s*:(?!\/\/) */g, '$1: ')
.replace(/\s*;/g, ';')
.replace(/!\s*important/g, '!important')

// General cleanup
.replace(/ +(?=\n)/g, '')

const startOfDocument = document.lineAt(0).range.start
const endOfDocument = document.lineAt(document.lineCount - 1).range.end
const documentRange = new vscode.Range(startOfDocument, endOfDocument)
return [vscode.TextEdit.replace(documentRange, output)]
}
});
context.subscriptions.push(formatter)
}

exports.__esModule = true
exports.activate = activate
3 changes: 2 additions & 1 deletion language-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["<", ">"],
["(", ")"],
["[", "]"],
["{", "}"]
Expand All @@ -23,4 +24,4 @@
["\"", "\""],
["'", "'"]
]
}
}
30 changes: 12 additions & 18 deletions license.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# MIT License
# ISC License

Copyright &copy; 2020 Nixinova
Copyright &copy; 2021 Nixinova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

- The above copyright notice and an equivalent permission notice shall be included in all
copies or substantial portions of the Software.

- The Software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and noninfringement. In no event shall the
authors or copyright holders be liable for any claim, damages or other
liability, whether in an action of contract, tort or otherwise, arising from,
out of or in connection with the Software or the use or other dealings in the
Software.
The software is provided "as is" and the author disclaims all warranties
with regard to this software including all implied warranties of
merchantability and fitness. In no event shall the author be liable for
any special, direct, indirect, or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether in an
action of contract, negligence or other tortious action, arising out of
or in connection with the use or performance of this software.
32 changes: 18 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
{
"name": "novasheets",
"displayName": "NovaSheets",
"description": "Syntax highlighter for NovaSheets files",
"description": "Syntax highlighter and formatter for NovaSheets files",
"publisher": "Nixinova",
"repository": "NovaSheets-vscode",
"version": "1.2.5",
"version": "1.3.0",
"license": "ISC",
"scripts": {
"compile": "yaml2json syntaxes/novasheets.tmLanguage.yaml --save"
},
"engines": {
"vscode": "^1.49.0"
},
"categories": [
"Programming Languages"
],
"activationEvents": [
"onLanguage:novasheets"
],
"main": "./formatters/formatter",
"contributes": {
"languages": [
{
"id": "novasheets",
"aliases": [
"NovaSheets",
"novasheets",
"nss"
"nvss"
],
"extensions": [
".nss",
".nss.txt",
".novasheet",
".novasheets"
".nvss"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "novasheets",
"scopeName": "source.nss",
"scopeName": "source.novasheets",
"path": "./syntaxes/novasheets.tmLanguage.json"
}
],
"configurationDefaults": {
"[novasheets]": {
"editor.autoIndent": "none"
}
}
]
},
"devDependencies": {
"yamljs": "^0.3.0"
}
}
}
Loading

0 comments on commit 37d491d

Please sign in to comment.