aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Larisch <benlarisch2019@gmail.com>2022-06-12 10:23:04 +0200
committerBen Larisch <benlarisch2019@gmail.com>2022-06-12 10:23:04 +0200
commit21799d1c0f998318af34615be9d365c87fedc72a (patch)
treed79804cbbe11ab879843ca64df9cd42d79ce646e
parentac2e5251fdf4feed9e97a619f525abd8179c0512 (diff)
downloadlite-xl-plugins-21799d1c0f998318af34615be9d365c87fedc72a.tar.gz
lite-xl-plugins-21799d1c0f998318af34615be9d365c87fedc72a.zip
language_go: add syntax support for Go generic functions
-rw-r--r--plugins/language_go.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/language_go.lua b/plugins/language_go.lua
index e1c96b2..0532784 100644
--- a/plugins/language_go.lua
+++ b/plugins/language_go.lua
@@ -18,7 +18,8 @@ syntax.add {
{ pattern = "-?%.?%d+f?", type = "number" },
{ pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
{ pattern = ":=", type = "operator" },
- { pattern = "[%a_][%w_]*%f[(]", type = "function" },
+ { pattern = "[%a_][%w_]*%f[(]", type = "function" }, -- function call
+ { pattern = "func()[%s].*[%a_][%w_]*()%f[%[(]", type = {"keyword", "function", "normal"} }, -- function statement
{ pattern = "[%a_][%w_]*", type = "symbol" },
},
symbols = {
@@ -35,8 +36,8 @@ syntax.add {
["const"] = "keyword",
["package"] = "keyword",
["import"] = "keyword",
- ["func"] = "keyword",
["var"] = "keyword",
+ ["func"] = "keyword",
["type"] = "keyword",
["interface"] = "keyword",
["select"] = "keyword",