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
  • 3 months ago
  • 3 days ago
  • 4 years ago

Installs

  • Total 124K
  • Win 40K
  • OS X 63K
  • Linux 21K
Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11
Windows 44 52 51 61 61 63 56 43 40 48 52 63 63 65 58 50 40 83 67 76 76 39 45 62 67 67 71 79 48 39 58 58 73 67 76 51 40 62 66 77 90 73 39 37 72 87
OS X 30 49 69 84 82 91 67 31 37 74 64 81 73 83 51 36 64 76 81 91 81 50 37 79 73 59 73 70 48 49 56 72 70 77 97 24 42 64 70 98 73 58 46 36 74 73
Linux 16 27 31 46 26 35 34 22 18 34 31 31 14 19 19 19 32 34 35 36 20 19 12 24 32 31 36 28 25 13 33 30 33 25 25 14 17 32 39 27 43 15 20 15 20 34

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