Skip to content

detect json as javascript #50

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

Merged
merged 1 commit into from
Jun 14, 2012
Merged

detect json as javascript #50

merged 1 commit into from
Jun 14, 2012

Conversation

lepture
Copy link
Contributor

@lepture lepture commented Jun 14, 2012

detect json as javascript. json is valid javascript.

pangloss pushed a commit that referenced this pull request Jun 14, 2012
detect json as javascript
@pangloss pangloss merged commit 827c47c into pangloss:master Jun 14, 2012
@millermedeiros
Copy link

JSON isn't JavaScript! I use syntastic + jsonlint to validate my JSON files during save and this line breaks it!

@eddiemonge
Copy link
Contributor

I agree. I think this is a bad change. Please remove this or keep it behind an option flag.

@goatslacker
Copy link
Collaborator

Hmm let me think about this. JSON is supposed to be a subset of JavaScript so including it with JS syntax highlighting makes sense. I think it's quite overkill to have separate JSON highlighting -- if it's breaking something it's reasonable to fix it or remove it altogether.

Why do you think this is bad @eddiemonge ?

@eddiemonge
Copy link
Contributor

JSON is JavaScript-like but not Javascript. Most (based on tools, usage, etc) lint guidelines recommend using single quotes for JS. JSON however, has to have double quotes to be valid. By telling VIM that JSON IS JS you are locking it into the same strict guidelines. I'd rather use a plugin dedicated solely to JSON like https://github.com/elzr/vim-json to parse it. Or if you do include it in this plugin, target it as JSON and not as JS. JSON has very strict requirements where JS is more laissez-faire

@amadeus
Copy link
Collaborator

amadeus commented Nov 15, 2013

Agreed with @eddiemonge, essentially since JSON is a hyper strict subset of Javascript, the code will be properly highlighted by our JS plugin, however the code will not be proper JSON.

I use a specific JSON syntax file to work around this.

@goatslacker
Copy link
Collaborator

Yeah it makes sense. Feel free to send a pull request.

nicklasnygren pushed a commit to nicklasnygren/vim-javascript that referenced this pull request Feb 8, 2014
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

Successfully merging this pull request may close these issues.

6 participants