clifford-github / sublime-ansible

Syntax highlighting for Ansible
MIT License
135 stars 11 forks source link

Coloring is confused by quotes in multiline strings #32

Closed Nothing4You closed 1 year ago

Nothing4You commented 1 year ago

22.12.0

---

- name: register some variables
  set_fact:
    foo: bar
    baz: |
      foo
      bar
    qux: asdf

- name: register some variables
  set_fact:
    foo: bar
    baz: |
      foo'
      bar
    qux: asdf

- name: register some variables
  set_fact:
    foo: bar
    baz: |
      foo
      bar
    qux: asdf

- name: register some variables
  set_fact:
    foo: bar
    baz: |
      foo'
      bar
    qux: asdf
image
mrmeszaros commented 1 year ago

Similarly in quoted shell scripts:

---

- name: run shell task
  shell: locale | cut -d = -f 2 | tr -d '"' | sort -u | grep -v -e '^$'
  changed_when: no
  register: shell_task

- name: debug
  debug: var=shell_task.stdout_lines

- name: run shell task
  shell: locale | cut -d = -f 2 | tr -d '"' | sort -u | grep -v -e '^$'
  changed_when: no
  register: shell_task

- name: debug
  debug: var=shell_task.stdout_lines

sublime-ansible-bug

Here the the quotation mark in tr -d '"' trips off the Ansible.sublime-syntax string scope - though it shouldn't as it is already inside of a YAML string literal.

killua99 commented 1 year ago

Yes, already made some fix, is on master I'll test it a but further before tag a new release, if you know how to checkout master inside your sublime text packages and test it out to get your feedback will appreciate it.

Nothing4You commented 1 year ago

looks good now, in f83b56aa0a236264daa291c24f586fdcb2bedee4 I don't see any issues caused by quotes anymore after looking at a few of my files, thanks.