Ответ 1
Этот код работает (но не с комментариями):
{ scopeName = 'source.whitespace';
patterns = (
{ name = 'source.invalid.trailing-whitespace';
match = '(\s+)$';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
},
);
}
PS: Я изменил "источник" на "source.whitespace"
Для изменения комментариев в грамматике Python:
{ name = 'comment.line.number-sign.python';
match = '(#).*$\n?';
captures = { 1 = { name = 'punctuation.definition.comment.python'; }; };
},
В:
{ name = 'comment.line.number-sign.python';
match = '(#).*?(\s*)$\n?';
captures = {
1 = { name = 'punctuation.definition.comment.python'; };
2 = { name = 'invalid.trailing-whitespace'; };
};
},
Вам нужно добавить "include" в определении языка Python, где:
:
patterns = (
{ name = 'comment.line.number-sign.python';
:
Включается:
:
patterns = (
{ include = 'source.whitespace'; },
{ name = 'comment.line.number-sign.python';
: