Skip to content

Commit

Permalink
Implement basic keyword based highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
juho05 committed May 16, 2022
1 parent 0a7e46a commit 1cd6813
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# vscode-codegame
![CGE Version](https://img.shields.io/badge/CGE-v0.2-green)

A VS Code extension for writing [CodeGame](https://github.com/code-game-project) applications.

## Features

- Syntax highlighting `.cge` files

## Installation

- [Download](https://github.com/code-game-project/vscode-codegame/releases) the `*.vsix` file.
- Open the _Extensions_ tab in VS Code.
- Press the three dots in the top right corner of the _Extensions_ window.
- Choose _Install from VSIX…_.
- Select the downloaded file.
- Hit _Open_.

## License

MIT License

Copyright (c) 2022 CodeGame Contributors (https://github.com/orgs/code-game-project/people)

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:

The above copyright notice and this 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.
41 changes: 41 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"comments": {
"lineComment": "//",
"blockComment": [
"/*",
"*/"
]
},
"brackets": [
[
"{",
"}"
]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
[
"{",
"}"
],
[
"[",
"]"
],
[
"<",
">"
]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
[
"{",
"}"
],
[
"<",
">"
]
]
}
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "codegame",
"displayName": "CodeGame",
"description": "An extension for writing CodeGame applications.",
"version": "0.2.0",
"repository": {
"type": "git",
"url": "https://github.com/code-game-project/vscode-codegame"
},
"engines": {
"vscode": "^1.67.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [
{
"id": "cge",
"aliases": [
"CGE",
"cge"
],
"extensions": [
".cge"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "cge",
"scopeName": "source.cge",
"path": "./syntaxes/cge.tmLanguage.json"
}
]
}
}
63 changes: 63 additions & 0 deletions syntaxes/cge.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "CGE",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#types"
},
{
"include": "#comments"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.cge",
"match": "\\b(name|version|event|type|enum)\\b"
}
]
},
"types": {
"patterns": [
{
"name": "storage.type.cge",
"match": "\\b(string|bool|int|int32|int64|bigint|float|float32|float64|map|list)\\b"
}
]
},
"comments": {
"patterns": [
{
"name": "comment.block.cge",
"begin": "(\\/\\*)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.cge"
}
},
"end": "(\\*\\/)",
"endCaptures": {
"1": {
"name": "punctuation.definition.comment.cge"
}
}
},
{
"name": "comment.line.double-slash.cge",
"begin": "(\\/\\/)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.cge"
}
},
"end": "(?:\\n|$)"
}
]
}
},
"scopeName": "source.cge"
}

0 comments on commit 1cd6813

Please sign in to comment.