-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(text-area): new languages #4160
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,43 @@ | ||
BUILTIN_LANGUAGES = sorted( | ||
[ | ||
"markdown", | ||
"yaml", | ||
"sql", | ||
"bash", | ||
"c", | ||
"c_sharp", | ||
"cpp", | ||
"css", | ||
"dockerfile", | ||
"dot", | ||
"elisp", | ||
"elixir", | ||
"elm", | ||
"embedded_template", | ||
"erlang", | ||
"fortran", | ||
"go", | ||
"gomod", | ||
"hack", | ||
"haskell", | ||
"html", | ||
"java", | ||
"javascript", | ||
"jsdoc", | ||
"json", | ||
"kotlin", | ||
"make", | ||
"markdown", | ||
"objc", | ||
"ocaml", | ||
"php", | ||
"python", | ||
"r", | ||
"regex", | ||
"ruby", | ||
"rust", | ||
"scala", | ||
juftin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"sql", | ||
"sqlite", | ||
"toml", | ||
"typescript", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typescript has issues
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I've found that this means the parser and highlights file is out of sync: the highlight query file has been updated to refer to a node type that the parser is unaware of. Usually moving to an older version of the highlights file (the version that "aligns" with the parser) fixes the problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, you're right. Once I pin on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EDIT: See #4160 (comment) |
||
"yaml", | ||
] | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,145 +1,56 @@ | ||
(simple_expansion) @none | ||
(expansion | ||
"${" @punctuation.special | ||
"}" @punctuation.special) @none | ||
[ | ||
"(" | ||
")" | ||
"((" | ||
"))" | ||
"{" | ||
"}" | ||
"[" | ||
"]" | ||
"[[" | ||
"]]" | ||
] @punctuation.bracket | ||
|
||
[ | ||
";" | ||
";;" | ||
(heredoc_start) | ||
] @punctuation.delimiter | ||
|
||
[ | ||
"$" | ||
] @punctuation.special | ||
|
||
[ | ||
">" | ||
">>" | ||
"<" | ||
"<<" | ||
"&" | ||
"&&" | ||
"|" | ||
"||" | ||
"=" | ||
"=~" | ||
"==" | ||
"!=" | ||
] @operator | ||
|
||
[ | ||
(string) | ||
(raw_string) | ||
(ansi_c_string) | ||
(heredoc_body) | ||
] @string @spell | ||
|
||
(variable_assignment (word) @string) | ||
|
||
[ | ||
"if" | ||
"then" | ||
"else" | ||
"elif" | ||
"fi" | ||
"case" | ||
"in" | ||
"esac" | ||
] @conditional | ||
|
||
[ | ||
"for" | ||
"do" | ||
"done" | ||
"select" | ||
"until" | ||
"while" | ||
] @repeat | ||
|
||
[ | ||
"declare" | ||
"export" | ||
"local" | ||
"readonly" | ||
"unset" | ||
] @keyword | ||
|
||
"function" @keyword.function | ||
|
||
(special_variable_name) @constant | ||
|
||
; trap -l | ||
((word) @constant.builtin | ||
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$")) | ||
|
||
((word) @boolean | ||
(#any-of? @boolean "true" "false")) | ||
|
||
(comment) @comment @spell | ||
(test_operator) @string | ||
|
||
(command_substitution | ||
[ "$(" ")" ] @punctuation.bracket) | ||
|
||
(process_substitution | ||
[ "<(" ")" ] @punctuation.bracket) | ||
|
||
|
||
(function_definition | ||
name: (word) @function) | ||
|
||
(command_name (word) @function.call) | ||
|
||
((command_name (word) @function.builtin) | ||
(#any-of? @function.builtin | ||
"alias" "bg" "bind" "break" "builtin" "caller" "cd" | ||
"command" "compgen" "complete" "compopt" "continue" | ||
"coproc" "dirs" "disown" "echo" "enable" "eval" | ||
"exec" "exit" "fc" "fg" "getopts" "hash" "help" | ||
"history" "jobs" "kill" "let" "logout" "mapfile" | ||
"popd" "printf" "pushd" "pwd" "read" "readarray" | ||
"return" "set" "shift" "shopt" "source" "suspend" | ||
"test" "time" "times" "trap" "type" "typeset" | ||
"ulimit" "umask" "unalias" "wait")) | ||
|
||
(command | ||
argument: [ | ||
(word) @parameter | ||
(concatenation (word) @parameter) | ||
]) | ||
|
||
((word) @number | ||
(#lua-match? @number "^[0-9]+$")) | ||
|
||
(file_redirect | ||
descriptor: (file_descriptor) @operator | ||
destination: (word) @parameter) | ||
|
||
(expansion | ||
[ "${" "}" ] @punctuation.bracket) | ||
|
||
(variable_name) @variable | ||
|
||
((variable_name) @constant | ||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) | ||
|
||
(case_item | ||
value: (word) @parameter) | ||
|
||
(regex) @string.regex | ||
|
||
((program . (comment) @preproc) | ||
(#lua-match? @preproc "^#!/")) | ||
(string) | ||
(raw_string) | ||
(heredoc_body) | ||
(heredoc_start) | ||
] @string | ||
|
||
(command_name) @function | ||
|
||
(variable_name) @property | ||
|
||
[ | ||
"case" | ||
"do" | ||
"done" | ||
"elif" | ||
"else" | ||
"esac" | ||
"export" | ||
"fi" | ||
"for" | ||
"function" | ||
"if" | ||
"in" | ||
"select" | ||
"then" | ||
"unset" | ||
"until" | ||
"while" | ||
] @keyword | ||
|
||
(comment) @comment | ||
|
||
(function_definition name: (word) @function) | ||
|
||
(file_descriptor) @number | ||
|
||
[ | ||
(command_substitution) | ||
(process_substitution) | ||
(expansion) | ||
]@embedded | ||
|
||
[ | ||
"$" | ||
"&&" | ||
">" | ||
">>" | ||
"<" | ||
"|" | ||
] @operator | ||
|
||
( | ||
(command (_) @constant) | ||
(#match? @constant "^-") | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
"break" @keyword | ||
"case" @keyword | ||
"const" @keyword | ||
"continue" @keyword | ||
"default" @keyword | ||
"do" @keyword | ||
"else" @keyword | ||
"enum" @keyword | ||
"extern" @keyword | ||
"for" @keyword | ||
"if" @keyword | ||
"inline" @keyword | ||
"return" @keyword | ||
"sizeof" @keyword | ||
"static" @keyword | ||
"struct" @keyword | ||
"switch" @keyword | ||
"typedef" @keyword | ||
"union" @keyword | ||
"volatile" @keyword | ||
"while" @keyword | ||
|
||
"#define" @keyword | ||
"#elif" @keyword | ||
"#else" @keyword | ||
"#endif" @keyword | ||
"#if" @keyword | ||
"#ifdef" @keyword | ||
"#ifndef" @keyword | ||
"#include" @keyword | ||
(preproc_directive) @keyword | ||
|
||
"--" @operator | ||
"-" @operator | ||
"-=" @operator | ||
"->" @operator | ||
"=" @operator | ||
"!=" @operator | ||
"*" @operator | ||
"&" @operator | ||
"&&" @operator | ||
"+" @operator | ||
"++" @operator | ||
"+=" @operator | ||
"<" @operator | ||
"==" @operator | ||
">" @operator | ||
"||" @operator | ||
|
||
"." @delimiter | ||
";" @delimiter | ||
|
||
(string_literal) @string | ||
(system_lib_string) @string | ||
|
||
(null) @constant | ||
(number_literal) @number | ||
(char_literal) @number | ||
|
||
(call_expression | ||
function: (identifier) @function) | ||
(call_expression | ||
function: (field_expression | ||
field: (field_identifier) @function)) | ||
(function_declarator | ||
declarator: (identifier) @function) | ||
(preproc_function_def | ||
name: (identifier) @function.special) | ||
|
||
(field_identifier) @property | ||
(statement_identifier) @label | ||
(type_identifier) @type | ||
(primitive_type) @type | ||
(sized_type_specifier) @type | ||
|
||
((identifier) @constant | ||
(#match? @constant "^[A-Z][A-Z\\d_]*$")) | ||
|
||
(identifier) @variable | ||
|
||
(comment) @comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found the TheRenegadeCoder/sample-programs repo useful for checking how these languages render.
App for Testing