Merge branch 'hlds' into 'hlds'

HLDS syntax highlighter for VS Code

See merge request midgard/haldis!2
This commit is contained in:
midgard 2020-02-24 21:53:11 +01:00
commit aa139d0d21
9 changed files with 246 additions and 0 deletions

4
etc/hlds/.vscodeignore Normal file
View file

@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md

9
etc/hlds/CHANGELOG.md Normal file
View file

@ -0,0 +1,9 @@
# Change Log
All notable changes to the "hlds" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release

10
etc/hlds/README.md Normal file
View file

@ -0,0 +1,10 @@
# hlds
Working on haldis? Thanks! This extension will hihghlight the `.hlds` files, maybe a bit sillyly but hey, it's something.
### For more information
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
**Enjoy!**

BIN
etc/hlds/hlds.vsix Normal file

Binary file not shown.

View file

@ -0,0 +1,30 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "=============================================", "=============================================" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}

31
etc/hlds/package.json Normal file
View file

@ -0,0 +1,31 @@
{
"name": "hlds",
"publisher": "Silvius",
"displayName": "Syntax highlighting for haldis (hlds) files.",
"description": "hlds",
"repository": "https://git.zeus.gent/midgard/haldis",
"version": "0.0.2",
"engines": {
"vscode": "^1.30.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "hlds",
"aliases": ["HLDS", "hlds"],
"extensions": [".hlds"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "hlds",
"scopeName": "source.hlds",
"path": "./syntaxes/hlds.tmLanguage.json"
}, {
"path": "./syntaxes/injections.json",
"scopeName": "comment.injection",
"injectTo": ["source.hlds"]
}]
}
}

View file

@ -0,0 +1,97 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "HLDS",
"patterns": [
{
"include": "#tags"
},
{
"include": "#keywords"
},
{
"include": "#header"
},
{
"include": "#prices"
},
{
"include": "#indent"
},
{
"include": "#random"
}
],
"repository": {
"random": {
"patterns": [
{
"match": "#.*$",
"name": "markup.bold"
}
]
},
"tags": {
"patterns": [
{
"match": "(::)\\s*({[a-zA-Z-_]*}\\s*)*",
"name": "markup.italic",
"captures": {
"1": {
"name": "markup.bold"
}
}
}
]
},
"indent": {
"patterns": [
{
"name": "variable.other",
"match": "\\t[-_a-zA-Z0-9]*:"
},
{
"name": "entity.name.type",
"match": "[-_a-zA-Z0-9]*:"
}
]
},
"prices": {
"patterns": [
{
"name": "entity.name.class",
"match": "€\\s*[0-9.]*$"
}
]
},
"header": {
"patterns": [
{
"name": "embedded.meta.tag",
"begin": "^==",
"end": "==$"
}
]
},
"comments": {
"patterns": [
{
"name": "comment",
"match": "--[^€]*"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.hlds",
"match": "\\bdish\\b"
},
{
"name": "keyword",
"match": "\\b(single_choice|multi_choice)\\b"
}
]
}
},
"scopeName": "source.hlds"
}

View file

@ -0,0 +1,36 @@
{
"scopeName": "comment.injection",
"injectionSelector": "L:embedded.meta.tag",
"patterns": [
{
"include": "#comment"
},
{
"include": "#header"
},
{
"include": "#links"
},
{
"include": "#brackets"
}
],
"repository": {
"comment": {
"match": "#.*$",
"name": "comment"
},
"header": {
"match": "^[a-zA-Z0-9_].*$",
"name": "keyword.todo"
},
"links": {
"match": "^\\t[a-zA-Z0-9-_]*",
"name": "keyword.todo"
},
"brackets": {
"match": "=",
"name": "variable.other"
}
}
}

View file

@ -0,0 +1,29 @@
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/hlds.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
## Get up and running straight away
* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.
## Make changes
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Add more language features
* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
## Install your extension
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.