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
  • 6 months ago
  • 42 minutes ago
  • 4 years ago

Installs

  • Total 135K
  • Win 44K
  • OS X 68K
  • Linux 23K
May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5
Windows 33 37 38 62 58 60 69 40 34 60 65 67 66 59 42 39 57 66 60 44 53 39 39 55 94 75 75 63 46 46 69 60 74 74 69 39 62 66 74 72 77 76 61 42 49 45
OS X 22 27 78 76 73 92 82 36 32 69 50 74 98 70 32 24 70 66 66 55 55 47 42 56 67 93 65 68 35 26 59 67 68 75 96 41 39 69 65 79 74 85 41 39 59 51
Linux 16 16 34 29 29 31 40 13 14 20 38 30 32 21 17 24 21 30 36 19 20 23 31 29 23 31 26 36 14 24 45 32 24 32 31 14 23 26 24 30 40 32 18 17 20 24

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