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

JSX

by allanhortle ALL

Language Definitions for JSX files.

Details

  • 3.0.2
    3.0.1
    2.0.2
  • github.​com
  • github.​com
  • 6 years ago
  • 1 hour ago
  • 10 years ago

Installs

  • Total 227K
  • Win 86K
  • Mac 100K
  • Linux 41K
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 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12
Windows 2 2 0 3 3 2 2 3 2 5 0 6 0 4 1 2 0 3 4 6 4 4 3 4 4 5 4 0 4 1 3 2 0 0 5 5 5 1 3 2 4 8 1 1 3 1
Mac 3 1 2 2 0 2 3 3 7 1 3 2 1 0 0 2 1 0 0 1 1 4 0 1 2 1 1 1 0 1 2 1 1 1 2 2 1 1 0 5 0 2 2 1 2 0
Linux 1 0 2 4 4 0 2 1 0 2 1 2 1 1 0 0 6 0 2 1 1 0 3 3 1 0 0 4 0 1 1 1 0 2 1 0 1 1 0 0 1 0 2 2 2 2

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