Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 45 additions & 7 deletions Julia.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ variables:
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
# 3: constant.other.language-name.markdown


- match: '\\:'
scope: keyword.operator.julia meta.disable-completion.julia
- include: codesection
Expand Down Expand Up @@ -96,11 +115,11 @@ contexts:
# pop: true

codesection:
- match: ^\s*((\#+(?!==))\s*(.+?)\s*(?:-{4,}|={4,}|#{4,})[ \t]*$\n?)
- match: ^(\# %% =+) ([^=]+) (=+)
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: \#=
Expand Down Expand Up @@ -522,7 +541,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
Expand Down Expand Up @@ -1034,15 +1053,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

Expand Down Expand Up @@ -1075,7 +1113,7 @@ contexts:
- include: brackets
- match: ''
pop: true
- match: \s*(:)
- match: (:)
captures:
1 : keyword.operator.colon.julia
- match: (\.)?(?=\()
Expand Down
9 changes: 7 additions & 2 deletions syntax_test_julia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -293,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


# ##
Expand Down Expand Up @@ -716,4 +721,4 @@ f(#=x::Int=#; kwargs...) = 1
# 101
foo(x::A{f(a)}) = 1
# <- meta.function.inline.julia entity.name.function.julia meta.generic-name.julia
# ^^^^ meta.function.inline.julia meta.function.parameters.julia meta.parametric-type.julia meta.parametric-type.parameters.julia meta.function-call.julia
# ^^^^ meta.function.inline.julia meta.function.parameters.julia meta.parametric-type.julia meta.parametric-type.parameters.julia meta.function-call.julia