ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

JSX

by allanhortle ST2/ST3

Language Definitions for JSX files.

Details

  • 2 3.0.2
    3 3.0.1
    2.0.2
  • github.​com
  • github.​com
  • 1 week ago
  • 54 minutes ago
  • 4 years ago

Installs

  • Total 113K
  • Win 35K
  • OS X 59K
  • Linux 19K
Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8
Windows 41 0 0 0 0 0 0 0 0 87 29 44 52 57 67 71 94 32 35 75 81 75 66 69 43 65 60 84 74 80 81 39 39 64 71 56 67 79 42 41 63 54 33 83 86 49
OS X 45 1 0 1 0 0 1 1 0 99 49 48 79 87 84 112 121 37 62 103 92 104 115 105 57 53 74 90 83 103 96 53 53 88 105 77 104 100 51 53 82 89 59 90 90 50
Linux 11 0 0 0 0 0 0 0 0 34 19 25 26 31 40 38 33 18 24 27 26 24 27 36 27 30 42 31 30 43 30 20 20 29 40 16 43 30 18 19 25 35 27 45 38 30

Readme

Source
raw.​githubusercontent.​com

JSX-SublimeText

Language Definitions for JSX files.

Emmet Support

You will need to add a keyboard shortcut to tab complete in JSX files.

open up Preferences > Key Bindings - user and add this entry:

{
    "keys": ["tab"], "command": "expand_abbreviation_by_tab", "context": [
        {
            "operand": "source.js.jsx", 
            "operator": "equal", 
            "match_all": true, 
            "key": "selector"
        },
        {   
            "key": "selection_empty", 
            "operator": "equal", 
            "operand": true,
            "match_all": true 
        }
    ]
},
{ 
    "keys": ["tab"], "command": "next_field", "context": [
        { 
            "key": "has_next_field", 
            "operator": "equal", 
            "operand": true 
        }
    ]
}

Scope Naming

https://www.sublimetext.com/docs/3/scope_naming.html

JSX-SublimeText chooses to have a slim scope surface area because over naming scopes increases specificity and make it hard on color schemes.

There are 5 main areas of scope: Keywords/Support, Entities, Constants, Strings & Comments.

Keywords/Support

JSX-SublimeText opts to keep all javascript reserved words under one scope so as to distinguish between the js lanugage and the authors code.

All built-in objects and functions are placed under support.class.js and support.function.js

Entities

The entity scopes are generally assigned to the names of data structures, types and other uniquely-identifiable constructs in code and markup.

JSX-SublimeText only makes two entity assignments. First to the actual jsx/xml sections (entity.name.tag) and second to flow/ts type declarations (entity.name.type).

Issues & Problems

The line between specific/general syntax highlighting seems to be a bit of personal one. Due to my personal preference of less hilighting JSX-SublimeText is simpler than other JS/JSX syntaxes. If you find a part of the syntax is breaking your color scheme or you don't like a choice please feel free to open an issue. I'm more than happy to be told I'm wrong or convinced of a better way.

Reference

// Keywords
keyword.control.js // js reserved words
support.class.js // built-in objects
support.function.js // built-in functions

// Entities
entity.name.tag.jsx // JSX
entity.name.type // types

// Constants
constant.character.escape // escaped characters
constant.language.js // true|false|null|Infinity|NaN|undefined
constant.numeric.js // numbers
constant.character.entity.html // html character entities

// Strings
string.quoted.js
string.regexp.js

// Comments
comment.block.js // block.comments
comment.block.jsx // jsx comments
comment.line.js // line comments