Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No JSON syntax highlighting for 'addon-info' filetype #163

Open
dbarnett opened this issue Jul 9, 2014 · 2 comments
Open

No JSON syntax highlighting for 'addon-info' filetype #163

dbarnett opened this issue Jul 9, 2014 · 2 comments

Comments

@dbarnett
Copy link

dbarnett commented Jul 9, 2014

Without the "addon-info" filetype being applied to addon-info files, I automatically get filetype json and syntax is correctly highlighted. With filetype automatically set to "addon-info" by vim-addon-manager, I get no syntax highlighting (since there's no syntax/addon-info.vim file anywhere), and many other plugins that pay attention to filetype don't know how to handle the "addon-info" filetype.

Is there an advantage to creating a whole new "addon-info" filetype? Can we either remove that configuration or add a syntax/addon-info.vim file that pulls in syntax/json.vim (and similarly for other filetype plugin files)?

@MarcWeber
Copy link
Owner

I'm pretty sure that patches would get accepted by me/ZyX. addon-info files are very small usually, so I don't think its that important to fix.

We have this code thus you can opt out easily:

if s:c.create_addon_info_handlers
  augroup VAM_addon_info_handlers
    autocmd!
    autocmd BufRead,BufNewFile *-addon-info.txt,addon-info.json
      \ setlocal ft=addon-info
      \ | setlocal syntax=json
      \ | syn match Error "^\s*'"
    autocmd BufWritePost *-addon-info.txt,addon-info.json call vam#ReadAddonInfo(expand('%', 1))
  augroup END
endif

In theory its not JSON, just a subset which Vim happens to parse. Is it worth discussing?

@dbarnett
Copy link
Author

dbarnett commented Jul 9, 2014

Ah, I see you are at least setting syntax=json, and my issue there is just that it interferes with vim's hack of calling JSON "javascript":

au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.json   setf javascript

At any rate, just setting an arbitrary filetype name without having any standard configuration defined is a bad experience. The disadvantages of setting an arbitrary "addon-info" filetype are that many settings keep ugly default values that are the filetype maintainer's job to override per-filetype, and plugins like syntastic that pay attention to filetype won't work properly.

What are the advantages, if any?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants