From 2d13e07b841082fb9fe0a7b777ac9219a3a6ecb3 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 13 Apr 2026 18:03:12 +0200 Subject: [PATCH] Basic highlighting --- package.json | 2 +- syntaxes/mist.tmLanguage.json | 107 +++++++++++++++++++++++++--------- 2 files changed, 82 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 7cf3018..18f5eb1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }], "grammars": [{ "language": "mist", - "scopeName": "source.ms", + "scopeName": "source.mist", "path": "./syntaxes/mist.tmLanguage.json" }] } diff --git a/syntaxes/mist.tmLanguage.json b/syntaxes/mist.tmLanguage.json index 8276193..8880e5e 100644 --- a/syntaxes/mist.tmLanguage.json +++ b/syntaxes/mist.tmLanguage.json @@ -1,32 +1,87 @@ { "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "Mist", + "scopeName": "source.mist", "patterns": [ - { - "include": "#keywords" - }, - { - "include": "#strings" - } + { "include": "#comments" }, + { "include": "#keywords" }, + { "include": "#strings" }, + { "include": "#numbers" }, + { "include": "#types" }, + { "include": "#operators" } ], "repository": { - "keywords": { - "patterns": [{ - "name": "keyword.control.mist", - "match": "\\b(if|while|for|return)\\b" - }] - }, - "strings": { - "name": "string.quoted.double.mist", - "begin": "\"", - "end": "\"", - "patterns": [ - { - "name": "constant.character.escape.mist", - "match": "\\\\." - } - ] - } - }, - "scopeName": "source.ms" -} \ No newline at end of file + "comments": { + "patterns": [ + { + "name": "comment.line.double-slash.mist", + "match": "//.*$" + } + ] + }, + + "keywords": { + "patterns": [ + { + "name": "keyword.control.flow.mist", + "match": "\\b(if|else|for|return|function|class|struct|import|let|const)\\b" + }, + { + "name": "constant.language.null.mist", + "match": "\\b(null)\\b" + }, + { + "name": "constant.language.this.mist", + "match": "\\b(this)\\b" + }, + { + "name": "constant.language.boolean.mist", + "match": "\\b(true|false)\\b" + } + ] + }, + + "strings": { + "name": "string.quoted.double.mist", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.mist", + "match": "\\\\." + } + ] + }, + + "numbers": { + "patterns": [ + { + "name": "constant.numeric.float.mist", + "match": "\\b\\d+\\.\\d+\\b" + }, + { + "name": "constant.numeric.integer.mist", + "match": "\\b\\d+\\b" + } + ] + }, + + "types": { + "patterns": [ + { + "name": "entity.name.type.mist", + "match": "\\b[A-Z][a-zA-Z0-9_]*\\b" + } + ] + }, + + "operators": { + "patterns": [ + { + "name": "keyword.operator.mist", + "match": "(==|!=|<=|>=|&&|\\|\\||[+\\-*/<>=])" + } + ] + } + } + } \ No newline at end of file