Added Todo syntax highlighter
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
name: todo.txt
|
||||
scope: text.todo
|
||||
variables:
|
||||
date: '(\d{4}-\d{2}-\d{2}(?:\s+|$))'
|
||||
prio: '(\([A-Z]\)(?:\s+|$))'
|
||||
contexts:
|
||||
main:
|
||||
- match: '^\s*x\s'
|
||||
push: done
|
||||
|
||||
- match: ""
|
||||
push: todo
|
||||
|
||||
done:
|
||||
- meta_scope: comment.line
|
||||
- include: check_prio
|
||||
|
||||
todo:
|
||||
- meta_scope: text.todo
|
||||
- include: check_prio
|
||||
|
||||
desc_fallback:
|
||||
- match: '\s'
|
||||
- match: ""
|
||||
push: desc_start
|
||||
|
||||
check_prio:
|
||||
- match: "{{date}}"
|
||||
scope: constant.numeric
|
||||
push: check_date2
|
||||
|
||||
- match: "{{prio}}"
|
||||
scope: keyword
|
||||
push: check_date
|
||||
|
||||
- include: desc_fallback
|
||||
|
||||
check_date:
|
||||
- match: "{{date}}"
|
||||
scope: constant.numeric
|
||||
set: check_date2
|
||||
- include: desc_fallback
|
||||
|
||||
check_date2:
|
||||
- match: "{{date}}"
|
||||
scope: constant.numeric
|
||||
set: desc_start
|
||||
- include: desc_fallback
|
||||
|
||||
# Any preceeding whitespace has been read
|
||||
# safe to assume start of match is succeeds whitespace
|
||||
desc_start:
|
||||
- match: '@\S+'
|
||||
scope: string
|
||||
push: desc
|
||||
- match: '\+\S+'
|
||||
scope: variable.function
|
||||
push: desc
|
||||
- match: '\b([^\s:]+):([^\s:]+)\b'
|
||||
captures:
|
||||
1: entity.name
|
||||
2: entity.name.tag
|
||||
push: desc
|
||||
- match: ""
|
||||
set: desc
|
||||
|
||||
desc:
|
||||
- match: '(?:\s|^)@\S+'
|
||||
scope: string
|
||||
- match: '(?:\s|^)\+\S+'
|
||||
scope: variable.function
|
||||
- match: '\b([^\s:]+):([^\s:]+)\b'
|
||||
captures:
|
||||
1: entity.name
|
||||
2: entity.name.tag
|
||||
Reference in New Issue
Block a user