Skip to content

Commit 49c79f9

Browse files
committed
Add meta scopes for log entry content in logfile syntax
1 parent b75baad commit 49c79f9

File tree

2 files changed

+86
-32
lines changed

2 files changed

+86
-32
lines changed

LaTeXTools Log.sublime-syntax

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,30 +288,59 @@ contexts:
288288
# errors
289289
- match: '^[^:]*Error:'
290290
scope: markup.error.log
291+
push: log-error-body
291292
- match: '^!.*'
292293
scope: markup.error.log
294+
push: log-exception-body
293295
# warnings
294296
- match: '^[^:]*(?:Overfull|Underfull)'
295297
scope: markup.warning.log
296-
embed: box-warning-content
298+
embed: log-box-warning-body
297299
escape: \[\]$|(?=^\s*(?:\[(?:\d+|[^\]]+\])$)|Overfull|Underfull\b)
298300
escape_captures:
299301
0: meta.warning.box.log punctuation.terminator.log
300302
- match: '^[^:]*(?:Warning|warning \([^)]*\)):'
301303
scope: markup.warning.log
304+
push: log-warning-body
302305
- match: '^[^:]*:\d*:.*'
303306
scope: markup.warning.log
307+
push: log-warning-body
304308
# info
305309
- match: '^[^:]*(?:Info|Note|Summary):'
306310
scope: markup.info.log
311+
push: log-info-body
307312

308313
block-comment-body:
309314
- meta_scope: comment.line.log
310315
- match: ^.{79}\n # consume anything which has 79 chars
311316
- match: \n
312317
pop: 1
313318

314-
box-warning-content:
319+
log-error-body:
320+
- meta_scope: meta.error.log
321+
- match: (?:^|\.)$
322+
pop: 1
323+
- include: content
324+
325+
log-exception-body:
326+
- meta_scope: meta.exception.log
327+
- match: ^$
328+
pop: 1
329+
- include: content
330+
331+
log-info-body:
332+
- meta_scope: meta.info.log
333+
- match: (?:^|\.)$
334+
pop: 1
335+
- include: content
336+
337+
log-warning-body:
338+
- meta_scope: meta.warning.log
339+
- match: (?:^|\.)$
340+
pop: 1
341+
- include: content
342+
343+
log-box-warning-body:
315344
- meta_scope: meta.warning.box.log
316345
- include: content
317346

tests/syntax/syntax_test_latex.log

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,8 @@ command)
656656
# -----------------------------------------------------------------------------
657657

658658
! Emergency stop.
659-
# <- markup.error.log
660-
#^^^^^^^^^^^^^^^^ markup.error.log
659+
# <- meta.exception.log markup.error.log
660+
#^^^^^^^^^^^^^^^^ meta.exception.log markup.error.log
661661

662662
Package foo Error: This is a message.
663663
# <- markup.error.log
@@ -684,41 +684,55 @@ LaTeX Info: Redefining \( and \) on input line 2958.
684684
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.brackets - punctuation
685685

686686
LaTeX Info: Redefining \{ and \} on input line 2959.
687-
#^^^^^^^^^^ markup.info.log
688-
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.brackets - punctuation
687+
# <- meta.info.log markup.info.log
688+
#^^^^^^^^^^ meta.info.log markup.info.log
689+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
689690

690691
# ----------
691692
# Issue 1105: Support FiXme package
692693

693694
FiXme Summary: Number of notes: 1,
694-
#^^^^^^^^^^^^^ markup.info.log
695+
# <- meta.info.log markup.info.log
696+
#^^^^^^^^^^^^^ meta.info.log markup.info.log
697+
# ^^^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
695698
(FiXme) Number of warnings: 1,
696699
(FiXme) Number of errors: 1,
697700
(FiXme) Number of fatal errors: 1,
698701
(FiXme) Total: 4.
699702

700703
FiXme Note: 'NOTE' on input line 7.
701-
#^^^^^^^^^^ markup.info.log
704+
# <- meta.info.log markup.info.log
705+
#^^^^^^^^^^ meta.info.log markup.info.log
706+
# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
702707

703708
FiXme Warning: 'WARNING' on input line 8.
704-
#^^^^^^^^^^^^^ markup.warning.log
709+
# <- meta.warning.log markup.warning.log
710+
#^^^^^^^^^^^^^ meta.warning.log markup.warning.log
711+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
705712

706713
FiXme Error: 'ERROR' on input line 9.
707-
#^^^^^^^^^^^ markup.error.log
714+
# <- meta.error.log markup.error.log
715+
#^^^^^^^^^^^ meta.error.log markup.error.log
716+
# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
708717

709718
! Package FiXme Error: 'FATAL' fatal error left in final version.
710-
#^^^^^^^^^^^^^^^^^^^^^ markup.error.log
719+
# <- meta.error.log markup.error.log
720+
#^^^^^^^^^^^^^^^^^^^^^ meta.error.log markup.error.log
721+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
711722

