Thursday, October 29, 2015

Re: vim: yaml syntax highlighting, Problem with variables



2015-10-29 17:52 GMT+03:00 Thomas Bodine -X (tbodine - KFORCE INC at Cisco) <tbodine@cisco.com>:

 

Nikolai

 

There appears to be a problem with coloring variables in vim with Ansible yaml files, at least to me

 

Whenever an Ansible variable appears the first double-quote is ignored  and the second takes effect in a way where everything until the next double-quote appears to be a part of the same string.


    ​msg="Backup failed with error {{ syncsync_result.stderr }}"

is a string

    '​msg="Backup failed with error {{ syncsync_result.stderr }}"'

: quotes are not special here, so they *must not* be highlighted as if there was any quoted string. Error with second quote is there because quoted strings as well as flow-style dictionaries are at the top level. If you know how to make `{`, `}` or `"` in the string *not* highlighted (and preferably without performance degradation) you are welcome, I will resend your patch to Bram. I personally have no idea, main problem with plain scalars like this string is that they may contain almost anything, including some valid YAML code that will be parsed as a part of the string by a YAML parser.

Note that in the second case `!=` and `0` also should not be highlighted: `!` is not a tag and `… 0` is not an integer constant.

BTW, also CC the vim-dev or vim-use mailing list. I am not the proficient syntax file author, somebody there may know better.

 

E.g.:

 

But if I add an extra double-quote then coloring goes back to what I expect. Is there some way to fix this? Or do I need a clue?

 

Thanks for all you do.

Thomas Bodine
Engineer / Developer
tbodine@cisco.com
Phone:

Cisco Systems Limited




US
Cisco.com

 

Think before you print.

This email may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html

 

 


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: