Closed brandom closed 10 years ago
@brandom Hm, never knew that JSON supported comments. Just had a look at http://www.json.org/ and didn't find comments mentioned -- could you provide some links that suggest otherwise?
@brandom do you mean it doesn't convert single quotes to double quotes?
Uhhh, totally misread that, sorry @brandom and thanks @kevinsawicki. :sweat_smile:
So, again checking http://www.json.org/, JSON strings can only be defined with "
and not with '
. This is also how the language-json package recognizes JSON strings.
Currently, the toggle-quotes package can toggle quotes only on strings, as detected by a language grammar. As a result, toggling quotes on 'foo'
in JSON will not work since that's not recognized as a string. However, toggling on "foo"
still works since that's recognized as a string.
@izuzak I was thinking perhaps of allowing toggle-quotes to work on error
class tokens. So if your cursor is on an error region that begins/ends with quotes it would still work.
I was thinking perhaps of allowing toggle-quotes to work on
error
class tokens.
Sounds like a good idea :+1:
@kevinsawicki My thoughts exactly. This was the use case I was referring to, to fix up plain JS objects / arrays when pasted into a JSON doc.
FWIW I tweaked the JSON prettify package to make a best effort using regex to convert to valid JSON before JSON.parse.
Just published a fix for this in 0.7.0
, let me know if you see any issues after upgrading.
Toggle quotes does not seem to work with JSON grammar.