problem with highlighting multiline string for play name
Closed this issue · 3 comments
Try viewing this playbook in vim with ansible-vim plugin installed:
- name: |
"https://github.com/ansible/ansible/issues/24572"
hosts: all
tasks:
- debug: var=ansible_virtualization_role
and Syntax highlighting is confused following the multiline string play name. It looks like it doesn't ever detect the end of the string. It appears that the : colon is the problem, as when I remove it, the syntax looks perfect:
- name: |
"https//github.com/ansible/ansible/issues/24572"
hosts: all
tasks:
- debug: var=ansible_virtualization_role
Also, it highlights perfectly when I use the original string play name, but just not broken over multiple lines:
- name: "https://github.com/ansible/ansible/issues/24572"
hosts: all
tasks:
- debug: var=ansible_virtualization_role
I'm using VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 16 2018 17:48:09)
and ansible-vim installed today from master branch.
I'm not able to reproduce.
I used this minimal setup to produce that screenshot:
set nocp
call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
Plug 'pearofducks/vim-quack'
call plug#end()
filetype plugin indent on
syntax on
colorscheme solarized
set ai
set si
let g:ansible_name_highlight = 'd'
let g:ansible_unindent_after_newline = 1
Thank you for trying that. I tried a minimal config and also get the correct behavior, so there must be something else mangling my syntax.. :-( Sorry I didn't try that first.
My vimrc is quite large and unwieldy so it may take a while to isolate the cause. At the moment, I'm seeing a few things that might be likely culprits (syntastic and vim-polyglot):
[tblack-stretch]/home/tblack/dotfiles > find . -name "*yaml*" master
./vim/.vim/pack/timblaktu/opt/syntastic/syntax_checkers/yaml
./vim/.vim/pack/timblaktu/opt/syntastic/syntax_checkers/yaml/yamllint.vim
./vim/.vim/pack/timblaktu/opt/syntastic/syntax_checkers/yaml/yamlxs.vim
./vim/.vim/pack/timblaktu/opt/syntastic/syntax_checkers/yaml/jsyaml.vim
./vim/.vim/pack/timblaktu/start/ale/doc/ale-yaml.txt
./vim/.vim/pack/timblaktu/start/ale/test/command_callback/swaglint_paths/docs/swagger.yaml
./vim/.vim/pack/timblaktu/start/ale/ale_linters/yaml
./vim/.vim/pack/timblaktu/start/ale/ale_linters/yaml/yamllint.vim
./vim/.vim/pack/timblaktu/start/vim-polyglot/after/ftplugin/yaml.vim
./vim/.vim/pack/timblaktu/start/vim-polyglot/after/syntax/yaml.vim
I'll start with individually adding syntastic, then vim-polyglot, and see if/when the misbehavior creeps in. Let me know if you have any suggestions or predictions.
BTW I'm using vim8 and I used the minimal config below, saved as ~/.vimrcminimal:
set nocompatible
" copy your plugin you want to troubleshoot in ~/vimplugintest and then run vim with vim -U NONE -u ~/test-vimrc
set packpath=~/vimplugintest,/usr/share/vim/vimfiles,/usr/share/vim/vim80,/usr/share/vim/vimfiles/after,~/plugin/after
packloadall!
syntax on
filetype plugin indent on
after copying the ansible-vim plugin to ~/vimplugintest. I then started vim with vim -U NONE -u ~/.vimrcminimal.
My only insight here is you could try using an alternate yaml
syntax base[1] - and that might work around whatever is causing this problem.