Add syntax highlighting for vscode

This commit is contained in:
0x4261756D 2022-12-22 05:44:08 +01:00
parent 53cfd52dcd
commit 5682ee708c
10 changed files with 198 additions and 0 deletions

View File

@ -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}"
]
}
]
}

View File

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

View File

@ -0,0 +1,9 @@
# Change Log
All notable changes to the "kurz-lang" 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

View File

@ -0,0 +1,5 @@
# kurz-lang README
This is a syntax highlighting extension for the lanuage '[kurz](https://gittea.dev/0x4261756D/kurz)'.
**Enjoy!**

Binary file not shown.

View File

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

View File

@ -0,0 +1,25 @@
{
"name": "kurz-lang",
"displayName": "kurz",
"description": "Syntax highlighting for the kurz language",
"version": "0.0.1",
"engines": {
"vscode": "^1.74.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "kurz",
"aliases": ["kurz", "kurz"],
"extensions": [".qbl"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "kurz",
"scopeName": "source.kurz",
"path": "./syntaxes/kurz.tmLanguage.json"
}]
}
}

View File

@ -0,0 +1,89 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "kurz",
"patterns":
[
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#comment"
}
],
"repository":
{
"keywords":
{
"patterns":
[
{
"name": "keyword.control.kurz",
"match": "\\b(if|else|while)\\b"
},
{
"name": "keyword.operator",
"match": "[-+<>]|==|!=|=>|print(ln)?"
},
{
"name": "support.function.kurz",
"match": "function"
},
{
"name": "support.type.kurz",
"match": "\\b(bool|int|str|any)\\b"
},
{
"name": "constant.numeric.kurz",
"match": "[0-9]"
},
{
"name": "constant.language.kurz",
"match": "true|false"
},
{
"name": "support.function.kurz",
"match": "\\b(deq|swp|dup|req|depth|decrease)\\b"
},
{
"name": "keyword.control",
"match": "arr"
}
]
},
"comment":
{
"patterns":
[
{
"name": "comment.line.kurz",
"begin": "//",
"end": "$",
"patterns":
[
{
"name": "markup.bold.kurz",
"match": "(TODO|FIXME):?"
}
]
}
]
},
"strings":
{
"name": "string.quoted.double.kurz",
"begin": "\"",
"end": "\"",
"patterns":
[
{
"name": "constant.character.escape.kurz",
"match": "\\\\."
}
]
}
},
"scopeName": "source.kurz"
}

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/kurz.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.