diff options
author | Takase <20792268+takase1121@users.noreply.github.com> | 2021-07-06 22:19:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-06 22:19:38 +0800 |
commit | 0d706ddd861b471bb4f148d119bc990adadabb05 (patch) | |
tree | 397de9a6cc30f65cf54399b245561cdf58a926da | |
parent | 83fcee49038842f3d7f60ebce5058d6e3fccbc92 (diff) | |
parent | 4421ee3d6a2ad35e510e2d2857c527cb08235fda (diff) | |
download | lite-xl-plugins-0d706ddd861b471bb4f148d119bc990adadabb05.tar.gz lite-xl-plugins-0d706ddd861b471bb4f148d119bc990adadabb05.zip |
Merge pull request #41 from lite-xl/language-ts
add language_ts
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/language_ts.lua | 73 |
2 files changed, 74 insertions, 0 deletions
@@ -83,6 +83,7 @@ Plugin | Description [`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language [`language_tcl`](plugins/language_tcl.lua?raw=1) | Syntax for the [Tcl](https://www.tcl.tk/) programming language [`language_teal`](plugins/language_teal.lua?raw=1) | Syntax for the [Teal](https://github.com/teal-language/tl) programming language, a typed dialect of Lua. +[`language_ts`](plugins/language_ts.lua?raw=1) | Syntax for the [TypeScript](https://www.typescriptlang.org/) programming language, a typed dialect of JavaScript. [`language_tex`](plugins/language_tex.lua?raw=1) | Syntax for the [LaTeX](https://www.latex-project.org/) typesetting language [`language_tsx`](plugins/language_tsx.lua?raw=1) | Syntax for [TSX](https://www.typescriptlang.org/docs/handbook/jsx.html) language [`language_v`](plugins/language_v.lua?raw=1) | Syntax for the [V](https://vlang.io/) programming language diff --git a/plugins/language_ts.lua b/plugins/language_ts.lua new file mode 100644 index 0000000..96cf0d3 --- /dev/null +++ b/plugins/language_ts.lua @@ -0,0 +1,73 @@ +-- mod-version:1 -- lite-xl 1.16 +-- copied from language_js, but added regex highlighting back +local syntax = require "core.syntax" + +syntax.add { + files = { "%.ts$" }, + comment = "//", + patterns = { + { pattern = "//.-\n", type = "comment" }, + { pattern = { "/%*", "%*/" }, type = "comment" }, + { pattern = { '/%g', '/', '\\' }, type = "string" }, + { pattern = { '"', '"', '\\' }, type = "string" }, + { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { "`", "`", '\\' }, type = "string" }, + { pattern = "0x[%da-fA-F]+", type = "number" }, + { pattern = "-?%d+[%d%.eE]*", type = "number" }, + { pattern = "-?%.?%d+", type = "number" }, + { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, + { pattern = "interface%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { pattern = "type%s()[%a_][%w_]*", type = {"keyword", "keyword2"} }, + { pattern = "[%a_][%w_]*%f[(]", type = "function" }, + { pattern = "[%a_][%w_]*", type = "symbol" }, + }, + symbols = { + ["async"] = "keyword", + ["await"] = "keyword", + ["break"] = "keyword", + ["case"] = "keyword", + ["catch"] = "keyword", + ["class"] = "keyword", + ["const"] = "keyword", + ["continue"] = "keyword", + ["debugger"] = "keyword", + ["default"] = "keyword", + ["delete"] = "keyword", + ["do"] = "keyword", + ["else"] = "keyword", + ["export"] = "keyword", + ["extends"] = "keyword", + ["finally"] = "keyword", + ["for"] = "keyword", + ["function"] = "keyword", + ["get"] = "keyword", + ["if"] = "keyword", + ["import"] = "keyword", + ["implements"] = "keyword", + ["in"] = "keyword", + ["instanceof"] = "keyword", + ["let"] = "keyword", + ["new"] = "keyword", + ["return"] = "keyword", + ["set"] = "keyword", + ["static"] = "keyword", + ["super"] = "keyword", + ["switch"] = "keyword", + ["throw"] = "keyword", + ["try"] = "keyword", + ["typeof"] = "keyword", + ["var"] = "keyword", + ["void"] = "keyword", + ["while"] = "keyword", + ["with"] = "keyword", + ["yield"] = "keyword", + ["true"] = "literal", + ["false"] = "literal", + ["null"] = "literal", + ["undefined"] = "literal", + ["arguments"] = "keyword2", + ["Infinity"] = "keyword2", + ["NaN"] = "keyword2", + ["this"] = "keyword2", + }, +} |