clifford-github / sublime-ansible

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

Strange issues with the Toggle Comment command #40

Closed jklaiho closed 9 months ago

jklaiho commented 10 months ago

I'm seeing strange behaviour from Sublime Text (build 4152) Toggle Comment command and this package.

I saw issue #36, but I'm running v22.12.1, and this is happening.

Assume the following YAML (line numbers added for referring to selection regions):

1  ---
2  - name: test
3    command: sleep 1
4
5  - block:
6      - name: test
7        command: sleep 1

Some test cases for toggling selected lines:

Individual line test cases:

If I set the syntax of the file as just YAML, both non-working cases with the Ansible syntax start working.

In addition, if I toggle comments ON for lines 2-3 or 2-7 while in YAML syntax, then switch back to the Ansible syntax, I can toggle comments OFF, but not back ON.

So, it seems that if the selection region starts with a top-level - name: something section, toggling comments ON fails. However, that same section inside a - block section toggles just fine. Even if I add blank lines on top of line 2 and start the selection from there, the toggling fails.

killua99 commented 10 months ago

Info:

Sublime Text version: 4152 Package version: 22.12.1

This is the result:

untitled_—_sublime-ansible

And toggle, has the same issue.

Gonna have to review rules since this package start from YAML rules and overwrite, but the comment is hard to debug.

killua99 commented 9 months ago

@jklaiho before I commit a new release tag, could you please download the master branch in your local, and git it a try.

jklaiho commented 9 months ago

@killua99 Yep, the master branch worked fine on all of the seven test cases I listed in my original issue!

killua99 commented 9 months ago

Nice, gonna close and build a new release.