Skip to content

Commit

Permalink
[YAML] Fix tokenization issue (sublimehq#2218)
Browse files Browse the repository at this point in the history
Fixes sublimehq/sublime_text#3110
Fixes sublimehq/sublime_text#3215 (partly)

This PR proposes a change to avoid the first letter of mapping keywords not being detected as separate token, which results in wrong autocompletion results.
  • Loading branch information
deathaxe authored Jul 14, 2020
1 parent 85fcc33 commit fd33a5b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions YAML/YAML.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ contexts:
# TODO consider scoping meaningful trailing whitespace for color
# schemes with background color definitions.
- meta_scope: string.quoted.double.yaml
meta_include_prototype: false
- meta_include_prototype: false
- match: '{{c_ns_esc_char}}'
scope: constant.character.escape.double-quoted.yaml
- match: \\\n
Expand All @@ -317,7 +317,7 @@ contexts:
scope: punctuation.definition.string.begin.yaml
push:
- meta_scope: string.quoted.single.yaml
meta_include_prototype: false
- meta_include_prototype: false
- match: "''"
scope: constant.character.escape.single-quoted.yaml
- match: "'"
Expand Down Expand Up @@ -423,21 +423,21 @@ contexts:
# http://yaml.org/spec/1.2/spec.html#style/flow/plain
# ns-plain(n,c) (c=flow-out, c=block-key)
- include: flow-scalar-plain-out-implicit-type
- match: '{{ns_plain_first_plain_out}}'
- match: (?={{ns_plain_first_plain_out}})
push:
- meta_scope: string.unquoted.plain.out.yaml
meta_include_prototype: false
- meta_include_prototype: false
- match: '{{_flow_scalar_end_plain_out}}'
pop: true

flow-scalar-plain-in:
# http://yaml.org/spec/1.2/spec.html#style/flow/plain
# ns-plain(n,c) (c=flow-in, c=flow-key)
- include: flow-scalar-plain-in-implicit-type
- match: '{{ns_plain_first_plain_in}}'
- match: (?={{ns_plain_first_plain_in}})
push:
- meta_scope: string.unquoted.plain.in.yaml
meta_include_prototype: false
- meta_include_prototype: false
- match: '{{_flow_scalar_end_plain_in}}'
pop: true

Expand Down Expand Up @@ -502,10 +502,10 @@ contexts:
- include: flow-scalar-plain-in-implicit-type
- match: '{{_flow_scalar_end_plain_in}}'
pop: true
- match: '{{ns_plain_first_plain_in}}'
- match: (?={{ns_plain_first_plain_in}})
set:
- meta_scope: string.unquoted.plain.in.yaml entity.name.tag.yaml
meta_include_prototype: false
- meta_scope: meta.flow-pair.key.yaml string.unquoted.plain.in.yaml entity.name.tag.yaml
- meta_include_prototype: false
- match: '{{_flow_scalar_end_plain_in}}'
pop: true
- include: flow-node
Expand Down Expand Up @@ -534,7 +534,7 @@ contexts:
# note that we do not check if indentation is enough
set:
- meta_scope: string.unquoted.block.yaml
meta_include_prototype: false
- meta_include_prototype: false
- match: ^(?!\1|\s*$)
pop: true
- match: ^(?=\S) # the block is empty
Expand Down Expand Up @@ -588,10 +588,10 @@ contexts:
- include: flow-scalar-plain-out-implicit-type
- match: '{{_flow_scalar_end_plain_out}}'
pop: true
- match: '{{ns_plain_first_plain_out}}'
- match: (?={{ns_plain_first_plain_out}})
set:
- meta_scope: string.unquoted.plain.out.yaml entity.name.tag.yaml
meta_include_prototype: false
- meta_include_prototype: false
- match: '{{_flow_scalar_end_plain_out}}'
pop: true
- match: :(?=\s|$)
Expand Down

0 comments on commit fd33a5b

Please sign in to comment.