It seems that a comment terminated by a newline is causing the syntax highlighting to fail
You can find a minimalistic .tmLanguage to reproduce this here: https://gist.github.com/Sainan/dd35d23ffe36fc5713ad97c3f9437cc5
Which I have based on https://github.com/sumneko/lua.tmbundle
Newline Syntax Highlighting Bug
Sainan
#1
0 Likes
jfcherng
#2
Because you consume the \n
in https://gist.github.com/Sainan/dd35d23ffe36fc5713ad97c3f9437cc5#file-bug-tmlanguage-L72
Also curious about why you need another Lua syntax? Is the builtin one too lame?
https://gist.github.com/Sainan/dd35d23ffe36fc5713ad97c3f9437cc5#file-bug-tmlanguage-L84 should be </array>
by the way.
The following is OP’s corresponding sublime-syntax for those who don’t want to read tmlanguage.
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
name: Bug
file_extensions:
- lua
scope: source.lua
contexts:
main:
- match: '(^[ \t]+)?(?=--)'
captures:
1: punctuation.whitespace.comment.leading.lua
push:
- match: '(?!\G)((?!^)[ \t]+\n)?'
captures:
1: punctuation.whitespace.comment.trailing.lua
pop: true
- match: '--\[(=*)\['
captures:
0: punctuation.definition.comment.begin.lua
push:
- meta_scope: comment.block.lua
- match: '\]\1\]'
captures:
0: punctuation.definition.comment.end.lua
pop: true
- match: '--'
captures:
0: punctuation.definition.comment.lua
push:
- meta_scope: comment.line.double-dash.lua
- match: \n
pop: true
- match: \b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|function|local|in|)\b
scope: keyword.control.lua
0 Likes