Skip to content

Commit 9cba69c

Browse files
authored
Add class and method highlight support (#1)
1 parent 69ea491 commit 9cba69c

3 files changed

Lines changed: 72 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
65

76
## [Unreleased]
87

8+
## [0.0.8] - 2021-09-08
9+
### Added
10+
- Class and method highlighting support
11+
912
## [0.0.1] - 2020-04-19
1013
### Added
1114
- Syntax highlighting support for Ghost (.ghost)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"icon": "icon.png",
55
"description": "Ghost extension for Visual Studio Code.",
66
"publisher": "GhostLanguage",
7-
"version": "0.0.7",
7+
"version": "0.0.8",
88
"license": "MIT",
99
"keywords": ["ghost"],
1010
"private": true,

syntaxes/ghost.tmLanguage.json

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
"repository": {
1111
"code": {
1212
"patterns": [
13-
{ "include": "block" },
13+
{ "include": "#block" },
1414
{ "include": "#blockComment" },
15+
{ "include": "#class" },
1516
{ "include": "#comment" },
1617
{ "include": "#constant" },
17-
{ "include": "function" },
1818
{ "include": "#keyword" },
1919
{ "include": "#library" },
2020
{ "include": "#puncuation" },
21-
{ "include": "#string" }
21+
{ "include": "#string" },
22+
{ "include": "#variable" }
2223
]
2324
},
2425

@@ -50,6 +51,37 @@
5051
]
5152
},
5253

54+
"class": {
55+
"name": "meta.class",
56+
"begin": "(?:\\b(foreign)\\s+)?(\\bclass)\\s+(\\w+)\\s+(?:(\\bis)\\s+(\\w+))?",
57+
"beginCaptures": {
58+
"1": { "name": "storage.modifier.ghost" },
59+
"2": { "name": "storage.modifier.ghost" },
60+
"3": { "name": "entity.name.class.ghost" },
61+
"4": { "name": "storage.modifier.ghost" },
62+
"5": { "name": "entity.name.class.ghost" }
63+
},
64+
"end": "}",
65+
"endCaptures": {
66+
"0": { "name": "punctuation.section.class.end.ghost" }
67+
},
68+
"patterns": [
69+
{
70+
"name": "meta.class.body.ghost",
71+
"begin": "{",
72+
"beginCaptures": {
73+
"0": { "name": "punctuation.section.class.begin.ghost" }
74+
},
75+
"patterns": [
76+
{ "include": "#comment" },
77+
{ "include": "#blockComment" },
78+
{ "include": "#method" }
79+
],
80+
"end": "(?=})"
81+
}
82+
]
83+
},
84+
5385
"comment": {
5486
"name": "comment.line.ghost",
5587
"match": "//.*"
@@ -118,6 +150,37 @@
118150
]
119151
},
120152

153+
"method": {
154+
"name": "meta.method.ghost",
155+
"begin": "(?:\\b(construct|static)\\s+)?(\\w+=|\\w+|\\+|-|\\*|\\/|%|<=?|>=?|==|!=?|&|\\||~)",
156+
"beginCaptures": {
157+
"1": { "name": "storage.modifier.ghost" },
158+
"2": { "name": "entity.name.function.ghost" }
159+
},
160+
"end": "}",
161+
"patterns": [
162+
{
163+
"name": "meta.method.identifier.ghost",
164+
"begin": "\\(",
165+
"end": "\\)",
166+
"patterns": [
167+
{
168+
"name": "variable.parameter.function.ghost",
169+
"match": "\\w+"
170+
}
171+
]
172+
},
173+
{
174+
"name": "meta.method.body.ghost",
175+
"begin": "{",
176+
"end": "(?=})",
177+
"patterns": [
178+
{ "include": "#code" }
179+
]
180+
}
181+
]
182+
},
183+
121184
"puncutation": {
122185
"patterns": [
123186
{

0 commit comments

Comments
 (0)