forked from rust-lang/rust-enhanced
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCargo.sublime-syntax
94 lines (83 loc) · 3.18 KB
/
Cargo.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Cargo Build Results
file_extensions:
- rs
scope: source.build_results
variables:
result_prefix: '[1-9]\d* '
test_prefix: '^test .* \.{3} '
contexts:
main:
# Loosely organized by order of appearance
# comments the command run (as the previous syntax did)
- match: '^\[Running: cargo.*\]$'
scope: comment meta.command.cargo
# matches the build logs
- match: '^ {4}Blocking '
scope: markup.deleted.diff meta.blocking.cargo
- match: '^ {4}Updating '
scope: markup.inserted.diff meta.updating.cargo
- match: '^ {1}Downloading '
scope: markup.inserted.diff meta.downloading.cargo
- match: '^ {1}Documenting '
scope: markup.inserted.diff meta.documenting.cargo
- match: '^ {3}Compiling '
scope: markup.inserted.diff meta.compiling.cargo
- match: '^ {4}Finished '
scope: markup.inserted.diff meta.finished.cargo
- match: '^ {5}Running '
scope: markup.inserted.diff meta.running.cargo
- match: '^ {3}Doc-tests'
scope: markup.inserted.diff meta.doctests.cargo
# matches the build result
- match: '^(..[^:\n]*):(\d+):?(\d+)?:? '
scope: entity.name.filename meta.filename.cargo
- match: '^(note|warning): '
scope: variable.parameter meta.warning.cargo
- match: '^error: '
scope: message.error meta.error.cargo
# matches the test results: 'test <test_path> ... <ok|ignored|bench>'
- match: '{{test_prefix}}(ok)\b'
captures:
1: markup.inserted.diff meta.test_ok.cargo
- match: '{{test_prefix}}(ignored)\b'
captures:
1: markup.changed.diff meta.test_ignored.cargo
- match: '{{test_prefix}}(FAILED)\b'
captures:
1: markup.deleted.diff meta.test_failed.cargo
# benches are aligned, so they may have extra spaces before the '...'
- match: '^test .* +\.{3} (bench): +\d+'
captures:
1: markup.deleted.diff meta.bench.cargo
- match: '\bhelp:[\s\S]+$'
scope: markup.inserted.diff meta.help.cargo
# I don't know what this is
- match: '^\s{4}[\S\s]+,\s([\w,\s-]+\.[A-Za-z]{2}):(\d+)'
scope: message.error
- match: '^failures:\n'
scope: message.error meta.failures.cargo
# matches the line 'test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out'
- match: '^(test result:) (?:(ok)|(FAILED))\.'
captures:
1: variable.parameter meta.test_result.cargo
2: markup.inserted.diff meta.ok_result.cargo
3: invalid meta.fail_result.cargo
push: test-result-counts
# comments the logs sublime adds
- match: '^\[Finished in \d+\.\d+s( with exit code .+)?\]$'
set:
- meta_scope: comment meta.sublime.cargo
test-result-counts:
- match: '{{result_prefix}}passed(?=;)'
scope: markup.inserted.diff meta.passed_count.cargo
- match: '{{result_prefix}}failed(?=;)'
scope: markup.deleted.diff meta.fail_count.cargo
- match: '{{result_prefix}}ignored(?=;)'
scope: markup.changed.diff meta.ignore_count.cargo
- match: '{{result_prefix}}measured(?=;)'
scope: support.constant meta.measured_count.cargo
- match: '\n'
pop: true