712723
! Argument of \textit has an extra }.
713-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.error.log
724+
# <- meta.exception.log markup.error.log
725+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.exception.log markup.error.log
714726
<inserted text>
715-
# <- string.quoted.other.log punctuation.definition.string.begin.log
716-
#^^^^^^^^^^^^^^ string.quoted.other.log
727+
# <- meta.exception.log string.quoted.other.log punctuation.definition.string.begin.log
728+
#^^^^^^^^^^^^^^ meta.exception.log string.quoted.other.log
717729
# ^ punctuation.definition.string.end.log
718730
\par
719731
# ^^^^ meta.function-call.latex support.function.latex
720732
# ^ punctuation.definition.variable.latex
721733
l.5 \section\textit
734+
# <- meta.exception.log
735+
#^^^^^^^^^^^^^^^^^^^ meta.exception.log
722736
# ^^^^^^^^^^^^^^^ meta.function-call.latex support.function.latex
723737
# ^ punctuation.definition.variable.latex
724738
# ^ punctuation.definition.variable.latex
@@ -732,12 +746,15 @@ l.5 \section\textit
732746
# Issue 1233
733747

734748
pdfTeX warning (dest): name{summary} has been referenced but does not exist,
735-
#^^^^^^^^^^^^^^^^^^^^^ markup.warning.log
749+
# <- meta.warning.log markup.warning.log
750+
#^^^^^^^^^^^^^^^^^^^^^ meta.warning.log markup.warning.log
751+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
736752
# ^^^^^^^^^ string.quoted.other.log
737753
# ^ punctuation.definition.string.begin.log
738754
# ^ punctuation.definition.string.end.log
739755
replaced by a fixed one
740-
# <- - markup
756+
# <- meta.warning.log - markup
757+
#^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
741758

742759
# -----------------------------------------------------------------------------
743760
# nested log entries
@@ -748,43 +765,50 @@ replaced by a fixed one
748765
#^^^^^^^^^^^^^^^^^^^^ meta.block.log entity.name.section.filename.log
749766

750767
! fatal error.
751-
#^^^^^^^^^^^^ meta.block.log markup.error.log
768+
# <- meta.exception.log markup.error.log
769+
#^^^^^^^^^^^^^ meta.exception.log markup.error.log
752770

753771
Error: This is a message.
754-
# <- markup.error.log
755-
#^^^^^ markup.error.log
772+
# <- meta.error.log markup.error.log
773+
#^^^^^ meta.error.log markup.error.log
774+
# ^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
756775

757776
Warning: This is a message.
758-
# <- markup.warning.log
759-
#^^^^^^^ markup.warning.log
777+
# <- meta.warning.log markup.warning.log
778+
#^^^^^^^ meta.warning.log markup.warning.log
779+
# ^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
760780

761781
Info: This is a message.
762-
# <- markup.info.log
763-
#^^^^ markup.info.log
782+
# <- meta.info.log markup.info.log
783+
#^^^^ meta.info.log markup.info.log
784+
# ^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
764785

765786
Note: This is a message.
766-
# <- markup.info.log
767-
#^^^^ markup.info.log
787+
# <- meta.info.log markup.info.log
788+
#^^^^ meta.info.log markup.info.log
789+
# ^^^^^^^^^^^^^^^^^^^ meta.info.log - markup
768790

769791
(/opt/TeX/texmf-dist/tex/latex/hyperref/hyperref.sty
770792
# <- meta.block.log meta.block.log punctuation.section.block.begin.log
771793
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log entity.name.section.filename.log
772794
Package hyperref Error: Option `pdfauthor' not found,
773795
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
774-
#^^^^^^^^^^^^^^^^^^^^^^ markup.error.log
796+
#^^^^^^^^^^^^^^^^^^^^^^ meta.error.log markup.error.log
797+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.error.log - markup
775798
# ^^^^^^^^^^^ string.quoted.single.log
776799
# ^ punctuation.definition.string.begin.log
777800
# ^ punctuation.definition.string.end.log
778801

779802
Package hyperref Warning: Option `pdfauthor' has already been used,
780803
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
781-
#^^^^^^^^^^^^^^^^^^^^^^^^ markup.warning.log
804+
#^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log markup.warning.log
805+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.warning.log - markup
782806
# ^^^^^^^^^^^ string.quoted.single.log
783807
# ^ punctuation.definition.string.begin.log
784808
# ^ punctuation.definition.string.end.log
785809
(hyperref) setting the option has no effect on input line 13.
786810
# <- meta.block.log meta.block.log meta.parens.log punctuation.section.parens.begin.log
787-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log
811+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.warning.log - markup
788812
#^^^^^^^^^ meta.parens.log
789813
# ^ punctuation.section.parens.end.log
790814
)
@@ -796,20 +820,21 @@ Document Class: scrbook 2023/07/07 v3.41 KOMA-Script document class (book)
796820
# <- meta.block.log meta.block.log comment.line.log
797821
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log comment.line.log
798822
Class scrbook Info: using compatibility default ``runin=bysign''
799-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
800-
#^^^^^^^^^^^^^^^^^^ markup.info.log
823+
#^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.info.log markup.info.log
824+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.info.log - markup
801825
# ^^^^^^^^^^^^^^^^ string.quoted.double.log
802826
# ^^ punctuation.definition.string.begin.log
803827
# ^^ punctuation.definition.string.end.log
804828
(scrbook) for `\section on input line 6001.
805-
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log
829+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.log meta.block.log meta.info.log - markup
806830
#^^^^^^^^ meta.parens.log
807831
# ^ punctuation.section.parens.end.log
808832
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single.log
809833
# ^ punctuation.definition.string.begin.log
810834
# ^ punctuation.definition.string.end.log
835+
811836
)
812-
# <- meta.block.log meta.block.log punctuation.section.block.end.log
837+
# <- meta.block.log meta.block.log punctuation.section.block.end.log - meta.info
813838
#^ meta.block.log - meta.block meta.block - punctuation
814839

815840
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)