made a basic extension

This commit is contained in:
afonya 2025-06-17 23:47:38 +02:00
parent ae1cc90a2a
commit 10eef39f12
Signed by: afonya
GPG key ID: EBB9C4CAFAAFB2DC
6 changed files with 264 additions and 1 deletions

View file

@ -252,7 +252,7 @@ ugass(a[0]) // 1
```
### Gyors lekérés
Használat: `tábla[kulcs]`
Használat: `tábla.kulcs`
:::warning

View file

@ -0,0 +1,35 @@
{
"scopeName": "source.astrolang",
"patterns": [
{
"name": "comment.line.astrolang",
"match": "//.*$"
},
{
"name": "comment.block.astrolang",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "keyword.control.astrolang",
"match": "\\b(kraf|piszolj|ha nem geny akkor geny|ha nem geny|nem piszv|kopva|gethelj|ha geny|lőcsve|csecs|reti|piszv|amíg geny|nincs hám|szard le|hámozd|be|ba)\\b"
},
{
"name": "keyword.operator.astrolang",
"match": "(\\+|-|\\*|\\/|%|=|==|!=|<=|>=|<|>|&&|\\|\\||!)"
},
{
"name": "string.quoted.double.astrolang",
"begin": "(?<=szaft)\"",
"end": "\"(?=szaft)"
},
{
"name": "variable.astrolang",
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b"
},
{
"name": "constant.numeric.astrolang",
"match": "([0-9]+)"
}
]
}

79
extension/index.js Normal file
View file

@ -0,0 +1,79 @@
import * as vscode from 'vscode'
vscode.languages.registerCompletionItemProvider('astrolang', {
provideCompletionItems() {
const words = [
"kraf",
"piszolj",
"ha nem geny akkor geny",
"ha nem geny",
"nem piszv",
"kopva",
"gethelj",
"ha geny",
"lőcsve",
"csecs",
"reti",
"piszv",
"amíg geny",
"nincs hám",
"szard le",
"hámozd",
"be",
"ba",
"szaft"
]
const env = [
"ugass",
"bimba",
"csömör",
"tarh",
"bimbabemb",
"nerd",
"tábla",
"kábel",
"szenvedés",
"abs",
"kerek",
"sin",
"cos",
"tan",
"sqrt",
"legnagyobb",
"legkisebb",
"pi",
"csemerd fel",
"csemerd le",
"hossz",
"ismételd",
"uno reverse",
"darabos",
"keres",
"átrak",
"számmá",
"betűvé",
"hozzáad",
"töröl",
"kulcsok",
"vége",
"halgass",
"kérés",
"írj",
"olvass",
"zár"
]
let out = []
for (let i = 0; i < words.length; i++) {
out.push(new vscode.CompletionItem(words[i], vscode.CompletionItemKind.Keyword))
}
for (let i = 0; i < env.length; i++) {
out.push(new vscode.CompletionItem(env[i], vscode.CompletionItemKind.Variable))
}
return out
}
})

View file

@ -0,0 +1,24 @@
{
"comments": {
"lineComment": "//",
"blockComment": ["/*", "*/"]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "/*", "close": " */", "notIn": ["string"] },
{ "open": "szaft\"", "close": "\"szaft", "notIn": ["string"] }
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["szaft\"", "\"szaft"]
]
}

41
extension/package.json Normal file
View file

@ -0,0 +1,41 @@
{
"name": "asl-extension",
"version": "0.2.0",
"description": "The extension for Astro Lang",
"license": "MIT",
"author": "Afonya",
"type": "module",
"main": "index.js",
"engines": {
"vscode": "^1.22.0"
},
"contributes": {
"languages": [
{
"id": "astrolang",
"aliases": [
"Astro Lang",
"AstroLang",
"ASL"
],
"extensions": [
".asl"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "astrolang",
"scopeName": "source.astrolang",
"path": "./astrolang.tmLanguage.json"
}
],
"snippets": [
{
"language": "astrolang",
"path": "./snippets.json"
}
]
}
}

84
extension/snippets.json Normal file
View file

@ -0,0 +1,84 @@
{
"if": {
"prefix": "ha geny",
"body": [
"ha geny(${1:feltétel}) {",
"$0",
"}"
],
"description": "Egy if"
},
"else": {
"prefix": "ha nem geny",
"body": [
"ha nem geny {",
"$0",
"}"
],
"description": "Egy else"
},
"elseif": {
"prefix": "ha nem geny akkor geny",
"body": [
"ha nem geny akkor geny(${1:feltétel}) {",
"$0",
"}"
],
"description": "Egy else if"
},
"while": {
"prefix": "amíg geny",
"body": [
"amíg geny(${1:feltétel}) {",
"$0",
"}"
],
"description": "Egy while ciklus"
},
"for": {
"prefix": "kraf",
"body": [
"kraf(gethelj ${1:i} = ${2:0}; ${3:feltétel}; ${1:i}=${1:i}+1) {",
"$0",
"}"
],
"description": "Egy for ciklus"
},
"var create": {
"prefix": "gethelj",
"body": [
"gethelj ${1:változó} = ${2:érték}"
],
"description": "Egy változó létrehozása"
},
"function create": {
"prefix": "lőcsve",
"body": [
"lőcsve ${1:függvény név}(${2:paraméterek}) {",
"$0",
"}"
],
"description": "Egy függvény létrehozása"
},
"import": {
"prefix": "hámozd",
"body": [
"hámozd ${1:modul név} ${2|be,ba|} szaft\"${3:elérési út}\"szaft"
],
"description": "Egy modul importálása"
},
"string": {
"prefix": "szaft",
"body": [
"szaft\"${1:szöveg}\"szaft"
],
"description": "Egy szöveg létrehozása"
},
"print": {
"prefix": "ugass",
"body": [
"ugass(${1:üzenet})"
],
"description": "Egy üzenet kiírása a konzolra"
}
}