Skip to content

Commit

Permalink
v1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tientq64 committed Sep 27, 2023
1 parent abd9077 commit b24f619
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 108 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.2.1] - 2023-09-27

- Syntax highlighting:
+ Rewrote syntax highlighting for strings to be more concise, also added highlighting for character escape sequences.
+ Fix: `break`, `continue` with the following keyword highlighted as label.
+ Fix: Remove highlights of objects that do not contain any static methods.
- Added the ability to use variables when writing syntax highlighting. Variable has the syntax <<name>>.

## [1.2.0] - 2023-09-26

- Fix: Wrong folder when publishing.
Expand Down
77 changes: 42 additions & 35 deletions build.ls
Original file line number Diff line number Diff line change
Expand Up @@ -67,44 +67,51 @@ protoMethods = Array.from protoMethods .join \|

yamls = []
for instance, methods of staticMethods
instance .= split \.
methods .= join \|
switch instance.length
case 1
yaml = """
- match: (?<![."')\\]}?!])(#{instance.0})(\\.)(#methods)(?![\\w$])
captures:
1:
name: storage.type.livescript
2:
name: punctuation.accessor.livescript
3:
name: entity.name.function.livescript
"""
case 2
yaml = """
- match: (?<![."')\\]}?!])(#{instance.0})(\\.)(#{instance.1})(\\.)(#methods)(?![\\w$])
captures:
1:
name: storage.type.livescript
2:
name: punctuation.accessor.livescript
3:
patterns:
- include: '\#variable'
4:
name: punctuation.accessor.livescript
5:
name: entity.name.function.livescript
"""
yaml .= replace /^/gm " " .trimLeft!
yamls.push yaml
staticMethods = yamls * "\n "

syntaxes .= replace /##(\w+)##/g (, name) ~>
if methods.length
instance .= split \.
methods .= join \|
switch instance.length
case 1
yaml = """
- match: (?<![."')\\]}?!])(#{instance.0})(\\.)(#methods)(?![\\w$])
captures:
1:
name: storage.type.livescript
2:
name: punctuation.accessor.livescript
3:
name: entity.name.function.livescript
"""
case 2
yaml = """
- match: (?<![."')\\]}?!])(#{instance.0})(\\.)(#{instance.1})(\\.)(#methods)(?![\\w$])
captures:
1:
name: storage.type.livescript
2:
name: punctuation.accessor.livescript
3:
patterns:
- include: '\#variable'
4:
name: punctuation.accessor.livescript
5:
name: entity.name.function.livescript
"""
yaml .= replace /^/gm " " .trimLeft!
yamls.push yaml
staticMethods = yamls.join "\n "

syntaxes .= replace /{{(\w+)}}/g (, name) ~>
eval name

json = jsYaml.load syntaxes
while /<<(\w+)>>/.test syntaxes
syntaxes .= replace /<<(\w+)>>/g (, name) ~>
json.variables[name]

json = jsYaml.load syntaxes
delete json.variables
fs.outputJsonSync "#dist/syntaxes/livescript.tmLanguage.json" json
fs.outputJsonSync "#dist/snippets/livescript.code-snippets" snippets

Expand Down
8 changes: 8 additions & 0 deletions dist/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.2.1] - 2023-09-27

- Syntax highlighting:
+ Rewrote syntax highlighting for strings to be more concise, also added highlighting for character escape sequences.
+ Fix: `break`, `continue` with the following keyword highlighted as label.
+ Fix: Remove highlights of objects that do not contain any static methods.
- Added the ability to use variables when writing syntax highlighting. Variable has the syntax &lt;&lt;name&gt;&gt;.

## [1.2.0] - 2023-09-26

