Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
- Add snippets
- Change highlighting
- Refactor tokenisation
  • Loading branch information
Nixinova committed Mar 20, 2021
1 parent 292c421 commit de7710e
Show file tree
Hide file tree
Showing 11 changed files with 701 additions and 489 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules/
test/

*.local.*
*.js
*.yaml
4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.vscode/
.git/
test/
node_modules/

.gitignore
*.local.*
*.js
*.yaml
12 changes: 12 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 1.4.0
- Added breakpoint snippet.
- Added previous element selector syntax highlighting.
- Added regular expression syntax highlighting
- Added full numeric unit syntax highlighting.
- Changed variable syntax highlighting.
- Changed `!important` syntax highlighting.
- Changed selector separator syntax highlighting.
- Removed static comment inner syntax highlighting.
- Revamped internal syntax highlighting tokenisation.
- Fixed formatter not cleanup up colons and trailing spaces.

## 1.3.1
- Added angle brackets as auto-enclosing characters.
- Changed syntax highlighting of parser constants from `@const` to `@option`.
Expand Down
13 changes: 6 additions & 7 deletions formatters/formatter.js → formatters/formatter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var vscode = require("vscode")
import * as vscode from 'vscode';

function activate(context) {
export function activate(context: vscode.ExtensionContext) {
console.log('NovaSheets formatter activated')
const formatter = vscode.languages.registerDocumentFormattingEditProvider('novasheets', {
provideDocumentFormattingEdits: function (document) {
Expand All @@ -22,12 +22,14 @@ function activate(context) {
.replace(/@const\s+([A-Z]+)\s+(true|false|\d+)/g, '@const $1 $2')

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

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

const startOfDocument = document.lineAt(0).range.start
const endOfDocument = document.lineAt(document.lineCount - 1).range.end
Expand All @@ -37,6 +39,3 @@ function activate(context) {
});
context.subscriptions.push(formatter)
}

exports.__esModule = true
exports.activate = activate
294 changes: 294 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit de7710e

Please sign in to comment.