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

JSX

by allanhortle ST2/ST3 Top 100

Language Definitions for JSX files.

Details

  • 2 3.0.2
    3 3.0.1
    2.0.2
  • github.​com
  • github.​com
  • 1 year ago
  • 2 hours ago
  • 5 years ago

Installs

  • Total 157K
  • Win 54K
  • OS X 76K
  • Linux 27K
Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 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
Windows 0 41 90 63 47 61 54 37 35 46 35 50 54 66 32 28 53 53 58 65 52 36 36 43 49 45 37 61 37 25 62 66 50 56 57 29 32 55 49 49 76 45 35 39 57 39
OS X 2 26 39 42 48 48 60 25 23 39 50 43 47 55 34 24 36 52 44 52 59 34 25 29 37 65 64 67 30 23 47 59 48 53 60 28 27 49 50 59 52 60 25 30 49 61
Linux 0 11 20 21 27 13 16 20 14 16 18 20 22 23 15 18 28 18 28 25 19 13 13 17 20 30 21 21 9 9 17 24 21 24 24 9 18 21 25 33 23 27 12 16 16 26

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