forked from Mirrors/helix
Merge branch 'master' of github.com:helix-editor/helix
commit
151ac52741
@ -0,0 +1,11 @@
|
|||||||
|
# Auto detect text files and perform normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
*.rs text diff=rust
|
||||||
|
*.toml text diff=toml
|
||||||
|
|
||||||
|
*.scm text diff=scheme
|
||||||
|
*.md text diff=markdown
|
||||||
|
|
||||||
|
book/theme/highlight.js linguist-vendored
|
||||||
|
Cargo.lock text
|
@ -0,0 +1,5 @@
|
|||||||
|
# Things that we don't want ripgrep to search that we do want in git
|
||||||
|
# https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#automatic-filtering
|
||||||
|
|
||||||
|
# Minified JS vendored from mdbook
|
||||||
|
book/theme/highlight.js
|
@ -0,0 +1,49 @@
|
|||||||
|
# You can move it here ~/.config/elvish/lib/hx.elv
|
||||||
|
# Or add `eval (slurp < ~/$REPOS/helix/contrib/completion/hx.elv)`
|
||||||
|
# Be sure to replace `$REPOS` with something that makes sense for you!
|
||||||
|
|
||||||
|
### Renders a pretty completion candidate
|
||||||
|
var candidate = { | _stem _desc |
|
||||||
|
edit:complex-candidate $_stem &display=(styled $_stem bold)(styled " "$_desc dim)
|
||||||
|
}
|
||||||
|
|
||||||
|
### These commands will invalidate further input (i.e. not react to them)
|
||||||
|
var skips = [ "--tutor" "--help" "--version" "-V" "--health" ]
|
||||||
|
|
||||||
|
### Grammar commands
|
||||||
|
var grammar = [ "--grammar" "-g" ]
|
||||||
|
|
||||||
|
### Config commands
|
||||||
|
var config = [ "--config" "-c" ]
|
||||||
|
|
||||||
|
### Set an arg-completer for the `hx` binary
|
||||||
|
set edit:completion:arg-completer[hx] = {|@args|
|
||||||
|
var n = (count $args)
|
||||||
|
if (>= $n 3) {
|
||||||
|
# Stop completions if passed arg will take presedence
|
||||||
|
# and invalidate further input
|
||||||
|
if (has-value $skips $args[-2]) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
# If the previous arg == --grammar, then only suggest:
|
||||||
|
if (has-value $grammar $args[-2]) {
|
||||||
|
$candidate "fetch" "Fetch the tree-sitter grammars"
|
||||||
|
$candidate "build" "Build the tree-sitter grammars"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
# When we have --config, we need a file
|
||||||
|
if (has-values $config $args[-2]) {
|
||||||
|
edit:complete-filename $args[-1] | each { |v| put $v[stem] }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
edit:complete-filename $args[-1] | each { |v| put $v[stem]}
|
||||||
|
$candidate "--help" "(Prints help information)"
|
||||||
|
$candidate "--version" "(Prints version information)"
|
||||||
|
$candidate "--tutor" "(Loads the tutorial)"
|
||||||
|
$candidate "--health" "(Checks for errors in editor setup)"
|
||||||
|
$candidate "--grammar" "(Fetch or build the tree-sitter grammars)"
|
||||||
|
$candidate "--vsplit" "(Splits all given files vertically)"
|
||||||
|
$candidate "--hsplit" "(Splits all given files horizontally)"
|
||||||
|
$candidate "--config" "(Specifies a file to use for configuration)"
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,153 +1,163 @@
|
|||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
/// Represents key modifiers (shift, control, alt).
|
/// Represents key modifiers (shift, control, alt).
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub struct KeyModifiers: u8 {
|
pub struct KeyModifiers: u8 {
|
||||||
const SHIFT = 0b0000_0001;
|
const SHIFT = 0b0000_0001;
|
||||||
const CONTROL = 0b0000_0010;
|
const CONTROL = 0b0000_0010;
|
||||||
const ALT = 0b0000_0100;
|
const ALT = 0b0000_0100;
|
||||||
const NONE = 0b0000_0000;
|
const NONE = 0b0000_0000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "term")]
|
#[cfg(feature = "term")]
|
||||||
impl From<KeyModifiers> for crossterm::event::KeyModifiers {
|
impl From<KeyModifiers> for crossterm::event::KeyModifiers {
|
||||||
fn from(key_modifiers: KeyModifiers) -> Self {
|
fn from(key_modifiers: KeyModifiers) -> Self {
|
||||||
use crossterm::event::KeyModifiers as CKeyModifiers;
|
use crossterm::event::KeyModifiers as CKeyModifiers;
|
||||||
|
|
||||||
let mut result = CKeyModifiers::NONE;
|
let mut result = CKeyModifiers::NONE;
|
||||||
|
|
||||||
if key_modifiers.contains(KeyModifiers::SHIFT) {
|
if key_modifiers.contains(KeyModifiers::SHIFT) {
|
||||||
result.insert(CKeyModifiers::SHIFT);
|
result.insert(CKeyModifiers::SHIFT);
|
||||||
}
|
}
|
||||||
if key_modifiers.contains(KeyModifiers::CONTROL) {
|
if key_modifiers.contains(KeyModifiers::CONTROL) {
|
||||||
result.insert(CKeyModifiers::CONTROL);
|
result.insert(CKeyModifiers::CONTROL);
|
||||||
}
|
}
|
||||||
if key_modifiers.contains(KeyModifiers::ALT) {
|
if key_modifiers.contains(KeyModifiers::ALT) {
|
||||||
result.insert(CKeyModifiers::ALT);
|
result.insert(CKeyModifiers::ALT);
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "term")]
|
#[cfg(feature = "term")]
|
||||||
impl From<crossterm::event::KeyModifiers> for KeyModifiers {
|
impl From<crossterm::event::KeyModifiers> for KeyModifiers {
|
||||||
fn from(val: crossterm::event::KeyModifiers) -> Self {
|
fn from(val: crossterm::event::KeyModifiers) -> Self {
|
||||||
use crossterm::event::KeyModifiers as CKeyModifiers;
|
use crossterm::event::KeyModifiers as CKeyModifiers;
|
||||||
|
|
||||||
let mut result = KeyModifiers::NONE;
|
let mut result = KeyModifiers::NONE;
|
||||||
|
|
||||||
if val.contains(CKeyModifiers::SHIFT) {
|
if val.contains(CKeyModifiers::SHIFT) {
|
||||||
result.insert(KeyModifiers::SHIFT);
|
result.insert(KeyModifiers::SHIFT);
|
||||||
}
|
}
|
||||||
if val.contains(CKeyModifiers::CONTROL) {
|
if val.contains(CKeyModifiers::CONTROL) {
|
||||||
result.insert(KeyModifiers::CONTROL);
|
result.insert(KeyModifiers::CONTROL);
|
||||||
}
|
}
|
||||||
if val.contains(CKeyModifiers::ALT) {
|
if val.contains(CKeyModifiers::ALT) {
|
||||||
result.insert(KeyModifiers::ALT);
|
result.insert(KeyModifiers::ALT);
|
||||||
}
|
}
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a key.
|
/// Represents a key.
|
||||||
#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Clone, Copy, Hash)]
|
#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Clone, Copy, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
pub enum KeyCode {
|
||||||
pub enum KeyCode {
|
/// Backspace key.
|
||||||
/// Backspace key.
|
Backspace,
|
||||||
Backspace,
|
/// Enter key.
|
||||||
/// Enter key.
|
Enter,
|
||||||
Enter,
|
/// Left arrow key.
|
||||||
/// Left arrow key.
|
Left,
|
||||||
Left,
|
/// Right arrow key.
|
||||||
/// Right arrow key.
|
Right,
|
||||||
Right,
|
/// Up arrow key.
|
||||||
/// Up arrow key.
|
Up,
|
||||||
Up,
|
/// Down arrow key.
|
||||||
/// Down arrow key.
|
Down,
|
||||||
Down,
|
/// Home key.
|
||||||
/// Home key.
|
Home,
|
||||||
Home,
|
/// End key.
|
||||||
/// End key.
|
End,
|
||||||
End,
|
/// Page up key.
|
||||||
/// Page up key.
|
PageUp,
|
||||||
PageUp,
|
/// Page down key.
|
||||||
/// Page down key.
|
PageDown,
|
||||||
PageDown,
|
/// Tab key.
|
||||||
/// Tab key.
|
Tab,
|
||||||
Tab,
|
/// Delete key.
|
||||||
/// Delete key.
|
Delete,
|
||||||
Delete,
|
/// Insert key.
|
||||||
/// Insert key.
|
Insert,
|
||||||
Insert,
|
/// F key.
|
||||||
/// F key.
|
///
|
||||||
///
|
/// `KeyCode::F(1)` represents F1 key, etc.
|
||||||
/// `KeyCode::F(1)` represents F1 key, etc.
|
F(u8),
|
||||||
F(u8),
|
/// A character.
|
||||||
/// A character.
|
///
|
||||||
///
|
/// `KeyCode::Char('c')` represents `c` character, etc.
|
||||||
/// `KeyCode::Char('c')` represents `c` character, etc.
|
Char(char),
|
||||||
Char(char),
|
/// Null.
|
||||||
/// Null.
|
Null,
|
||||||
Null,
|
/// Escape key.
|
||||||
/// Escape key.
|
Esc,
|
||||||
Esc,
|
}
|
||||||
}
|
|
||||||
|
#[cfg(feature = "term")]
|
||||||
#[cfg(feature = "term")]
|
impl From<KeyCode> for crossterm::event::KeyCode {
|
||||||
impl From<KeyCode> for crossterm::event::KeyCode {
|
fn from(key_code: KeyCode) -> Self {
|
||||||
fn from(key_code: KeyCode) -> Self {
|
use crossterm::event::KeyCode as CKeyCode;
|
||||||
use crossterm::event::KeyCode as CKeyCode;
|
|
||||||
|
match key_code {
|
||||||
match key_code {
|
KeyCode::Backspace => CKeyCode::Backspace,
|
||||||
KeyCode::Backspace => CKeyCode::Backspace,
|
KeyCode::Enter => CKeyCode::Enter,
|
||||||
KeyCode::Enter => CKeyCode::Enter,
|
KeyCode::Left => CKeyCode::Left,
|
||||||
KeyCode::Left => CKeyCode::Left,
|
KeyCode::Right => CKeyCode::Right,
|
||||||
KeyCode::Right => CKeyCode::Right,
|
KeyCode::Up => CKeyCode::Up,
|
||||||
KeyCode::Up => CKeyCode::Up,
|
KeyCode::Down => CKeyCode::Down,
|
||||||
KeyCode::Down => CKeyCode::Down,
|
KeyCode::Home => CKeyCode::Home,
|
||||||
KeyCode::Home => CKeyCode::Home,
|
KeyCode::End => CKeyCode::End,
|
||||||
KeyCode::End => CKeyCode::End,
|
KeyCode::PageUp => CKeyCode::PageUp,
|
||||||
KeyCode::PageUp => CKeyCode::PageUp,
|
KeyCode::PageDown => CKeyCode::PageDown,
|
||||||
KeyCode::PageDown => CKeyCode::PageDown,
|
KeyCode::Tab => CKeyCode::Tab,
|
||||||
KeyCode::Tab => CKeyCode::Tab,
|
KeyCode::Delete => CKeyCode::Delete,
|
||||||
KeyCode::Delete => CKeyCode::Delete,
|
KeyCode::Insert => CKeyCode::Insert,
|
||||||
KeyCode::Insert => CKeyCode::Insert,
|
KeyCode::F(f_number) => CKeyCode::F(f_number),
|
||||||
KeyCode::F(f_number) => CKeyCode::F(f_number),
|
KeyCode::Char(character) => CKeyCode::Char(character),
|
||||||
KeyCode::Char(character) => CKeyCode::Char(character),
|
KeyCode::Null => CKeyCode::Null,
|
||||||
KeyCode::Null => CKeyCode::Null,
|
KeyCode::Esc => CKeyCode::Esc,
|
||||||
KeyCode::Esc => CKeyCode::Esc,
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#[cfg(feature = "term")]
|
||||||
#[cfg(feature = "term")]
|
impl From<crossterm::event::KeyCode> for KeyCode {
|
||||||
impl From<crossterm::event::KeyCode> for KeyCode {
|
fn from(val: crossterm::event::KeyCode) -> Self {
|
||||||
fn from(val: crossterm::event::KeyCode) -> Self {
|
use crossterm::event::KeyCode as CKeyCode;
|
||||||
use crossterm::event::KeyCode as CKeyCode;
|
|
||||||
|
match val {
|
||||||
match val {
|
CKeyCode::Backspace => KeyCode::Backspace,
|
||||||
CKeyCode::Backspace => KeyCode::Backspace,
|
CKeyCode::Enter => KeyCode::Enter,
|
||||||
CKeyCode::Enter => KeyCode::Enter,
|
CKeyCode::Left => KeyCode::Left,
|
||||||
CKeyCode::Left => KeyCode::Left,
|
CKeyCode::Right => KeyCode::Right,
|
||||||
CKeyCode::Right => KeyCode::Right,
|
CKeyCode::Up => KeyCode::Up,
|
||||||
CKeyCode::Up => KeyCode::Up,
|
CKeyCode::Down => KeyCode::Down,
|
||||||
CKeyCode::Down => KeyCode::Down,
|
CKeyCode::Home => KeyCode::Home,
|
||||||
CKeyCode::Home => KeyCode::Home,
|
CKeyCode::End => KeyCode::End,
|
||||||
CKeyCode::End => KeyCode::End,
|
CKeyCode::PageUp => KeyCode::PageUp,
|
||||||
CKeyCode::PageUp => KeyCode::PageUp,
|
CKeyCode::PageDown => KeyCode::PageDown,
|
||||||
CKeyCode::PageDown => KeyCode::PageDown,
|
CKeyCode::Tab => KeyCode::Tab,
|
||||||
CKeyCode::Tab => KeyCode::Tab,
|
CKeyCode::BackTab => unreachable!("BackTab should have been handled on KeyEvent level"),
|
||||||
CKeyCode::BackTab => unreachable!("BackTab should have been handled on KeyEvent level"),
|
CKeyCode::Delete => KeyCode::Delete,
|
||||||
CKeyCode::Delete => KeyCode::Delete,
|
CKeyCode::Insert => KeyCode::Insert,
|
||||||
CKeyCode::Insert => KeyCode::Insert,
|
CKeyCode::F(f_number) => KeyCode::F(f_number),
|
||||||
CKeyCode::F(f_number) => KeyCode::F(f_number),
|
CKeyCode::Char(character) => KeyCode::Char(character),
|
||||||
CKeyCode::Char(character) => KeyCode::Char(character),
|
CKeyCode::Null => KeyCode::Null,
|
||||||
CKeyCode::Null => KeyCode::Null,
|
CKeyCode::Esc => KeyCode::Esc,
|
||||||
CKeyCode::Esc => KeyCode::Esc,
|
CKeyCode::CapsLock
|
||||||
}
|
| CKeyCode::ScrollLock
|
||||||
}
|
| CKeyCode::NumLock
|
||||||
}
|
| CKeyCode::PrintScreen
|
||||||
|
| CKeyCode::Pause
|
||||||
|
| CKeyCode::Menu
|
||||||
|
| CKeyCode::KeypadBegin
|
||||||
|
| CKeyCode::Media(_)
|
||||||
|
| CKeyCode::Modifier(_) => unreachable!(
|
||||||
|
"Shouldn't get this key without enabling DISAMBIGUATE_ESCAPE_CODES in crossterm"
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
(transaction)
|
||||||
|
(section)
|
||||||
|
] @fold
|
@ -0,0 +1,49 @@
|
|||||||
|
(date) @variable.builtin
|
||||||
|
(txn) @variable.builtin
|
||||||
|
|
||||||
|
(account) @type
|
||||||
|
|
||||||
|
[
|
||||||
|
(amount)
|
||||||
|
(incomplete_amount)
|
||||||
|
(amount_tolerance)
|
||||||
|
(number)
|
||||||
|
] @constant.numeric
|
||||||
|
|
||||||
|
|
||||||
|
[(key_value) (key)] @variable.other.member
|
||||||
|
(string) @string
|
||||||
|
|
||||||
|
[
|
||||||
|
(currency)
|
||||||
|
(tag)
|
||||||
|
(link)
|
||||||
|
] @constant
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
[
|
||||||
|
(minus)
|
||||||
|
(plus)
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
(balance) (open) (close) (commodity) (pad)
|
||||||
|
(event) (price) (note) (document) (query)
|
||||||
|
(custom) (pushtag) (poptag) (pushmeta)
|
||||||
|
(popmeta) (option) (include) (plugin)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
|
||||||
|
((headline item: (item) @markup.heading.6) @markup.heading.marker
|
||||||
|
(#match? @markup.heading.marker "^\\*\\*\\*\\*\\*\\*"))
|
||||||
|
((headline item: (item) @markup.heading.5) @markup.heading.marker
|
||||||
|
(#match? @markup.heading.marker "^\\*\\*\\*\\*\\*"))
|
||||||
|
((headline item: (item) @markup.heading.4) @markup.heading.marker
|
||||||
|
(#match? @markup.heading.marker "^\\*\\*\\*\\*"))
|
||||||
|
((headline item: (item) @markup.heading.3) @markup.heading.marker
|
||||||
|
(#match? @markup.heading.marker "^\\*\\*\\*"))
|
||||||
|
((headline item: (item) @markup.heading.2) @markup.heading.marker
|
||||||
|
(#match? @markup.heading.marker "^\\*\\*"))
|
||||||
|
((headline item: (item) @markup.heading.1) @markup.heading.marker
|
||||||
|
(#match? @markup.heading.marker "^\\*"))
|
@ -0,0 +1,110 @@
|
|||||||
|
(package_clause "package" @keyword.control.import)
|
||||||
|
|
||||||
|
(package_identifier) @variable
|
||||||
|
|
||||||
|
(import_declaration "import" @keyword.control.import)
|
||||||
|
|
||||||
|
[
|
||||||
|
"!"
|
||||||
|
"*"
|
||||||
|
"|"
|
||||||
|
"&"
|
||||||
|
"||"
|
||||||
|
"&&"
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
"<"
|
||||||
|
"<="
|
||||||
|
">"
|
||||||
|
">="
|
||||||
|
"=~"
|
||||||
|
"!~"
|
||||||
|
"+"
|
||||||
|
"-"
|
||||||
|
"*"
|
||||||
|
"/"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(unary_expression "*" @operator.default)
|
||||||
|
|
||||||
|
(unary_expression "=~" @operator.regexp)
|
||||||
|
|
||||||
|
(unary_expression "!~" @operator.regexp)
|
||||||
|
|
||||||
|
(binary_expression _ "&" @operator.unify _)
|
||||||
|
|
||||||
|
(binary_expression _ "|" @operator.disjunct _)
|
||||||
|
|
||||||
|
(builtin) @function.builtin
|
||||||
|
|
||||||
|
(qualified_identifier) @function.builtin
|
||||||
|
|
||||||
|
(let_clause "let" @keyword.storage.type)
|
||||||
|
|
||||||
|
(for_clause "for" @keyword.control.repeat)
|
||||||
|
(for_clause "in" @keyword.control.repeat)
|
||||||
|
|
||||||
|
(guard_clause "if" @keyword.control.conditional)
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
[
|
||||||
|
(string_type)
|
||||||
|
(simple_string_lit)
|
||||||
|
(multiline_string_lit)
|
||||||
|
(bytes_type)
|
||||||
|
(simple_bytes_lit)
|
||||||
|
(multiline_bytes_lit)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
[
|
||||||
|
(number_type)
|
||||||
|
(int_lit)
|
||||||
|
(int_type)
|
||||||
|
(uint_type)
|
||||||
|
] @constant.numeric.integer
|
||||||
|
|
||||||
|
[
|
||||||
|
(float_lit)
|
||||||
|
(float_type)
|
||||||
|
] @constant.numeric.float
|
||||||
|
|
||||||
|
[
|
||||||
|
(bool_type)
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
] @constant.builtin.boolean
|
||||||
|
|
||||||
|
(null) @constant.builtin
|
||||||
|
|
||||||
|
(ellipsis) @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
","
|
||||||
|
":"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
(interpolation "\\(" @punctuation.bracket (_) ")" @punctuation.bracket) @variable.other.member
|
||||||
|
|
||||||
|
(field (label (identifier) @variable.other.member))
|
||||||
|
|
||||||
|
(
|
||||||
|
(identifier) @keyword.storage.type
|
||||||
|
(#match? @keyword.storage.type "^#")
|
||||||
|
)
|
||||||
|
|
||||||
|
(field (label alias: (identifier) @label))
|
||||||
|
|
||||||
|
(let_clause left: (identifier) @label)
|
||||||
|
|
||||||
|
|
||||||
|
(attribute (identifier) @tag)
|
@ -0,0 +1,43 @@
|
|||||||
|
(keyword) @keyword
|
||||||
|
(string_literal) @string
|
||||||
|
(number_literal) @constant.numeric
|
||||||
|
|
||||||
|
[
|
||||||
|
(edgeop)
|
||||||
|
(operator)
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
","
|
||||||
|
";"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
(subgraph
|
||||||
|
id: (id
|
||||||
|
(identifier) @namespace)
|
||||||
|
)
|
||||||
|
|
||||||
|
(attribute
|
||||||
|
name: (id
|
||||||
|
(identifier) @type)
|
||||||
|
value: (id
|
||||||
|
(identifier) @constant)
|
||||||
|
)
|
||||||
|
|
||||||
|
[
|
||||||
|
(comment)
|
||||||
|
(preproc)
|
||||||
|
] @comment
|
||||||
|
|
||||||
|
(ERROR) @error
|
||||||
|
|
||||||
|
(identifier) @variable
|
@ -0,0 +1,2 @@
|
|||||||
|
((html_internal) @injection.content
|
||||||
|
(#set! injection.language "html"))
|
@ -0,0 +1,221 @@
|
|||||||
|
; Special identifiers
|
||||||
|
;--------------------
|
||||||
|
|
||||||
|
([
|
||||||
|
(identifier)
|
||||||
|
(shorthand_property_identifier)
|
||||||
|
(shorthand_property_identifier_pattern)
|
||||||
|
] @constant
|
||||||
|
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
||||||
|
|
||||||
|
|
||||||
|
((identifier) @constructor
|
||||||
|
(#match? @constructor "^[A-Z]"))
|
||||||
|
|
||||||
|
((identifier) @variable.builtin
|
||||||
|
(#match? @variable.builtin "^(arguments|module|console|window|document)$")
|
||||||
|
(#is-not? local))
|
||||||
|
|
||||||
|
((identifier) @function.builtin
|
||||||
|
(#eq? @function.builtin "require")
|
||||||
|
(#is-not? local))
|
||||||
|
|
||||||
|
; Function and method definitions
|
||||||
|
;--------------------------------
|
||||||
|
|
||||||
|
(function
|
||||||
|
name: (identifier) @function)
|
||||||
|
(function_declaration
|
||||||
|
name: (identifier) @function)
|
||||||
|
(method_definition
|
||||||
|
name: (property_identifier) @function.method)
|
||||||
|
|
||||||
|
(pair
|
||||||
|
key: (property_identifier) @function.method
|
||||||
|
value: [(function) (arrow_function)])
|
||||||
|
|
||||||
|
(assignment_expression
|
||||||
|
left: (member_expression
|
||||||
|
property: (property_identifier) @function.method)
|
||||||
|
right: [(function) (arrow_function)])
|
||||||
|
|
||||||
|
(variable_declarator
|
||||||
|
name: (identifier) @function
|
||||||
|
value: [(function) (arrow_function)])
|
||||||
|
|
||||||
|
(assignment_expression
|
||||||
|
left: (identifier) @function
|
||||||
|
right: [(function) (arrow_function)])
|
||||||
|
|
||||||
|
|
||||||
|
; Function and method calls
|
||||||
|
;--------------------------
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
function: (identifier) @function)
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
function: (member_expression
|
||||||
|
property: (property_identifier) @function.method))
|
||||||
|
|
||||||
|
; Variables
|
||||||
|
;----------
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
; Properties
|
||||||
|
;-----------
|
||||||
|
|
||||||
|
(property_identifier) @variable.other.member
|
||||||
|
(shorthand_property_identifier) @variable.other.member
|
||||||
|
(shorthand_property_identifier_pattern) @variable.other.member
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
;---------
|
||||||
|
|
||||||
|
(this) @variable.builtin
|
||||||
|
(super) @variable.builtin
|
||||||
|
|
||||||
|
[
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
(null)
|
||||||
|
(undefined)
|
||||||
|
] @constant.builtin
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(template_string)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(regex) @string.regexp
|
||||||
|
(number) @constant.numeric.integer
|
||||||
|
|
||||||
|
; Tokens
|
||||||
|
;-------
|
||||||
|
|
||||||
|
(template_substitution
|
||||||
|
"${" @punctuation.special
|
||||||
|
"}" @punctuation.special) @embedded
|
||||||
|
|
||||||
|
[
|
||||||
|
";"
|
||||||
|
"?."
|
||||||
|
"."
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"-"
|
||||||
|
"--"
|
||||||
|
"-="
|
||||||
|
"+"
|
||||||
|
"++"
|
||||||
|
"+="
|
||||||
|
"*"
|
||||||
|
"*="
|
||||||
|
"**"
|
||||||
|
"**="
|
||||||
|
"/"
|
||||||
|
"/="
|
||||||
|
"%"
|
||||||
|
"%="
|
||||||
|
"<"
|
||||||
|
"<="
|
||||||
|
"<<"
|
||||||
|
"<<="
|
||||||
|
"="
|
||||||
|
"=="
|
||||||
|
"==="
|
||||||
|
"!"
|
||||||
|
"!="
|
||||||
|
"!=="
|
||||||
|
"=>"
|
||||||
|
">"
|
||||||
|
">="
|
||||||
|
">>"
|
||||||
|
">>="
|
||||||
|
">>>"
|
||||||
|
">>>="
|
||||||
|
"~"
|
||||||
|
"^"
|
||||||
|
"&"
|
||||||
|
"|"
|
||||||
|
"^="
|
||||||
|
"&="
|
||||||
|
"|="
|
||||||
|
"&&"
|
||||||
|
"||"
|
||||||
|
"??"
|
||||||
|
"&&="
|
||||||
|
"||="
|
||||||
|
"??="
|
||||||
|
"..."
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(ternary_expression ["?" ":"] @operator)
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
"as"
|
||||||
|
"async"
|
||||||
|
"debugger"
|
||||||
|
"delete"
|
||||||
|
"extends"
|
||||||
|
"from"
|
||||||
|
"function"
|
||||||
|
"get"
|
||||||
|
"in"
|
||||||
|
"instanceof"
|
||||||
|
"new"
|
||||||
|
"of"
|
||||||
|
"set"
|
||||||
|
"static"
|
||||||
|
"target"
|
||||||
|
"try"
|
||||||
|
"typeof"
|
||||||
|
"void"
|
||||||
|
"with"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"class"
|
||||||
|
"let"
|
||||||
|
"const"
|
||||||
|
"var"
|
||||||
|
] @keyword.storage.type
|
||||||
|
|
||||||
|
[
|
||||||
|
"switch"
|
||||||
|
"case"
|
||||||
|
"default"
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
"yield"
|
||||||
|
"throw"
|
||||||
|
"finally"
|
||||||
|
"return"
|
||||||
|
"catch"
|
||||||
|
"continue"
|
||||||
|
"while"
|
||||||
|
"break"
|
||||||
|
"for"
|
||||||
|
"do"
|
||||||
|
"await"
|
||||||
|
] @keyword.control
|
||||||
|
|
||||||
|
[
|
||||||
|
"import"
|
||||||
|
"export"
|
||||||
|
] @keyword.control.import
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
[
|
||||||
|
(array)
|
||||||
|
(object)
|
||||||
|
(arguments)
|
||||||
|
(formal_parameters)
|
||||||
|
|
||||||
|
(statement_block)
|
||||||
|
(object_pattern)
|
||||||
|
(class_body)
|
||||||
|
(named_imports)
|
||||||
|
|
||||||
|
(binary_expression)
|
||||||
|
(return_statement)
|
||||||
|
(template_substitution)
|
||||||
|
(export_clause)
|
||||||
|
] @indent
|
||||||
|
|
||||||
|
[
|
||||||
|
"}"
|
||||||
|
"]"
|
||||||
|
")"
|
||||||
|
] @outdent
|
@ -0,0 +1,36 @@
|
|||||||
|
; Parse the contents of tagged template literals using
|
||||||
|
; a language inferred from the tag.
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
function: [
|
||||||
|
(identifier) @injection.language
|
||||||
|
(member_expression
|
||||||
|
property: (property_identifier) @injection.language)
|
||||||
|
]
|
||||||
|
arguments: (template_string) @injection.content)
|
||||||
|
|
||||||
|
; Parse the contents of gql template literals
|
||||||
|
|
||||||
|
((call_expression
|
||||||
|
function: (identifier) @_template_function_name
|
||||||
|
arguments: (template_string) @injection.content)
|
||||||
|
(#eq? @_template_function_name "gql")
|
||||||
|
(#set! injection.language "graphql"))
|
||||||
|
|
||||||
|
; Parse regex syntax within regex literals
|
||||||
|
|
||||||
|
((regex_pattern) @injection.content
|
||||||
|
(#set! injection.language "regex"))
|
||||||
|
|
||||||
|
; Parse JSDoc annotations in multiline comments
|
||||||
|
|
||||||
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "jsdoc")
|
||||||
|
(#match? @injection.content "^/\\*+"))
|
||||||
|
|
||||||
|
; Parse general tags in single line comments
|
||||||
|
|
||||||
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment")
|
||||||
|
(#match? @injection.content "^//"))
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
; Scopes
|
||||||
|
;-------
|
||||||
|
|
||||||
|
[
|
||||||
|
(statement_block)
|
||||||
|
(function)
|
||||||
|
(arrow_function)
|
||||||
|
(function_declaration)
|
||||||
|
(method_definition)
|
||||||
|
] @local.scope
|
||||||
|
|
||||||
|
; Definitions
|
||||||
|
;------------
|
||||||
|
|
||||||
|
(pattern/identifier) @local.definition
|
||||||
|
|
||||||
|
(pattern/rest_pattern
|
||||||
|
(identifier) @local.definition)
|
||||||
|
|
||||||
|
(arrow_function
|
||||||
|
parameter: (identifier) @local.definition)
|
||||||
|
|
||||||
|
(variable_declarator
|
||||||
|
name: (identifier) @local.definition)
|
||||||
|
|
||||||
|
; References
|
||||||
|
;------------
|
||||||
|
|
||||||
|
(identifier) @local.reference
|
@ -0,0 +1,36 @@
|
|||||||
|
(function_declaration
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(function
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(arrow_function
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(method_definition
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(generator_function_declaration
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(class_declaration
|
||||||
|
body: (class_body) @class.inside) @class.around
|
||||||
|
|
||||||
|
(class
|
||||||
|
(class_body) @class.inside) @class.around
|
||||||
|
|
||||||
|
(export_statement
|
||||||
|
declaration: [
|
||||||
|
(function_declaration) @function.around
|
||||||
|
(class_declaration) @class.around
|
||||||
|
])
|
||||||
|
|
||||||
|
(formal_parameters
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(arguments
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(comment) @comment.inside
|
||||||
|
|
||||||
|
(comment)+ @comment.around
|
@ -0,0 +1,76 @@
|
|||||||
|
; Identifiers
|
||||||
|
|
||||||
|
[
|
||||||
|
(field)
|
||||||
|
(field_identifier)
|
||||||
|
] @variable.other.member
|
||||||
|
|
||||||
|
(variable) @variable
|
||||||
|
|
||||||
|
; Function calls
|
||||||
|
|
||||||
|
(function_call
|
||||||
|
function: (identifier) @function)
|
||||||
|
|
||||||
|
(method_call
|
||||||
|
method: (selector_expression
|
||||||
|
field: (field_identifier) @function))
|
||||||
|
|
||||||
|
; Operators
|
||||||
|
|
||||||
|
"|" @operator
|
||||||
|
":=" @operator
|
||||||
|
|
||||||
|
; Builtin functions
|
||||||
|
|
||||||
|
((identifier) @function.builtin
|
||||||
|
(#match? @function.builtin "^(and|call|html|index|slice|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|ge|gt|ge)$"))
|
||||||
|
|
||||||
|
; Delimiters
|
||||||
|
|
||||||
|
"." @punctuation.delimiter
|
||||||
|
"," @punctuation.delimiter
|
||||||
|
|
||||||
|
"{{" @punctuation.bracket
|
||||||
|
"}}" @punctuation.bracket
|
||||||
|
"{{-" @punctuation.bracket
|
||||||
|
"-}}" @punctuation.bracket
|
||||||
|
")" @punctuation.bracket
|
||||||
|
"(" @punctuation.bracket
|
||||||
|
|
||||||
|
; Keywords
|
||||||
|
|
||||||
|
"else" @keyword
|
||||||
|
"if" @keyword
|
||||||
|
"range" @keyword
|
||||||
|
"with" @keyword
|
||||||
|
"end" @keyword
|
||||||
|
"template" @keyword
|
||||||
|
"define" @keyword
|
||||||
|
"block" @keyword
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
|
||||||
|
[
|
||||||
|
(interpreted_string_literal)
|
||||||
|
(raw_string_literal)
|
||||||
|
(rune_literal)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(escape_sequence) @string.special
|
||||||
|
|
||||||
|
[
|
||||||
|
(int_literal)
|
||||||
|
(float_literal)
|
||||||
|
(imaginary_literal)
|
||||||
|
] @constant.numeric.integer
|
||||||
|
|
||||||
|
[
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
] @constant.builtin.boolean
|
||||||
|
|
||||||
|
(nil) @constant.builtin
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
(ERROR) @error
|
@ -0,0 +1,2 @@
|
|||||||
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
@ -0,0 +1 @@
|
|||||||
|
(comment) @comment.around @comment.inside
|
@ -1,12 +0,0 @@
|
|||||||
(formal_parameters
|
|
||||||
[
|
|
||||||
(identifier) @variable.parameter
|
|
||||||
(array_pattern
|
|
||||||
(identifier) @variable.parameter)
|
|
||||||
(object_pattern
|
|
||||||
[
|
|
||||||
(pair_pattern value: (identifier) @variable.parameter)
|
|
||||||
(shorthand_property_identifier_pattern) @variable.parameter
|
|
||||||
])
|
|
||||||
]
|
|
||||||
)
|
|
@ -1,215 +1,38 @@
|
|||||||
; Special identifiers
|
; Function and method parameters
|
||||||
;--------------------
|
;-------------------------------
|
||||||
|
|
||||||
([
|
; (p) => ...
|
||||||
(identifier)
|
(formal_parameters
|
||||||
(shorthand_property_identifier)
|
(identifier) @variable.parameter)
|
||||||
(shorthand_property_identifier_pattern)
|
|
||||||
] @constant
|
; (...p) => ...
|
||||||
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
|
(formal_parameters
|
||||||
|
(rest_pattern
|
||||||
|
(identifier) @variable.parameter))
|
||||||
((identifier) @constructor
|
|
||||||
(#match? @constructor "^[A-Z]"))
|
; ({ p }) => ...
|
||||||
|
(formal_parameters
|
||||||
((identifier) @variable.builtin
|
(object_pattern
|
||||||
(#match? @variable.builtin "^(arguments|module|console|window|document)$")
|
(shorthand_property_identifier_pattern) @variable.parameter))
|
||||||
(#is-not? local))
|
|
||||||
|
; ({ a: p }) => ...
|
||||||
((identifier) @function.builtin
|
(formal_parameters
|
||||||
(#eq? @function.builtin "require")
|
(object_pattern
|
||||||
(#is-not? local))
|
(pair_pattern
|
||||||
|
value: (identifier) @variable.parameter)))
|
||||||
; Function and method definitions
|
|
||||||
;--------------------------------
|
; ([ p ]) => ...
|
||||||
|
(formal_parameters
|
||||||
(function
|
(array_pattern
|
||||||
name: (identifier) @function)
|
(identifier) @variable.parameter))
|
||||||
(function_declaration
|
|
||||||
name: (identifier) @function)
|
; (p = 1) => ...
|
||||||
(method_definition
|
(formal_parameters
|
||||||
name: (property_identifier) @function.method)
|
(assignment_pattern
|
||||||
|
left: (identifier) @variable.parameter))
|
||||||
(pair
|
|
||||||
key: (property_identifier) @function.method
|
; p => ...
|
||||||
value: [(function) (arrow_function)])
|
(arrow_function
|
||||||
|
parameter: (identifier) @variable.parameter)
|
||||||
(assignment_expression
|
|
||||||
left: (member_expression
|
; inherits: ecma
|
||||||
property: (property_identifier) @function.method)
|
|
||||||
right: [(function) (arrow_function)])
|
|
||||||
|
|
||||||
(variable_declarator
|
|
||||||
name: (identifier) @function
|
|
||||||
value: [(function) (arrow_function)])
|
|
||||||
|
|
||||||
(assignment_expression
|
|
||||||
left: (identifier) @function
|
|
||||||
right: [(function) (arrow_function)])
|
|
||||||
|
|
||||||
; Function and method calls
|
|
||||||
;--------------------------
|
|
||||||
|
|
||||||
(call_expression
|
|
||||||
function: (identifier) @function)
|
|
||||||
|
|
||||||
(call_expression
|
|
||||||
function: (member_expression
|
|
||||||
property: (property_identifier) @function.method))
|
|
||||||
|
|
||||||
; Variables
|
|
||||||
;----------
|
|
||||||
|
|
||||||
(identifier) @variable
|
|
||||||
|
|
||||||
; Properties
|
|
||||||
;-----------
|
|
||||||
|
|
||||||
(property_identifier) @variable.other.member
|
|
||||||
|
|
||||||
; Literals
|
|
||||||
;---------
|
|
||||||
|
|
||||||
(this) @variable.builtin
|
|
||||||
(super) @variable.builtin
|
|
||||||
|
|
||||||
[
|
|
||||||
(true)
|
|
||||||
(false)
|
|
||||||
(null)
|
|
||||||
(undefined)
|
|
||||||
] @constant.builtin
|
|
||||||
|
|
||||||
(comment) @comment
|
|
||||||
|
|
||||||
[
|
|
||||||
(string)
|
|
||||||
(template_string)
|
|
||||||
] @string
|
|
||||||
|
|
||||||
(regex) @string.regexp
|
|
||||||
(number) @constant.numeric.integer
|
|
||||||
|
|
||||||
; Tokens
|
|
||||||
;-------
|
|
||||||
|
|
||||||
(template_substitution
|
|
||||||
"${" @punctuation.special
|
|
||||||
"}" @punctuation.special) @embedded
|
|
||||||
|
|
||||||
[
|
|
||||||
";"
|
|
||||||
"?."
|
|
||||||
"."
|
|
||||||
","
|
|
||||||
] @punctuation.delimiter
|
|
||||||
|
|
||||||
[
|
|
||||||
"-"
|
|
||||||
"--"
|
|
||||||
"-="
|
|
||||||
"+"
|
|
||||||
"++"
|
|
||||||
"+="
|
|
||||||
"*"
|
|
||||||
"*="
|
|
||||||
"**"
|
|
||||||
"**="
|
|
||||||
"/"
|
|
||||||
"/="
|
|
||||||
"%"
|
|
||||||
"%="
|
|
||||||
"<"
|
|
||||||
"<="
|
|
||||||
"<<"
|
|
||||||
"<<="
|
|
||||||
"="
|
|
||||||
"=="
|
|
||||||
"==="
|
|
||||||
"!"
|
|
||||||
"!="
|
|
||||||
"!=="
|
|
||||||
"=>"
|
|
||||||
">"
|
|
||||||
">="
|
|
||||||
">>"
|
|
||||||
">>="
|
|
||||||
">>>"
|
|
||||||
">>>="
|
|
||||||
"~"
|
|
||||||
"^"
|
|
||||||
"&"
|
|
||||||
"|"
|
|
||||||
"^="
|
|
||||||
"&="
|
|
||||||
"|="
|
|
||||||
"&&"
|
|
||||||
"||"
|
|
||||||
"??"
|
|
||||||
"&&="
|
|
||||||
"||="
|
|
||||||
"??="
|
|
||||||
] @operator
|
|
||||||
|
|
||||||
[
|
|
||||||
"("
|
|
||||||
")"
|
|
||||||
"["
|
|
||||||
"]"
|
|
||||||
"{"
|
|
||||||
"}"
|
|
||||||
] @punctuation.bracket
|
|
||||||
|
|
||||||
[
|
|
||||||
"as"
|
|
||||||
"async"
|
|
||||||
"debugger"
|
|
||||||
"delete"
|
|
||||||
"extends"
|
|
||||||
"from"
|
|
||||||
"function"
|
|
||||||
"get"
|
|
||||||
"in"
|
|
||||||
"instanceof"
|
|
||||||
"new"
|
|
||||||
"of"
|
|
||||||
"set"
|
|
||||||
"static"
|
|
||||||
"target"
|
|
||||||
"try"
|
|
||||||
"typeof"
|
|
||||||
"void"
|
|
||||||
"with"
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
[
|
|
||||||
"class"
|
|
||||||
"let"
|
|
||||||
"const"
|
|
||||||
"var"
|
|
||||||
] @keyword.storage.type
|
|
||||||
|
|
||||||
[
|
|
||||||
"switch"
|
|
||||||
"case"
|
|
||||||
"default"
|
|
||||||
"if"
|
|
||||||
"else"
|
|
||||||
"yield"
|
|
||||||
"throw"
|
|
||||||
"finally"
|
|
||||||
"return"
|
|
||||||
"catch"
|
|
||||||
"continue"
|
|
||||||
"while"
|
|
||||||
"break"
|
|
||||||
"for"
|
|
||||||
"do"
|
|
||||||
"await"
|
|
||||||
] @keyword.control
|
|
||||||
|
|
||||||
[
|
|
||||||
"import"
|
|
||||||
"export"
|
|
||||||
] @keyword.control.import
|
|
||||||
|
|
||||||
|
@ -1,22 +1 @@
|
|||||||
[
|
; inherits: ecma
|
||||||
(array)
|
|
||||||
(object)
|
|
||||||
(arguments)
|
|
||||||
(formal_parameters)
|
|
||||||
|
|
||||||
(statement_block)
|
|
||||||
(object_pattern)
|
|
||||||
(class_body)
|
|
||||||
(named_imports)
|
|
||||||
|
|
||||||
(binary_expression)
|
|
||||||
(return_statement)
|
|
||||||
(template_substitution)
|
|
||||||
(export_clause)
|
|
||||||
] @indent
|
|
||||||
|
|
||||||
[
|
|
||||||
"}"
|
|
||||||
"]"
|
|
||||||
")"
|
|
||||||
] @outdent
|
|
||||||
|
@ -1,36 +1 @@
|
|||||||
; Parse the contents of tagged template literals using
|
; inherits: ecma
|
||||||
; a language inferred from the tag.
|
|
||||||
|
|
||||||
(call_expression
|
|
||||||
function: [
|
|
||||||
(identifier) @injection.language
|
|
||||||
(member_expression
|
|
||||||
property: (property_identifier) @injection.language)
|
|
||||||
]
|
|
||||||
arguments: (template_string) @injection.content)
|
|
||||||
|
|
||||||
; Parse the contents of gql template literals
|
|
||||||
|
|
||||||
((call_expression
|
|
||||||
function: (identifier) @_template_function_name
|
|
||||||
arguments: (template_string) @injection.content)
|
|
||||||
(#eq? @_template_function_name "gql")
|
|
||||||
(#set! injection.language "graphql"))
|
|
||||||
|
|
||||||
; Parse regex syntax within regex literals
|
|
||||||
|
|
||||||
((regex_pattern) @injection.content
|
|
||||||
(#set! injection.language "regex"))
|
|
||||||
|
|
||||||
; Parse JSDoc annotations in multiline comments
|
|
||||||
|
|
||||||
((comment) @injection.content
|
|
||||||
(#set! injection.language "jsdoc")
|
|
||||||
(#match? @injection.content "^/\\*+"))
|
|
||||||
|
|
||||||
; Parse general tags in single line comments
|
|
||||||
|
|
||||||
((comment) @injection.content
|
|
||||||
(#set! injection.language "comment")
|
|
||||||
(#match? @injection.content "^//"))
|
|
||||||
|
|
||||||
|
@ -1,23 +1 @@
|
|||||||
; Scopes
|
; inherits: ecma
|
||||||
;-------
|
|
||||||
|
|
||||||
[
|
|
||||||
(statement_block)
|
|
||||||
(function)
|
|
||||||
(arrow_function)
|
|
||||||
(function_declaration)
|
|
||||||
(method_definition)
|
|
||||||
] @local.scope
|
|
||||||
|
|
||||||
; Definitions
|
|
||||||
;------------
|
|
||||||
|
|
||||||
(pattern/identifier)@local.definition
|
|
||||||
|
|
||||||
(variable_declarator
|
|
||||||
name: (identifier) @local.definition)
|
|
||||||
|
|
||||||
; References
|
|
||||||
;------------
|
|
||||||
|
|
||||||
(identifier) @local.reference
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
; inherits: ecma
|
@ -1 +1 @@
|
|||||||
; inherits: javascript
|
; inherits: ecma
|
||||||
|
@ -1 +1 @@
|
|||||||
; inherits: javascript
|
; inherits: ecma
|
||||||
|
@ -1 +1 @@
|
|||||||
; inherits: javascript
|
; inherits: ecma
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
; inherits: ecma
|
@ -1,410 +1,235 @@
|
|||||||
;; Math
|
;; General syntax
|
||||||
[
|
(ERROR) @error
|
||||||
(displayed_equation)
|
|
||||||
(inline_formula)
|
|
||||||
] @text.math
|
|
||||||
|
|
||||||
;; This highlights the whole environment like vimtex does
|
|
||||||
((environment
|
|
||||||
(begin
|
|
||||||
name: (word) @_env)) @text.math
|
|
||||||
(#any-of? @_env
|
|
||||||
"displaymath" "displaymath*"
|
|
||||||
"equation" "equation*"
|
|
||||||
"multline" "multline*"
|
|
||||||
"eqnarray" "eqnarray*"
|
|
||||||
"align" "align*"
|
|
||||||
"array" "array*"
|
|
||||||
"split" "split*"
|
|
||||||
"alignat" "alignat*"
|
|
||||||
"gather" "gather*"
|
|
||||||
"flalign" "flalign*"))
|
|
||||||
|
|
||||||
[
|
(command_name) @function
|
||||||
(generic_command_name)
|
(caption
|
||||||
"\\newcommand"
|
command: _ @function)
|
||||||
"\\renewcommand"
|
|
||||||
"\\DeclareRobustCommand"
|
|
||||||
"\\DeclareMathOperator"
|
|
||||||
"\\newglossaryentry"
|
|
||||||
"\\caption"
|
|
||||||
"\\label"
|
|
||||||
"\\newlabel"
|
|
||||||
"\\color"
|
|
||||||
"\\colorbox"
|
|
||||||
"\\textcolor"
|
|
||||||
"\\pagecolor"
|
|
||||||
"\\definecolor"
|
|
||||||
"\\definecolorset"
|
|
||||||
"\\newtheorem"
|
|
||||||
"\\declaretheorem"
|
|
||||||
"\\newacronym"
|
|
||||||
] @function.macro
|
|
||||||
|
|
||||||
[
|
(key_value_pair
|
||||||
"\\ref"
|
key: (_) @variable.parameter
|
||||||
"\\vref"
|
value: (_))
|
||||||
"\\Vref"
|
|
||||||
"\\autoref"
|
|
||||||
"\\pageref"
|
|
||||||
"\\cref"
|
|
||||||
"\\Cref"
|
|
||||||
"\\cref*"
|
|
||||||
"\\Cref*"
|
|
||||||
"\\namecref"
|
|
||||||
"\\nameCref"
|
|
||||||
"\\lcnamecref"
|
|
||||||
"\\namecrefs"
|
|
||||||
"\\nameCrefs"
|
|
||||||
"\\lcnamecrefs"
|
|
||||||
"\\labelcref"
|
|
||||||
"\\labelcpageref"
|
|
||||||
"\\crefrange"
|
|
||||||
"\\crefrange"
|
|
||||||
"\\Crefrange"
|
|
||||||
"\\Crefrange"
|
|
||||||
"\\crefrange*"
|
|
||||||
"\\crefrange*"
|
|
||||||
"\\Crefrange*"
|
|
||||||
"\\Crefrange*"
|
|
||||||
] @function.macro
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"\\cite"
|
(comment)
|
||||||
"\\cite*"
|
(line_comment)
|
||||||
"\\Cite"
|
(block_comment)
|
||||||
"\\nocite"
|
(comment_environment)
|
||||||
"\\citet"
|
] @comment
|
||||||
"\\citep"
|
|
||||||
"\\citet*"
|
|
||||||
"\\citep*"
|
|
||||||
"\\citeauthor"
|
|
||||||
"\\citeauthor*"
|
|
||||||
"\\Citeauthor"
|
|
||||||
"\\Citeauthor*"
|
|
||||||
"\\citetitle"
|
|
||||||
"\\citetitle*"
|
|
||||||
"\\citeyear"
|
|
||||||
"\\citeyear*"
|
|
||||||
"\\citedate"
|
|
||||||
"\\citedate*"
|
|
||||||
"\\citeurl"
|
|
||||||
"\\fullcite"
|
|
||||||
"\\citeyearpar"
|
|
||||||
"\\citealt"
|
|
||||||
"\\citealp"
|
|
||||||
"\\citetext"
|
|
||||||
"\\parencite"
|
|
||||||
"\\parencite*"
|
|
||||||
"\\Parencite"
|
|
||||||
"\\footcite"
|
|
||||||
"\\footfullcite"
|
|
||||||
"\\footcitetext"
|
|
||||||
"\\textcite"
|
|
||||||
"\\Textcite"
|
|
||||||
"\\smartcite"
|
|
||||||
"\\Smartcite"
|
|
||||||
"\\supercite"
|
|
||||||
"\\autocite"
|
|
||||||
"\\Autocite"
|
|
||||||
"\\autocite*"
|
|
||||||
"\\Autocite*"
|
|
||||||
"\\volcite"
|
|
||||||
"\\Volcite"
|
|
||||||
"\\pvolcite"
|
|
||||||
"\\Pvolcite"
|
|
||||||
"\\fvolcite"
|
|
||||||
"\\ftvolcite"
|
|
||||||
"\\svolcite"
|
|
||||||
"\\Svolcite"
|
|
||||||
"\\tvolcite"
|
|
||||||
"\\Tvolcite"
|
|
||||||
"\\avolcite"
|
|
||||||
"\\Avolcite"
|
|
||||||
"\\notecite"
|
|
||||||
"\\notecite"
|
|
||||||
"\\pnotecite"
|
|
||||||
"\\Pnotecite"
|
|
||||||
"\\fnotecite"
|
|
||||||
] @function.macro
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"\\ref"
|
(brack_group)
|
||||||
"\\vref"
|
(brack_group_argc)
|
||||||
"\\Vref"
|
] @variable.parameter
|
||||||
"\\autoref"
|
|
||||||
"\\pageref"
|
|
||||||
"\\cref"
|
|
||||||
"\\Cref"
|
|
||||||
"\\cref*"
|
|
||||||
"\\Cref*"
|
|
||||||
"\\namecref"
|
|
||||||
"\\nameCref"
|
|
||||||
"\\lcnamecref"
|
|
||||||
"\\namecrefs"
|
|
||||||
"\\nameCrefs"
|
|
||||||
"\\lcnamecrefs"
|
|
||||||
"\\labelcref"
|
|
||||||
"\\labelcpageref"
|
|
||||||
] @function.macro
|
|
||||||
|
|
||||||
|
[(operator) "="] @operator
|
||||||
|
|
||||||
[
|
"\\item" @punctuation.special
|
||||||
"\\crefrange"
|
|
||||||
"\\crefrange"
|
|
||||||
"\\Crefrange"
|
|
||||||
"\\Crefrange"
|
|
||||||
"\\crefrange*"
|
|
||||||
"\\crefrange*"
|
|
||||||
"\\Crefrange*"
|
|
||||||
"\\Crefrange*"
|
|
||||||
] @function.macro
|
|
||||||
|
|
||||||
|
((word) @punctuation.delimiter
|
||||||
|
(#eq? @punctuation.delimiter "&"))
|
||||||
|
|
||||||
[
|
["[" "]" "{" "}"] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX
|
||||||
"\\gls"
|
|
||||||
"\\Gls"
|
|
||||||
"\\GLS"
|
|
||||||
"\\glspl"
|
|
||||||
"\\Glspl"
|
|
||||||
"\\GLSpl"
|
|
||||||
"\\glsdisp"
|
|
||||||
"\\glslink"
|
|
||||||
"\\glstext"
|
|
||||||
"\\Glstext"
|
|
||||||
"\\GLStext"
|
|
||||||
"\\glsfirst"
|
|
||||||
"\\Glsfirst"
|
|
||||||
"\\GLSfirst"
|
|
||||||
"\\glsplural"
|
|
||||||
"\\Glsplural"
|
|
||||||
"\\GLSplural"
|
|
||||||
"\\glsfirstplural"
|
|
||||||
"\\Glsfirstplural"
|
|
||||||
"\\GLSfirstplural"
|
|
||||||
"\\glsname"
|
|
||||||
"\\Glsname"
|
|
||||||
"\\GLSname"
|
|
||||||
"\\glssymbol"
|
|
||||||
"\\Glssymbol"
|
|
||||||
"\\glsdesc"
|
|
||||||
"\\Glsdesc"
|
|
||||||
"\\GLSdesc"
|
|
||||||
"\\glsuseri"
|
|
||||||
"\\Glsuseri"
|
|
||||||
"\\GLSuseri"
|
|
||||||
"\\glsuserii"
|
|
||||||
"\\Glsuserii"
|
|
||||||
"\\GLSuserii"
|
|
||||||
"\\glsuseriii"
|
|
||||||
"\\Glsuseriii"
|
|
||||||
"\\GLSuseriii"
|
|
||||||
"\\glsuseriv"
|
|
||||||
"\\Glsuseriv"
|
|
||||||
"\\GLSuseriv"
|
|
||||||
"\\glsuserv"
|
|
||||||
"\\Glsuserv"
|
|
||||||
"\\GLSuserv"
|
|
||||||
"\\glsuservi"
|
|
||||||
"\\Glsuservi"
|
|
||||||
"\\GLSuservi"
|
|
||||||
] @function.macro
|
|
||||||
|
|
||||||
|
;; General environments
|
||||||
|
(begin
|
||||||
|
command: _ @function.builtin
|
||||||
|
name: (curly_group_text (text) @function.macro))
|
||||||
|
|
||||||
[
|
(end
|
||||||
"\\acrshort"
|
command: _ @function.builtin
|
||||||
"\\Acrshort"
|
name: (curly_group_text (text) @function.macro))
|
||||||
"\\ACRshort"
|
|
||||||
"\\acrshortpl"
|
;; Definitions and references
|
||||||
"\\Acrshortpl"
|
(new_command_definition
|
||||||
"\\ACRshortpl"
|
command: _ @function.macro
|
||||||
"\\acrlong"
|
declaration: (curly_group_command_name (_) @function))
|
||||||
"\\Acrlong"
|
(old_command_definition
|
||||||
"\\ACRlong"
|
command: _ @function.macro
|
||||||
"\\acrlongpl"
|
declaration: (_) @function)
|
||||||
"\\Acrlongpl"
|
(let_command_definition
|
||||||
"\\ACRlongpl"
|
command: _ @function.macro
|
||||||
"\\acrfull"
|
declaration: (_) @function)
|
||||||
"\\Acrfull"
|
|
||||||
"\\ACRfull"
|
(environment_definition
|
||||||
"\\acrfullpl"
|
command: _ @function.macro
|
||||||
"\\Acrfullpl"
|
name: (curly_group_text (_) @constant))
|
||||||
"\\ACRfullpl"
|
|
||||||
"\\acs"
|
(theorem_definition
|
||||||
"\\Acs"
|
command: _ @function.macro
|
||||||
"\\acsp"
|
name: (curly_group_text (_) @constant))
|
||||||
"\\Acsp"
|
|
||||||
"\\acl"
|
(paired_delimiter_definition
|
||||||
"\\Acl"
|
command: _ @function.macro
|
||||||
"\\aclp"
|
declaration: (curly_group_command_name (_) @function))
|
||||||
"\\Aclp"
|
|
||||||
"\\acf"
|
|
||||||
"\\Acf"
|
|
||||||
"\\acfp"
|
|
||||||
"\\Acfp"
|
|
||||||
"\\ac"
|
|
||||||
"\\Ac"
|
|
||||||
"\\acp"
|
|
||||||
"\\glsentrylong"
|
|
||||||
"\\Glsentrylong"
|
|
||||||
"\\glsentrylongpl"
|
|
||||||
"\\Glsentrylongpl"
|
|
||||||
"\\glsentryshort"
|
|
||||||
"\\Glsentryshort"
|
|
||||||
"\\glsentryshortpl"
|
|
||||||
"\\Glsentryshortpl"
|
|
||||||
"\\glsentryfullpl"
|
|
||||||
"\\Glsentryfullpl"
|
|
||||||
] @function.macro
|
|
||||||
|
|
||||||
(comment) @comment
|
|
||||||
|
|
||||||
(bracket_group) @variable.parameter
|
|
||||||
|
|
||||||
[(math_operator) "="] @operator
|
|
||||||
|
|
||||||
[
|
(label_definition
|
||||||
"\\usepackage"
|
command: _ @function.macro
|
||||||
"\\documentclass"
|
name: (curly_group_text (_) @label))
|
||||||
"\\input"
|
(label_reference_range
|
||||||
"\\include"
|
command: _ @function.macro
|
||||||
"\\subfile"
|
from: (curly_group_text (_) @label)
|
||||||
"\\subfileinclude"
|
to: (curly_group_text (_) @label))
|
||||||
"\\subfileinclude"
|
(label_reference
|
||||||
"\\includegraphics"
|
command: _ @function.macro
|
||||||
"\\addbibresource"
|
names: (curly_group_text_list (_) @label))
|
||||||
"\\bibliography"
|
(label_number
|
||||||
"\\includesvg"
|
command: _ @function.macro
|
||||||
"\\includeinkscape"
|
name: (curly_group_text (_) @label)
|
||||||
"\\usepgflibrary"
|
number: (_) @markup.link.label)
|
||||||
"\\usetikzlibrary"
|
|
||||||
] @keyword.control.import
|
|
||||||
|
|
||||||
[
|
(citation
|
||||||
"\\part"
|
command: _ @function.macro
|
||||||
"\\chapter"
|
keys: (curly_group_text_list) @string)
|
||||||
"\\section"
|
|
||||||
"\\subsection"
|
(glossary_entry_definition
|
||||||
"\\subsubsection"
|
command: _ @function.macro
|
||||||
"\\paragraph"
|
name: (curly_group_text (_) @string))
|
||||||
"\\subparagraph"
|
(glossary_entry_reference
|
||||||
] @type
|
command: _ @function.macro
|
||||||
|
name: (curly_group_text (_) @string))
|
||||||
|
|
||||||
|
(acronym_definition
|
||||||
|
command: _ @function.macro
|
||||||
|
name: (curly_group_text (_) @string))
|
||||||
|
(acronym_reference
|
||||||
|
command: _ @function.macro
|
||||||
|
name: (curly_group_text (_) @string))
|
||||||
|
|
||||||
|
(color_definition
|
||||||
|
command: _ @function.macro
|
||||||
|
name: (curly_group_text (_) @string))
|
||||||
|
(color_reference
|
||||||
|
command: _ @function.macro
|
||||||
|
name: (curly_group_text (_) @string))
|
||||||
|
|
||||||
"\\item" @punctuation.special
|
;; Math
|
||||||
|
|
||||||
((word) @punctuation.delimiter
|
(displayed_equation) @markup.raw.block
|
||||||
(#eq? @punctuation.delimiter "&"))
|
(inline_formula) @markup.raw.inline
|
||||||
|
|
||||||
["$" "\\[" "\\]" "\\(" "\\)"] @punctuation.delimiter
|
(math_environment
|
||||||
|
(begin
|
||||||
|
command: _ @function.builtin
|
||||||
|
name: (curly_group_text (text) @markup.raw)))
|
||||||
|
|
||||||
(label_definition
|
(math_environment
|
||||||
name: (_) @text.reference)
|
(text) @markup.raw)
|
||||||
(label_reference
|
|
||||||
label: (_) @text.reference)
|
|
||||||
(equation_label_reference
|
|
||||||
label: (_) @text.reference)
|
|
||||||
(label_reference
|
|
||||||
label: (_) @text.reference)
|
|
||||||
(label_number
|
|
||||||
label: (_) @text.reference)
|
|
||||||
|
|
||||||
(citation
|
(math_environment
|
||||||
key: (word) @text.reference)
|
(end
|
||||||
|
command: _ @function.builtin
|
||||||
|
name: (curly_group_text (text) @markup.raw)))
|
||||||
|
|
||||||
(key_val_pair
|
;; Sectioning
|
||||||
key: (_) @variable.parameter
|
(title_declaration
|
||||||
value: (_))
|
command: _ @namespace
|
||||||
|
options: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX
|
(author_declaration
|
||||||
|
command: _ @namespace
|
||||||
|
authors: (curly_group_author_list
|
||||||
|
((author)+ @markup.heading)))
|
||||||
|
|
||||||
(chapter
|
(chapter
|
||||||
text: (brace_group) @markup.heading)
|
command: _ @namespace
|
||||||
|
toc: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
(part
|
(part
|
||||||
text: (brace_group) @markup.heading)
|
command: _ @namespace
|
||||||
|
toc: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
(section
|
(section
|
||||||
text: (brace_group) @markup.heading)
|
command: _ @namespace
|
||||||
|
toc: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
(subsection
|
(subsection
|
||||||
text: (brace_group) @markup.heading)
|
command: _ @namespace
|
||||||
|
toc: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
(subsubsection
|
(subsubsection
|
||||||
text: (brace_group) @markup.heading)
|
command: _ @namespace
|
||||||
|
toc: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
(paragraph
|
(paragraph
|
||||||
text: (brace_group) @markup.heading)
|
command: _ @namespace
|
||||||
|
toc: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
(subparagraph
|
(subparagraph
|
||||||
text: (brace_group) @markup.heading)
|
command: _ @namespace
|
||||||
|
toc: (brack_group (_) @markup.heading)?
|
||||||
|
text: (curly_group (_) @markup.heading))
|
||||||
|
|
||||||
((environment
|
;; Beamer frames
|
||||||
|
(generic_environment
|
||||||
(begin
|
(begin
|
||||||
name: (word) @_frame)
|
name: (curly_group_text
|
||||||
(brace_group
|
(text) @markup.heading)
|
||||||
child: (text) @markup.heading))
|
(#any-of? @markup.heading "frame"))
|
||||||
(#eq? @_frame "frame"))
|
.
|
||||||
|
(curly_group (_) @markup.heading))
|
||||||
|
|
||||||
((generic_command
|
((generic_command
|
||||||
name:(generic_command_name) @_name
|
command: (command_name) @_name
|
||||||
arg: (brace_group
|
arg: (curly_group
|
||||||
(text) @markup.heading))
|
(text) @markup.heading))
|
||||||
(#eq? @_name "\\frametitle"))
|
(#eq? @_name "\\frametitle"))
|
||||||
|
|
||||||
;; Formatting
|
;; Formatting
|
||||||
|
|
||||||
((generic_command
|
((generic_command
|
||||||
name:(generic_command_name) @_name
|
command: (command_name) @_name
|
||||||
arg: (_) @markup.italic)
|
arg: (curly_group (_) @markup.italic))
|
||||||
(#eq? @_name "\\emph"))
|
(#eq? @_name "\\emph"))
|
||||||
|
|
||||||
((generic_command
|
((generic_command
|
||||||
name:(generic_command_name) @_name
|
command: (command_name) @_name
|
||||||
arg: (_) @markup.italic)
|
arg: (curly_group (_) @markup.italic))
|
||||||
(#match? @_name "^(\\\\textit|\\\\mathit)$"))
|
(#match? @_name "^(\\\\textit|\\\\mathit)$"))
|
||||||
|
|
||||||
((generic_command
|
((generic_command
|
||||||
name:(generic_command_name) @_name
|
command: (command_name) @_name
|
||||||
arg: (_) @markup.bold)
|
arg: (curly_group (_) @markup.bold))
|
||||||
(#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
|
(#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
|
||||||
|
|
||||||
((generic_command
|
((generic_command
|
||||||
name:(generic_command_name) @_name
|
command: (command_name) @_name
|
||||||
.
|
.
|
||||||
arg: (_) @markup.link.url)
|
arg: (curly_group (_) @markup.link.uri))
|
||||||
(#match? @_name "^(\\\\url|\\\\href)$"))
|
(#match? @_name "^(\\\\url|\\\\href)$"))
|
||||||
|
|
||||||
(ERROR) @error
|
;; File inclusion commands
|
||||||
|
(class_include
|
||||||
[
|
command: _ @keyword.storage.type
|
||||||
"\\begin"
|
path: (curly_group_path) @string)
|
||||||
"\\end"
|
|
||||||
] @text.environment
|
(package_include
|
||||||
|
command: _ @keyword.storage.type
|
||||||
(begin
|
paths: (curly_group_path_list) @string)
|
||||||
name: (_) @text.environment.name
|
|
||||||
(#not-any-of? @text.environment.name
|
(latex_include
|
||||||
"displaymath" "displaymath*"
|
command: _ @keyword.control.import
|
||||||
"equation" "equation*"
|
path: (curly_group_path) @string)
|
||||||
"multline" "multline*"
|
(import_include
|
||||||
"eqnarray" "eqnarray*"
|
command: _ @keyword.control.import
|
||||||
"align" "align*"
|
directory: (curly_group_path) @string
|
||||||
"array" "array*"
|
file: (curly_group_path) @string)
|
||||||
"split" "split*"
|
|
||||||
"alignat" "alignat*"
|
(bibtex_include
|
||||||
"gather" "gather*"
|
command: _ @keyword.control.import
|
||||||
"flalign" "flalign*"))
|
path: (curly_group_path) @string)
|
||||||
|
(biblatex_include
|
||||||
(end
|
"\\addbibresource" @include
|
||||||
name: (_) @text.environment.name
|
glob: (curly_group_glob_pattern) @string.regex)
|
||||||
(#not-any-of? @text.environment.name
|
|
||||||
"displaymath" "displaymath*"
|
(graphics_include
|
||||||
"equation" "equation*"
|
command: _ @keyword.control.import
|
||||||
"multline" "multline*"
|
path: (curly_group_path) @string)
|
||||||
"eqnarray" "eqnarray*"
|
(tikz_library_import
|
||||||
"align" "align*"
|
command: _ @keyword.control.import
|
||||||
"array" "array*"
|
paths: (curly_group_path_list) @string)
|
||||||
"split" "split*"
|
|
||||||
"alignat" "alignat*"
|
|
||||||
"gather" "gather*"
|
|
||||||
"flalign" "flalign*"))
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
[
|
||||||
|
(generic_command)
|
||||||
|
] @function.around
|
||||||
|
|
||||||
|
[
|
||||||
|
(chapter)
|
||||||
|
(part)
|
||||||
|
(section)
|
||||||
|
(subsection)
|
||||||
|
(subsubsection)
|
||||||
|
(paragraph)
|
||||||
|
(subparagraph)
|
||||||
|
] @class.around
|
@ -0,0 +1,39 @@
|
|||||||
|
;; From nvim-treesitter/nvim-treesitter
|
||||||
|
[
|
||||||
|
(code_span)
|
||||||
|
(link_title)
|
||||||
|
] @markup.raw.inline
|
||||||
|
|
||||||
|
[
|
||||||
|
(emphasis_delimiter)
|
||||||
|
(code_span_delimiter)
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
(emphasis) @markup.italic
|
||||||
|
|
||||||
|
(strong_emphasis) @markup.bold
|
||||||
|
|
||||||
|
(strikethrough) @markup.strikethrough
|
||||||
|
|
||||||
|
[
|
||||||
|
(link_destination)
|
||||||
|
(uri_autolink)
|
||||||
|
] @markup.link.url
|
||||||
|
|
||||||
|
[
|
||||||
|
(link_text)
|
||||||
|
(image_description)
|
||||||
|
] @markup.link.text
|
||||||
|
|
||||||
|
(link_label) @markup.link.label
|
||||||
|
|
||||||
|
[
|
||||||
|
(backslash_escape)
|
||||||
|
(hard_line_break)
|
||||||
|
] @constant.character.escape
|
||||||
|
|
||||||
|
(image ["[" "]" "(" ")"] @punctuation.bracket)
|
||||||
|
(image "!" @punctuation.special)
|
||||||
|
(inline_link ["[" "]" "(" ")"] @punctuation.bracket)
|
||||||
|
(shortcut_link ["[" "]"] @punctuation.bracket)
|
||||||
|
|
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
((html_tag) @injection.content (#set! injection.language "html"))
|
@ -1,54 +1,53 @@
|
|||||||
(setext_heading (heading_content) @markup.heading.1 (setext_h1_underline) @markup.heading.marker)
|
|
||||||
(setext_heading (heading_content) @markup.heading.2 (setext_h2_underline) @markup.heading.marker)
|
|
||||||
|
|
||||||
(atx_heading (atx_h1_marker) @markup.heading.marker (heading_content) @markup.heading.1)
|
(setext_heading (paragraph) @markup.heading.1 (setext_h1_underline) @markup.heading.marker)
|
||||||
(atx_heading (atx_h2_marker) @markup.heading.marker (heading_content) @markup.heading.2)
|
(setext_heading (paragraph) @markup.heading.2 (setext_h2_underline) @markup.heading.marker)
|
||||||
(atx_heading (atx_h3_marker) @markup.heading.marker (heading_content) @markup.heading.3)
|
|
||||||
(atx_heading (atx_h4_marker) @markup.heading.marker (heading_content) @markup.heading.4)
|
(atx_heading (atx_h1_marker) @markup.heading.marker (inline) @markup.heading.1)
|
||||||
(atx_heading (atx_h5_marker) @markup.heading.marker (heading_content) @markup.heading.5)
|
(atx_heading (atx_h2_marker) @markup.heading.marker (inline) @markup.heading.2)
|
||||||
(atx_heading (atx_h6_marker) @markup.heading.marker (heading_content) @markup.heading.6)
|
(atx_heading (atx_h3_marker) @markup.heading.marker (inline) @markup.heading.3)
|
||||||
|
(atx_heading (atx_h4_marker) @markup.heading.marker (inline) @markup.heading.4)
|
||||||
|
(atx_heading (atx_h5_marker) @markup.heading.marker (inline) @markup.heading.5)
|
||||||
|
(atx_heading (atx_h6_marker) @markup.heading.marker (inline) @markup.heading.6)
|
||||||
|
|
||||||
[
|
[
|
||||||
(indented_code_block)
|
(indented_code_block)
|
||||||
(code_fence_content)
|
(fenced_code_block)
|
||||||
] @markup.raw.block
|
] @markup.raw.block
|
||||||
|
|
||||||
(block_quote) @markup.quote
|
(info_string) @label
|
||||||
|
|
||||||
(code_span) @markup.raw.inline
|
|
||||||
|
|
||||||
(emphasis) @markup.italic
|
|
||||||
|
|
||||||
(strong_emphasis) @markup.bold
|
|
||||||
|
|
||||||
(link_destination) @markup.link.url
|
[
|
||||||
(link_label) @markup.link.label
|
(fenced_code_block_delimiter)
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
(info_string) @label
|
[
|
||||||
|
(link_destination)
|
||||||
|
] @markup.link.url
|
||||||
|
|
||||||
[
|
[
|
||||||
(link_text)
|
(link_label)
|
||||||
(image_description)
|
] @markup.link.label
|
||||||
] @markup.link.text
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(list_marker_plus)
|
(list_marker_plus)
|
||||||
(list_marker_minus)
|
(list_marker_minus)
|
||||||
(list_marker_star)
|
(list_marker_star)
|
||||||
] @markup.list.numbered
|
] @markup.list.unnumbered
|
||||||
|
|
||||||
[
|
[
|
||||||
(list_marker_dot)
|
(list_marker_dot)
|
||||||
(list_marker_parenthesis)
|
(list_marker_parenthesis)
|
||||||
] @markup.list.unnumbered
|
] @markup.list.numbered
|
||||||
|
|
||||||
|
(thematic_break) @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
(backslash_escape)
|
(block_continuation)
|
||||||
(hard_line_break)
|
(block_quote_marker)
|
||||||
] @constant.character.escape
|
] @punctuation.special
|
||||||
|
|
||||||
(thematic_break) @punctuation.delimiter
|
[
|
||||||
|
(backslash_escape)
|
||||||
|
] @string.escape
|
||||||
|
|
||||||
(inline_link ["[" "]" "(" ")"] @punctuation.bracket)
|
(block_quote) @markup.quote
|
||||||
(image ["[" "]" "(" ")"] @punctuation.bracket)
|
|
||||||
(fenced_code_block_delimiter) @punctuation.bracket
|
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
|
; From nvim-treesitter/nvim-treesitter
|
||||||
|
|
||||||
(fenced_code_block
|
(fenced_code_block
|
||||||
(info_string) @injection.language
|
(info_string
|
||||||
(code_fence_content) @injection.content
|
(language) @injection.language)
|
||||||
(#set! injection.include-children))
|
(code_fence_content) @injection.content (#set! injection.include-unnamed-children))
|
||||||
|
|
||||||
((html_block) @injection.content
|
((html_block) @injection.content (#set! injection.language "html") (#set! injection.include-unnamed-children))
|
||||||
(#set! injection.language "html"))
|
|
||||||
((html_tag) @injection.content
|
((minus_metadata) @injection.content (#set! injection.language "yaml") (#set! injection.include-unnamed-children))
|
||||||
(#set! injection.language "html"))
|
((plus_metadata) @injection.content (#set! injection.language "toml") (#set! injection.include-unnamed-children))
|
||||||
|
|
||||||
|
((inline) @injection.content (#set! injection.language "markdown.inline") (#set! injection.include-unnamed-children))
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
;; Scopes
|
||||||
|
|
||||||
|
[
|
||||||
|
(module)
|
||||||
|
(function_definition)
|
||||||
|
(lambda)
|
||||||
|
] @local.scope
|
||||||
|
|
||||||
|
;; Definitions
|
||||||
|
|
||||||
|
; Parameters
|
||||||
|
(parameters
|
||||||
|
(identifier) @local.definition)
|
||||||
|
(parameters
|
||||||
|
(typed_parameter
|
||||||
|
(identifier) @local.definition))
|
||||||
|
(parameters
|
||||||
|
(default_parameter
|
||||||
|
name: (identifier) @local.definition))
|
||||||
|
(parameters
|
||||||
|
(typed_default_parameter
|
||||||
|
name: (identifier) @local.definition))
|
||||||
|
(parameters
|
||||||
|
(list_splat_pattern ; *args
|
||||||
|
(identifier) @local.definition))
|
||||||
|
(parameters
|
||||||
|
(dictionary_splat_pattern ; **kwargs
|
||||||
|
(identifier) @local.definition))
|
||||||
|
|
||||||
|
(lambda_parameters
|
||||||
|
(identifier) @local.definition)
|
||||||
|
|
||||||
|
; Imports
|
||||||
|
(import_statement
|
||||||
|
name: (dotted_name
|
||||||
|
(identifier) @local.definition))
|
||||||
|
|
||||||
|
(aliased_import
|
||||||
|
alias: (identifier) @local.definition)
|
||||||
|
|
||||||
|
;; References
|
||||||
|
|
||||||
|
(identifier) @local.reference
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue