diff options
-rw-r--r-- | script/core/semantic-tokens.lua | 10 | ||||
-rw-r--r-- | script/parser/ast.lua | 18 |
2 files changed, 20 insertions, 8 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index 37eabda7..1c59d80d 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -187,6 +187,16 @@ return function (uri, start, finish) end end) + for _, comm in ipairs(ast.comms) do + if comm.semantic then + results[#results+1] = { + start = comm.start, + finish = comm.finish, + type = define.TokenTypes.comment, + } + end + end + table.sort(results, function (a, b) return a.start < b.start end) diff --git a/script/parser/ast.lua b/script/parser/ast.lua index 127bb08c..68fd59d7 100644 --- a/script/parser/ast.lua +++ b/script/parser/ast.lua @@ -333,10 +333,11 @@ local Defs = { } } end - return { - type = 'nonstandardSymbol.comment', - start = start1, - finish = finish2 - 1, + PushComment { + start = start1, + finish = finish2 - 1, + semantic = true, + text = '', } end, CCommentPrefix = function (start, finish, commentFinish) @@ -356,10 +357,11 @@ local Defs = { } } end - return { - type = 'nonstandardSymbol.comment', - start = start, - finish = commentFinish - 1, + PushComment { + start = start, + finish = commentFinish - 1, + semantic = true, + text = '', } end, String = function (start, quote, str, finish) |