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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.yaml.sublime.syntax keyword.other.variable variable.other</string>
<string>source.yaml.sublime.syntax variable.other.constant</string>
<key>settings</key>
<dict>
<key>showInIndexedReferenceList</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"auto_complete_triggers": [
{ "selector": "punctuation.separator.scope-segments.sublime-syntax" },
],
"auto_complete_selector": "source - comment - (source.regexp - keyword.other.variable)",
"auto_complete_selector": "source - comment - (source.regexp - meta.interpolation)",
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ contexts:
pop: true
- match: ''
set:
- meta_scope: string.unquoted.plain.out.yaml entity.name.function.context.sublime-syntax
- meta_scope: string.unquoted.plain.out.yaml entity.name.class.context.sublime-syntax
- match: '{{_flow_scalar_end_plain_out}}'
pop: true

Expand Down Expand Up @@ -551,7 +551,7 @@ contexts:
pop: true
# local includes
- match: '[\w-]+{{_flow_scalar_end_plain_in}}' # matches until first '/' or ',' or ']'
scope: variable.other.sublime-syntax
scope: variable.other.context.sublime-syntax
# We don't recognize this anything else, so just match as string
- match: ''
set:
Expand Down Expand Up @@ -775,11 +775,11 @@ contexts:

regexp_variable:
- match: '(\{\{)([a-zA-Z_0-9]+)(\}\})'
scope: meta.variable.sublime-syntax keyword.other.variable.sublime-syntax
scope: meta.interpolation.sublime-syntax
captures:
1: punctuation.definition.variable.begin.sublime-syntax
2: variable.other.sublime-syntax
3: punctuation.definition.variable.end.sublime-syntax
1: punctuation.section.interpolation.begin.sublime-syntax
2: variable.other.constant.sublime-syntax
3: punctuation.section.interpolation.end.sublime-syntax
push: regexp_quantifier_pop

regexp_quantifier_pop:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>scope</key>
<string>source.yaml.sublime.syntax entity.name.function.context</string>
<string>source.yaml.sublime.syntax entity.name.class.context</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ variables:


x9: '{{im_a_variable}}'
# ^^^^^^^^^^^^^^^^^ meta.variable.sublime-syntax keyword.other.variable.sublime-syntax
# ^^^^^^^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^^^^^^^^^^^ meta.interpolation.sublime-syntax
# ^^ punctuation.section.interpolation.begin.sublime-syntax
# ^^^^^^^^^^^^^ variable.other.constant.sublime-syntax
# ^^ punctuation.section.interpolation.end.sublime-syntax

