vim-jsonc
vim-jsonc copied to clipboard
Doesn't match last string value in object if followed by a comment
This is a great package. One issues stands out to me for the example below:
{
"protocol": "gRPC", // communication protocol
"cut": { // cut instruction set
"to": {
"USER_ID": ".response.body.id.value" // write instruction
}
},
"request": { // request payload
"body": {
"email": "[email protected]"
},
"uri": "user_api.User/CreateUser" // request uri
},
"response": { // response payload
"body": "created user: ${USER_ID}",
"status": 0 // response status code
}
}
It seems that any alphanumberic character in a string value that is preceded by a period gets highlighted with the jsonNoQuotes tag.
So for "USER_ID": ".response.body.id.value" // write instruction: response, body, id, and value are all highlighted with an error tag
EDIT: it looks like the jsonStringMatch is not matching on those two lines. Perhaps a lookahead is needed for the comment section?
Thanks for opening this issue @mkatychev! Sorry for the slow reply. You are right about jsonStringMatch. Looks like it requires the string to be followed by optional whitespace then }, ,, or ] in order to distinguish jsonStringMatch from jsonKeywordMatch. They'll both need to be fixed to allow comments.
It'll take me a while to consider and implement a proper fix. If you, or anyone else would like to take a whack at it, feel free. I realize it's a significant issue, so I'll try not to delay too long on a fix.
@kevinoid no worries, I'll try a crack at it when I have time! Early bird gets the bugfix I guess 🤷♂.