From 6f1f2b4c359813275c2fb63720c85bd1baf54248 Mon Sep 17 00:00:00 2001 From: fredcallaway Date: Wed, 3 Nov 2021 10:42:30 -0400 Subject: [PATCH 1/5] test header --- syntax_test_julia.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syntax_test_julia.jl b/syntax_test_julia.jl index feb1b2b..68fad9c 100644 --- a/syntax_test_julia.jl +++ b/syntax_test_julia.jl @@ -10,6 +10,9 @@ =# # <- comment.block.number-equal-sign punctuation.definition.comment.number-equal-sign +# %% ==================== This is a test ==================== + + ## ## NUMBERS ==== ## From b6cea964328c09aa057f46c40ba49200f6f82606 Mon Sep 17 00:00:00 2001 From: fredcallaway Date: Wed, 3 Nov 2021 11:12:21 -0400 Subject: [PATCH 2/5] correctly detect name in # ---- section ----- --- Julia.sublime-syntax | 5 +++++ syntax_test_julia.jl | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Julia.sublime-syntax b/Julia.sublime-syntax index 615c3c1..173dfc5 100644 --- a/Julia.sublime-syntax +++ b/Julia.sublime-syntax @@ -96,6 +96,11 @@ contexts: # pop: true codesection: + - match: ^\s*((\#+(?!==)\s*[#%-= ]*)(\w+[\s\w]*)\s*(?:-{4,}|={4,}|#{4,})[ \t]*$\n?) + captures: + 1: comment.line.number-sign.julia + 2: punctuation.definition.comment.julia + 3: entity.name.section.julia - match: ^\s*((\#+(?!==))\s*(.+?)\s*(?:-{4,}|={4,}|#{4,})[ \t]*$\n?) captures: 1: comment.line.number-sign.julia diff --git a/syntax_test_julia.jl b/syntax_test_julia.jl index fe6001c..a852fa2 100644 --- a/syntax_test_julia.jl +++ b/syntax_test_julia.jl @@ -20,8 +20,11 @@ #===== #^ -comment.line.number-sign.julia entity.name.section.julia =====# +# ---- Code section ---- +# ^^^^ comment.line.number-sign.julia -entity.name.section.julia +# ^^^^^^^^^^^^ comment.line.number-sign.julia entity.name.section.julia +# ^^^^ comment.line.number-sign.julia -entity.name.section.julia -## ## NUMBERS ==== ## 0b101 From f141fbc8735d69d47204059b33c7622e74bc0462 Mon Sep 17 00:00:00 2001 From: fredcallaway Date: Sun, 23 Apr 2023 17:41:39 -0400 Subject: [PATCH 3/5] not sure --- Julia.sublime-syntax | 38 ++++++++++++++++++++++++++------------ syntax_test_julia.jl | 2 ++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Julia.sublime-syntax b/Julia.sublime-syntax index 173dfc5..9da6b78 100644 --- a/Julia.sublime-syntax +++ b/Julia.sublime-syntax @@ -96,16 +96,11 @@ contexts: # pop: true codesection: - - match: ^\s*((\#+(?!==)\s*[#%-= ]*)(\w+[\s\w]*)\s*(?:-{4,}|={4,}|#{4,})[ \t]*$\n?) + - match: ^(\# %% =+) ([^=]+) (=+) captures: 1: comment.line.number-sign.julia - 2: punctuation.definition.comment.julia - 3: entity.name.section.julia - - match: ^\s*((\#+(?!==))\s*(.+?)\s*(?:-{4,}|={4,}|#{4,})[ \t]*$\n?) - captures: - 1: comment.line.number-sign.julia - 2: punctuation.definition.comment.julia - 3: entity.name.section.julia + 2: entity.name.section.julia + 3: comment.line.number-sign.julia comments: - match: \#= @@ -527,7 +522,7 @@ contexts: - include: main struct-declarations: - - match: \b(struct)\s*({{symb_id}}) + - match: \b(struct)\s+({{symb_id}}) scope: meta.struct.julia captures: 1: storage.type.struct.julia keyword.declaration.struct.julia @@ -1039,15 +1034,34 @@ contexts: pop: true - include: main + function-call-keyword-arguments-only: + - meta_content_scope: meta.function-call.arguments.julia + - match: \) + scope: punctuation.section.arguments.end.julia + set: after-expression + - match: \, + scope: punctuation.separator.comma.julia + - include: function-call-keyword-arguments + - match: '{{symb_id}}(?=\s*(?:\,|\)|\.{3}))' + scope: variable.parameter.julia + push: after-expression + - include: main + function-call-arguments-group: - match: \( scope: punctuation.section.arguments.begin.julia set: - - meta_scope: meta.function-call.julia - - meta_content_scope: meta.function-call.arguments.julia + # - meta_scope: meta.function-call.julia + # - meta_content_scope: meta.function-call.arguments.julia + - meta_scope: meta.function-call.arguments.julia - match: \) scope: punctuation.section.arguments.end.julia set: after-expression + - match: \, + scope: punctuation.separator.comma.julia + - match: \; + scope: punctuation.separator.semicolon.julia + set: function-call-keyword-arguments-only - include: function-call-keyword-arguments - include: main @@ -1080,7 +1094,7 @@ contexts: - include: brackets - match: '' pop: true - - match: \s*(:) + - match: (:) captures: 1 : keyword.operator.colon.julia - match: (\.)?(?=\() diff --git a/syntax_test_julia.jl b/syntax_test_julia.jl index a852fa2..3eda225 100644 --- a/syntax_test_julia.jl +++ b/syntax_test_julia.jl @@ -296,6 +296,8 @@ # ^ meta.function.inline.julia meta.function.parameters.julia variable.parameter.julia # ^ meta.function.inline.julia meta.function.parameters.julia variable.parameter.julia + bar(x; y, kws...) +# ^ meta.function-call.arguments.julia variable.parameter.julia # ## From 4b00ac20ac39e1849ea4f396bae018c288186e80 Mon Sep 17 00:00:00 2001 From: fredcallaway Date: Sun, 23 Apr 2023 17:48:58 -0400 Subject: [PATCH 4/5] R string support --- Julia.sublime-syntax | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Julia.sublime-syntax b/Julia.sublime-syntax index 9da6b78..c86c26e 100644 --- a/Julia.sublime-syntax +++ b/Julia.sublime-syntax @@ -53,6 +53,21 @@ variables: contexts: main: # a helper to support emoji completion + - match: (R)(""") + captures: + 1: constant.other.language-name.markdown + 2: comment.line.number-sign.julia + embed: scope:source.r + embed_scope: rcall.julia + escape: (""") + escape_captures: + 1: comment.line.number-sign.julia + # captures: + # 1: punctuation.definition.raw.code-fence.begin.markdown + # 2: punctuation.definition.raw.code-fence.options.begin.markdown + # 3: constant.other.language-name.markdown + + - match: '\\:' scope: keyword.operator.julia meta.disable-completion.julia - include: codesection From ce2e50bf8e2a1451ee80f51d465ef506df4657d7 Mon Sep 17 00:00:00 2001 From: fredcallaway Date: Sun, 23 Apr 2023 18:19:43 -0400 Subject: [PATCH 5/5] expand rcall scope (hackily) --- Julia.sublime-syntax | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Julia.sublime-syntax b/Julia.sublime-syntax index c86c26e..2adebc8 100644 --- a/Julia.sublime-syntax +++ b/Julia.sublime-syntax @@ -54,14 +54,18 @@ contexts: main: # a helper to support emoji completion - match: (R)(""") + scope: rcall.julia captures: 1: constant.other.language-name.markdown 2: comment.line.number-sign.julia embed: scope:source.r embed_scope: rcall.julia escape: (""") + escape_scope: rcall.julia escape_captures: + 0: rcall.julia 1: comment.line.number-sign.julia + # captures: # 1: punctuation.definition.raw.code-fence.begin.markdown # 2: punctuation.definition.raw.code-fence.options.begin.markdown