x10: '''{{identifier}}(?!\'')\b'
# ^^ constant.character.escape.yaml
Expand Down Expand Up @@ -149,8 +151,8 @@ variables:
| {{duration_units}}
| {{frequency_units}}
| {{resolution_units}} )\b
# ^^^^^^^^^^^^^^^^^^^^ meta.variable.sublime-syntax keyword.other.variable.sublime-syntax
# ^^^^^^^^^^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^^^^^^^^^^^^^^ meta.interpolation.sublime-syntax
# ^^^^^^^^^^^^^^^^ variable.other.constant.sublime-syntax

'null': |-
# ^^^^^^ string.quoted.single.yaml
Expand All @@ -166,7 +168,7 @@ contexts:
# <- meta.block.contexts keyword.control.flow.contexts.sublime-syntax - meta.block.variables

main:
# ^^^^ entity.name.function.context.sublime-syntax
# ^^^^ entity.name.class.context.sublime-syntax
- include: scope:source.json
# ^^^^^^^ string.unquoted.plain.out.yaml keyword.operator.include.sublime-syntax
apply_prototype: true
Expand All @@ -177,15 +179,15 @@ contexts:
#<- - meta.expect-include - meta.expect-context-list-or-content - meta.expect-context-list

context_name:
# ^^^^^^^^^^^^ entity.name.function.context.sublime-syntax
# ^^^^^^^^^^^^ entity.name.class.context.sublime-syntax
- captures:
# ^^^^^^^^ string.unquoted.plain.out.yaml storage.type.captures.sublime-syntax
1: name
another_context_name:
# ^ entity.name.function.context.sublime-syntax
# ^ entity.name.class.context.sublime-syntax
- captures:
another_context_name:
# ^ entity.name.function.context.sublime-syntax
# ^ entity.name.class.context.sublime-syntax

- meta_append: true
# ^^^^^^^^^^^ storage.modifier.context-extension.sublime-syntax
Expand All @@ -203,12 +205,12 @@ contexts:
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.include.sublime-syntax string
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ support.module.file-path.sublime-syntax
# ^ punctuation.separator.context-name.sublime-syntax - comment
# ^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^ variable.other.context.sublime-syntax
- include: JSON.sublime-syntax#comments
#<- - meta.expect-include - meta.expect-context-list-or-content - meta.expect-context-list
# ^^^^^^^^^^^^^^^^^^^ support.module.file-path.sublime-syntax
# ^ punctuation.separator.context-name.sublime-syntax
# ^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^ variable.other.context.sublime-syntax

- include: Packages/JSON/ #JSON.sublime-syntax#comment
#<- - meta.expect-include - meta.expect-context-list-or-content - meta.expect-context-list
Expand All @@ -218,7 +220,7 @@ contexts:
# ^^^^^^ support.type.include.sublime-syntax
# ^ punctuation.definition.scope-include.sublime-syntax
# ^ punctuation.separator.context-name.sublime-syntax - comment
# ^^^^^^^^^^^^^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^^^^^^^^^^^^^ variable.other.context.sublime-syntax

- push: [main, Packages/JSON/JSON.sublime-syntax#comment]
#<- - meta.expect-include - meta.expect-context-list-or-content - meta.expect-context-list
Expand All @@ -231,7 +233,7 @@ contexts:
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.include.sublime-syntax string
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ support.module.file-path.sublime-syntax
# ^ punctuation.separator.context-name.sublime-syntax
# ^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^ variable.other.context.sublime-syntax
# ^ punctuation.definition.array.end.sublime-syntax
set: Packages/JSON/JSON.sublime-syntax#comment
# ^ - meta.expect-include - meta.expect-context-list-or-content - meta.expect-context-list
Expand Down Expand Up @@ -390,7 +392,7 @@ contexts: !mytag
#^^^^^^^ string.unquoted.plain.out.yaml keyword.control.flow.contexts.sublime-syntax
# ^^^^^^ storage.type.tag-handle.yaml
main: !mytag
# ^^^^ entity.name.function.context.sublime-syntax
# ^^^^ entity.name.class.context.sublime-syntax
# ^^^^^^ storage.type.tag-handle.yaml
- match: !mytag abc+
# ^^^^^ keyword.other.match.sublime-syntax
Expand All @@ -399,7 +401,7 @@ contexts: !mytag
push: !mytag scope
# ^^^^ keyword.control.flow.push.sublime-syntax
# ^^^^^^ storage.type.tag-handle.yaml
# ^^^^^ variable.other.sublime-syntax
# ^^^^^ variable.other.context.sublime-syntax
pop: !mytag true
# ^^^ keyword.control.flow.pop.sublime-syntax
# ^^^^^^ storage.type.tag-handle.yaml
Expand All @@ -411,16 +413,16 @@ contexts: !mytag
push:
!mytag scope
# ^^^^^^ storage.type.tag-handle.yaml
# ^^^^^ variable.other.sublime-syntax
# ^^^^^ variable.other.context.sublime-syntax

- match: foo
push: scope
# ^^^^^ meta.include.sublime-syntax string.unquoted.plain.out.yaml variable.other.sublime-syntax
# ^^^^^ meta.include.sublime-syntax string.unquoted.plain.out.yaml variable.other.context.sublime-syntax

- match: foo
push:
scope
# ^^^^^ meta.include.sublime-syntax string.unquoted.plain.out.yaml variable.other.sublime-syntax
# ^^^^^ meta.include.sublime-syntax string.unquoted.plain.out.yaml variable.other.context.sublime-syntax

- match: foo
push:
Expand Down Expand Up @@ -450,14 +452,14 @@ contexts: !mytag
# ^^^^^ meta.context-list-or-content meta.include.sublime-syntax - meta.expect-context-list-or-content
# ^ meta.context-list-or-content.sublime-syntax - meta.expect-context-list-or-content - meta.include
# ^ punctuation.definition.block.sequence.item.yaml
# ^^^^^ string.unquoted.plain.out.yaml variable.other.sublime-syntax
# ^^^^^ string.unquoted.plain.out.yaml variable.other.context.sublime-syntax
- match
#<- meta.context-list.sublime-syntax - meta.include - meta.expect-context-list-or-content - meta.context-list-or-content
# ^^ meta.context-list.sublime-syntax - meta.include
# ^^^^^ meta.context-list meta.include.sublime-syntax
# ^ meta.context-list.sublime-syntax - meta.include
# ^ punctuation.definition.block.sequence.item.yaml
# ^^^^^ string.unquoted.plain.out.yaml variable.other.sublime-syntax
# ^^^^^ string.unquoted.plain.out.yaml variable.other.context.sublime-syntax
- scope:source.yaml
# ^^ meta.context-list.sublime-syntax - meta.include
# ^^^^^^^^^^^^^^^^^ meta.context-list meta.include.sublime-syntax
Expand Down Expand Up @@ -492,7 +494,7 @@ contexts: !mytag
# ^^ meta.context-list-or-content.sublime-syntax
# ^^^^^^^^^ meta.context-list-or-content.sublime-syntax meta.include.sublime-syntax
# ^ punctuation.definition.block.sequence.item.yaml
# ^^^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^^^ variable.other.context.sublime-syntax
- - meta_scope: meta
# ^ - meta.anonymous-context
# ^^^^^^^^^^^^^^^^^^^^^ meta.anonymous-context.sublime-syntax
Expand All @@ -508,13 +510,13 @@ contexts: !mytag
# ^^^ meta.context-list.sublime-syntax
# ^^^^^^^^^ meta.context-list.sublime-syntax meta.include.sublime-syntax
# ^ punctuation.definition.block.sequence.item.yaml
# ^^^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^^^ variable.other.context.sublime-syntax
- context-3
#<- - meta.anonymous-context
# ^^^ meta.context-list.sublime-syntax
# ^^^^^^^^^ meta.context-list.sublime-syntax meta.include.sublime-syntax
# ^ punctuation.definition.block.sequence.item.yaml
# ^^^^^^^^^ variable.other.sublime-syntax
# ^^^^^^^^^ variable.other.context.sublime-syntax

- match: foo
push:
Expand All @@ -536,7 +538,7 @@ contexts: !mytag
branch:
# ^^^^^^ string.unquoted.plain.out.yaml keyword.control.flow.push.sublime-syntax
- a
# ^ string.unquoted.plain.out.yaml variable.other.sublime-syntax
# ^ string.unquoted.plain.out.yaml variable.other.context.sublime-syntax
- b
fail: point
# ^ string.unquoted.plain.out.yaml keyword.control.flow.break.sublime-syntax
Expand Down
8 changes: 4 additions & 4 deletions plugins/syntax_dev/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
)
TPL_CONTEXT = CompletionTemplate(
format=sublime.COMPLETION_FORMAT_SNIPPET,
kind=(sublime.KIND_ID_KEYWORD, 'c', 'Context'),
kind=(sublime.KIND_ID_TYPE, 'c', 'Context'),
suffix=":\n ",
)
TPL_FUNCTION = CompletionTemplate(
Expand Down Expand Up @@ -237,7 +237,7 @@ def match_selector(selector, offset=0):
result = None

# None of our business
if not match_selector("- comment - (source.regexp - keyword.other.variable)"):
if not match_selector("- comment - (source.regexp - meta.interpolation)"):
result = None

# Scope name completions based on our scope_data database
Expand Down Expand Up @@ -275,7 +275,7 @@ def match_selector(selector, offset=0):
result = self._complete_syntax_file()

# Auto-completion for variables in match patterns using 'variables' keys
elif match_selector("keyword.other.variable"):
elif match_selector("meta.interpolation"):
result = self._complete_variable()

else:
Expand All @@ -302,7 +302,7 @@ def _complete_context(self, prefix, locations):

return format_completions(
[(self.view.substr(r), self.view.rowcol(r.begin())[0] + 1)
for r in self.view.find_by_selector("entity.name.function.context")],
for r in self.view.find_by_selector("entity.name.class.context")],
annotation="",
kind=TPL_CONTEXT.kind,
)
Expand Down
Loading