Skip to content

Commit 1cd6813

Browse files
committed
Implement basic keyword based highlighting
1 parent 0a7e46a commit 1cd6813

File tree

6 files changed

+204
-0
lines changed

6 files changed

+204
-0
lines changed

.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// A launch configuration that launches the extension inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
]
15+
}
16+
]
17+
}

.vscodeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
vsc-extension-quickstart.md

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# vscode-codegame
2+
![CGE Version](https://img.shields.io/badge/CGE-v0.2-green)
3+
4+
A VS Code extension for writing [CodeGame](https://github.com/code-game-project) applications.
5+
6+
## Features
7+
8+
- Syntax highlighting `.cge` files
9+
10+
## Installation
11+
12+
- [Download](https://github.com/code-game-project/vscode-codegame/releases) the `*.vsix` file.
13+
- Open the _Extensions_ tab in VS Code.
14+
- Press the three dots in the top right corner of the _Extensions_ window.
15+
- Choose _Install from VSIX…_.
16+
- Select the downloaded file.
17+
- Hit _Open_.
18+
19+
## License
20+
21+
MIT License
22+
23+
Copyright (c) 2022 CodeGame Contributors (https://github.com/orgs/code-game-project/people)
24+
25+
Permission is hereby granted, free of charge, to any person obtaining a copy
26+
of this software and associated documentation files (the "Software"), to deal
27+
in the Software without restriction, including without limitation the rights
28+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29+
copies of the Software, and to permit persons to whom the Software is
30+
furnished to do so, subject to the following conditions:
31+
32+
The above copyright notice and this permission notice shall be included in all
33+
copies or substantial portions of the Software.
34+
35+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41+
SOFTWARE.

language-configuration.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"comments": {
3+
"lineComment": "//",
4+
"blockComment": [
5+
"/*",
6+
"*/"
7+
]
8+
},
9+
"brackets": [
10+
[
11+
"{",
12+
"}"
13+
]
14+
],
15+
// symbols that are auto closed when typing
16+
"autoClosingPairs": [
17+
[
18+
"{",
19+
"}"
20+
],
21+
[
22+
"[",
23+
"]"
24+
],
25+
[
26+
"<",
27+
">"
28+
]
29+
],
30+
// symbols that can be used to surround a selection
31+
"surroundingPairs": [
32+
[
33+
"{",
34+
"}"
35+
],
36+
[
37+
"<",
38+
">"
39+
]
40+
]
41+
}

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "codegame",
3+
"displayName": "CodeGame",
4+
"description": "An extension for writing CodeGame applications.",
5+
"version": "0.2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/code-game-project/vscode-codegame"
9+
},
10+
"engines": {
11+
"vscode": "^1.67.0"
12+
},
13+
"categories": [
14+
"Programming Languages"
15+
],
16+
"contributes": {
17+
"languages": [
18+
{
19+
"id": "cge",
20+
"aliases": [
21+
"CGE",
22+
"cge"
23+
],
24+
"extensions": [
25+
".cge"
26+
],
27+
"configuration": "./language-configuration.json"
28+
}
29+
],
30+
"grammars": [
31+
{
32+
"language": "cge",
33+
"scopeName": "source.cge",
34+
"path": "./syntaxes/cge.tmLanguage.json"
35+
}
36+
]
37+
}
38+
}

syntaxes/cge.tmLanguage.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "CGE",
4+
"patterns": [
5+
{
6+
"include": "#keywords"
7+
},
8+
{
9+
"include": "#types"
10+
},
11+
{
12+
"include": "#comments"
13+
}
14+
],
15+
"repository": {
16+
"keywords": {
17+
"patterns": [
18+
{
19+
"name": "keyword.cge",
20+
"match": "\\b(name|version|event|type|enum)\\b"
21+
}
22+
]
23+
},
24+
"types": {
25+
"patterns": [
26+
{
27+
"name": "storage.type.cge",
28+
"match": "\\b(string|bool|int|int32|int64|bigint|float|float32|float64|map|list)\\b"
29+
}
30+
]
31+
},
32+
"comments": {
33+
"patterns": [
34+
{
35+
"name": "comment.block.cge",
36+
"begin": "(\\/\\*)",
37+
"beginCaptures": {
38+
"1": {
39+
"name": "punctuation.definition.comment.cge"
40+
}
41+
},
42+
"end": "(\\*\\/)",
43+
"endCaptures": {
44+
"1": {
45+
"name": "punctuation.definition.comment.cge"
46+
}
47+
}
48+
},
49+
{
50+
"name": "comment.line.double-slash.cge",
51+
"begin": "(\\/\\/)",
52+
"beginCaptures": {
53+
"1": {
54+
"name": "punctuation.definition.comment.cge"
55+
}
56+
},
57+
"end": "(?:\\n|$)"
58+
}
59+
]
60+
}
61+
},
62+
"scopeName": "source.cge"
63+
}

0 commit comments

Comments
 (0)