Syntax-highlighting-for-JavaScript icon indicating copy to clipboard operation
Syntax-highlighting-for-JavaScript copied to clipboard

request: highlight Object types

Open lunelson opened this issue 11 years ago • 5 comments

This is a great package, thanks a lot for making it. The only minor criticism I have is that Object types are not highlighted as they were before, e.g. in the following code, the string "Array":

return Array.zip(boxarts, bookmarks, function(boxart, bookmark){
    return {
        id: video.id,
        title: video.title,
        time: bookmark.time,
        boxart: boxart.url
    }
});

lunelson avatar Sep 22 '14 12:09 lunelson

Hi @lunelson I've compared the built-in highlighter of ST3 and added support for Object types. As I'm not an experienced JavaScript user, if you have any suggestion please do not hesitate to ask.

By far I can only guarantee the results will be look good in Birds of Paradise and Tomorrow Theme

BTW thanks for retweet 🍺

P233 avatar Sep 22 '14 19:09 P233

Any time! I have one other thought: what do you think of highlighting object keys in red rather than orange, as in this tomorrow-night-eighties screenshot (JSON keys are red, but JS object keys are not):

image

lunelson avatar Sep 23 '14 08:09 lunelson

Incidentally, one more thing: in the above screenshot on the left, the array of strings in the middle should probably be highlighted in green rather than red, as these are the values for the key above them (ignored_packages:).

lunelson avatar Sep 23 '14 08:09 lunelson

Thanks. I didn't think too much when I pick up the scope for JSON keys. As in your screenshot I would say it's better to highlight properties in red (and highlight methods in orange ?). I'll update in a few days.

unfortunately, I haven't found a way to correctly highlight the array of quoted strings in JSON syntax :(

P233 avatar Sep 23 '14 18:09 P233

I would look for the opening and closing square brackets, so that even if there's a line break you still treat everything inside them as just 'values' so either orange if numbers or green if quoted, until you get to a closing square bracket, or unless you encounter a nested object, which would be another set of curly brackets.

lunelson avatar Sep 24 '14 09:09 lunelson