- Fix: Wrong folder when publishing.
Expand Down
Binary file removed dist/livescript-vscode-1.2.0.vsix
Binary file not shown.
Binary file added dist/livescript-vscode-1.2.1.vsix
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"livescript-vscode","version":"1.2.0","displayName":"LiveScript 2","description":"Syntax highlighting, autocomplete, and snippets","icon":"./icon.png","publisher":"tientq64","author":{"name":"tientq64","email":"tientq64@gmail.com","url":"https://github.com/tientq64"},"repository":{"type":"git","url":"https://github.com/tientq64/livescript-vscode.git"},"bugs":{"url":"https://github.com/tientq64/livescript-vscode/issues","email":"tientq64@gmail.com"},"engines":{"vscode":"^1.74.0"},"categories":["Programming Languages","Snippets"],"keywords":["livescript","syntax-highlighting","autocomplete","snippets","vscode-extension"],"devDependencies":{"fs-extra":"^11.1.1","livescript2":"^1.5.0","terser":"^5.20.0","js-yaml":"^4.1.0","@vscode/vsce":"^2.21.0"},"contributes":{"languages":[{"id":"livescript","aliases":["LiveScript"],"extensions":[".ls",".livescript"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"livescript","scopeName":"source.livescript","path":"./syntaxes/livescript.tmLanguage.json"}],"snippets":[{"language":"livescript","path":"./snippets/livescript.code-snippets"}]},"license":"MIT"}
{"name":"livescript-vscode","version":"1.2.1","displayName":"LiveScript 2","description":"Syntax highlighting, autocomplete, and snippets","icon":"./icon.png","publisher":"tientq64","author":{"name":"tientq64","email":"tientq64@gmail.com","url":"https://github.com/tientq64"},"repository":{"type":"git","url":"https://github.com/tientq64/livescript-vscode.git"},"bugs":{"url":"https://github.com/tientq64/livescript-vscode/issues","email":"tientq64@gmail.com"},"engines":{"vscode":"^1.74.0"},"categories":["Programming Languages","Snippets"],"keywords":["livescript","syntax-highlighting","autocomplete","snippets","vscode-extension"],"scripts":{"build-and-publish":"ls2 build.ls && cd dist && vsce publish"},"devDependencies":{"fs-extra":"^11.1.1","livescript2":"^1.5.0","terser":"^5.20.0","js-yaml":"^4.1.0","@vscode/vsce":"^2.21.0"},"contributes":{"languages":[{"id":"livescript","aliases":["LiveScript"],"extensions":[".ls",".livescript"],"configuration":"./language-configuration.json"}],"grammars":[{"language":"livescript","scopeName":"source.livescript","path":"./syntaxes/livescript.tmLanguage.json"}],"snippets":[{"language":"livescript","path":"./snippets/livescript.code-snippets"}]},"license":"MIT"}
2 changes: 1 addition & 1 deletion dist/snippets/livescript.code-snippets

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/syntaxes/livescript.tmLanguage.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "livescript-vscode",
"version": "1.2.0",
"version": "1.2.1",
"displayName": "LiveScript 2",
"description": "Syntax highlighting, autocomplete, and snippets",
"icon": "./icon.png",
Expand Down Expand Up @@ -32,6 +32,9 @@
"snippets",
"vscode-extension"
],
"scripts": {
"build-and-publish": "ls2 build.ls && cd dist && vsce publish"
},
"devDependencies": {
"fs-extra": "^11.1.1",
"livescript2": "^1.5.0",
Expand Down
20 changes: 20 additions & 0 deletions snippets/livescript.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,25 @@
"prefix": "log",
"body": "console.log $0",
"description": "Log to the console"
},
"name": {
"scope": "livescript",
"prefix": "name",
"body": "name"
},
"arguments": {
"scope": "livescript",
"prefix": "arguments",
"body": "arguments"
},
"length": {
"scope": "livescript",
"prefix": "length",
"body": "length"
},
"prototype": {
"scope": "livescript",
"prefix": "prototype",
"body": "prototype"
}
}
2 changes: 1 addition & 1 deletion syntaxes/autocompletes.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions syntaxes/generator.ls
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ for item in items

for name, desc of descs
if typeof desc.value == \function
item.methods.push name
unless name in <[constructor]>
item.methods.push name
else
item.props.push name
unless name in <[name arguments length caller prototype]>
item.props.push name

json = JSON.stringify items,, " "
preEl.textContent = json
Expand Down
Loading

0 comments on commit b24f619

Please sign in to comment.