Merge branch 'master' into debug

This commit is contained in:
Dmitry Sharshakov 2021-10-09 16:03:46 +03:00
commit 48cb81eff1
No known key found for this signature in database
GPG key ID: 471FD32E15FD8473
9 changed files with 283 additions and 157 deletions

16
Cargo.lock generated
View file

@ -599,9 +599,9 @@ dependencies = [
[[package]] [[package]]
name = "lsp-types" name = "lsp-types"
version = "0.89.2" version = "0.90.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852e0dedfd52cc32325598b2631e0eba31b7b708959676a9f837042f276b09a2" checksum = "a7404037aab080771c90b0a499836d9d8a10336ecd07badf969567b65c6d51a1"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"serde", "serde",
@ -966,9 +966,9 @@ dependencies = [
[[package]] [[package]]
name = "similar" name = "similar"
version = "2.0.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bf11003835e462f07851028082d2a1c89d956180ce4b4b50e07fb085ec4131a" checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3"
[[package]] [[package]]
name = "slab" name = "slab"
@ -987,9 +987,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.6.1" version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
[[package]] [[package]]
name = "str-buf" name = "str-buf"
@ -1074,9 +1074,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.11.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce" checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",

View file

@ -88,10 +88,10 @@
| `,` | Keep only the primary selection | `keep_primary_selection` | | `,` | Keep only the primary selection | `keep_primary_selection` |
| `C` | Copy selection onto the next line | `copy_selection_on_next_line` | | `C` | Copy selection onto the next line | `copy_selection_on_next_line` |
| `Alt-C` | Copy selection onto the previous line | `copy_selection_on_prev_line` | | `Alt-C` | Copy selection onto the previous line | `copy_selection_on_prev_line` |
| `(` | Rotate main selection forward | `rotate_selections_backward` | | `(` | Rotate main selection backward | `rotate_selections_backward` |
| `)` | Rotate main selection backward | `rotate_selections_forward` | | `)` | Rotate main selection forward | `rotate_selections_forward` |
| `Alt-(` | Rotate selection contents forward | `rotate_selection_contents_backward` | | `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
| `Alt-)` | Rotate selection contents backward | `rotate_selection_contents_forward` | | `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
| `%` | Select entire file | `select_all` | | `%` | Select entire file | `select_all` |
| `x` | Select current line, if already selected, extend to next line | `extend_line` | | `x` | Select current line, if already selected, extend to next line | `extend_line` |
| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` | | `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |

View file

@ -17,7 +17,7 @@ helix-syntax = { version = "0.4", path = "../helix-syntax" }
helix-dap = { version = "0.4", path = "../helix-dap" } helix-dap = { version = "0.4", path = "../helix-dap" }
ropey = "1.3" ropey = "1.3"
smallvec = "1.4" smallvec = "1.7"
tendril = "0.4.2" tendril = "0.4.2"
unicode-segmentation = "1.8" unicode-segmentation = "1.8"
unicode-width = "0.1" unicode-width = "0.1"
@ -31,7 +31,7 @@ regex = "1"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
toml = "0.5" toml = "0.5"
similar = "2.0" similar = "2.1"
etcetera = "0.3" etcetera = "0.3"

View file

@ -19,9 +19,9 @@ futures-executor = "0.3"
futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false } futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
jsonrpc-core = { version = "18.0", default-features = false } # don't pull in all of futures jsonrpc-core = { version = "18.0", default-features = false } # don't pull in all of futures
log = "0.4" log = "0.4"
lsp-types = { version = "0.89", features = ["proposed"] } lsp-types = { version = "0.90", features = ["proposed"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
thiserror = "1.0" thiserror = "1.0"
tokio = { version = "1.11", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] } tokio = { version = "1.12", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
tokio-stream = "0.1" tokio-stream = "0.1.7"

@ -1 +1 @@
Subproject commit 049162bea8a44e1a4acd01b06e1c8672d9231a86 Subproject commit 1f27fd1dfe7f352408f01b4894c7825f3a1d6c47

View file

@ -1310,6 +1310,7 @@ fn global_search(cx: &mut Context) {
cx.push_layer(Box::new(prompt)); cx.push_layer(Box::new(prompt));
let root = find_root(None).unwrap_or_else(|| PathBuf::from("./"));
let show_picker = async move { let show_picker = async move {
let all_matches: Vec<(usize, PathBuf)> = let all_matches: Vec<(usize, PathBuf)> =
UnboundedReceiverStream::new(all_matches_rx).collect().await; UnboundedReceiverStream::new(all_matches_rx).collect().await;
@ -1321,7 +1322,13 @@ fn global_search(cx: &mut Context) {
} }
let picker = FilePicker::new( let picker = FilePicker::new(
all_matches, all_matches,
move |(_line_num, path)| path.to_str().unwrap().into(), move |(_line_num, path)| {
path.strip_prefix(&root)
.unwrap_or(path)
.to_str()
.unwrap()
.into()
},
move |editor: &mut Editor, (line_num, path), action| { move |editor: &mut Editor, (line_num, path), action| {
match editor.open(path.into(), action) { match editor.open(path.into(), action) {
Ok(_) => {} Ok(_) => {}
@ -1504,7 +1511,7 @@ mod cmd {
#[derive(Clone)] #[derive(Clone)]
pub struct TypableCommand { pub struct TypableCommand {
pub name: &'static str, pub name: &'static str,
pub alias: Option<&'static str>, pub aliases: &'static [&'static str],
pub doc: &'static str, pub doc: &'static str,
// params, flags, helper, completer // params, flags, helper, completer
pub fun: fn(&mut compositor::Context, &[&str], PromptEvent) -> anyhow::Result<()>, pub fun: fn(&mut compositor::Context, &[&str], PromptEvent) -> anyhow::Result<()>,
@ -2178,238 +2185,238 @@ mod cmd {
pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
TypableCommand { TypableCommand {
name: "quit", name: "quit",
alias: Some("q"), aliases: &["q"],
doc: "Close the current view.", doc: "Close the current view.",
fun: quit, fun: quit,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "quit!", name: "quit!",
alias: Some("q!"), aliases: &["q!"],
doc: "Close the current view.", doc: "Close the current view.",
fun: force_quit, fun: force_quit,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "open", name: "open",
alias: Some("o"), aliases: &["o"],
doc: "Open a file from disk into the current view.", doc: "Open a file from disk into the current view.",
fun: open, fun: open,
completer: Some(completers::filename), completer: Some(completers::filename),
}, },
TypableCommand { TypableCommand {
name: "write", name: "write",
alias: Some("w"), aliases: &["w"],
doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)", doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)",
fun: write, fun: write,
completer: Some(completers::filename), completer: Some(completers::filename),
}, },
TypableCommand { TypableCommand {
name: "new", name: "new",
alias: Some("n"), aliases: &["n"],
doc: "Create a new scratch buffer.", doc: "Create a new scratch buffer.",
fun: new_file, fun: new_file,
completer: Some(completers::filename), completer: Some(completers::filename),
}, },
TypableCommand { TypableCommand {
name: "format", name: "format",
alias: Some("fmt"), aliases: &["fmt"],
doc: "Format the file using a formatter.", doc: "Format the file using a formatter.",
fun: format, fun: format,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "indent-style", name: "indent-style",
alias: None, aliases: &[],
doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)", doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)",
fun: set_indent_style, fun: set_indent_style,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "line-ending", name: "line-ending",
alias: None, aliases: &[],
doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.", doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.",
fun: set_line_ending, fun: set_line_ending,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "earlier", name: "earlier",
alias: Some("ear"), aliases: &["ear"],
doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.", doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.",
fun: earlier, fun: earlier,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "later", name: "later",
alias: Some("lat"), aliases: &["lat"],
doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.", doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
fun: later, fun: later,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "write-quit", name: "write-quit",
alias: Some("wq"), aliases: &["wq", "x"],
doc: "Writes changes to disk and closes the current view. Accepts an optional path (:wq some/path.txt)", doc: "Writes changes to disk and closes the current view. Accepts an optional path (:wq some/path.txt)",
fun: write_quit, fun: write_quit,
completer: Some(completers::filename), completer: Some(completers::filename),
}, },
TypableCommand { TypableCommand {
name: "write-quit!", name: "write-quit!",
alias: Some("wq!"), aliases: &["wq!", "x!"],
doc: "Writes changes to disk and closes the current view forcefully. Accepts an optional path (:wq! some/path.txt)", doc: "Writes changes to disk and closes the current view forcefully. Accepts an optional path (:wq! some/path.txt)",
fun: force_write_quit, fun: force_write_quit,
completer: Some(completers::filename), completer: Some(completers::filename),
}, },
TypableCommand { TypableCommand {
name: "write-all", name: "write-all",
alias: Some("wa"), aliases: &["wa"],
doc: "Writes changes from all views to disk.", doc: "Writes changes from all views to disk.",
fun: write_all, fun: write_all,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "write-quit-all", name: "write-quit-all",
alias: Some("wqa"), aliases: &["wqa", "xa"],
doc: "Writes changes from all views to disk and close all views.", doc: "Writes changes from all views to disk and close all views.",
fun: write_all_quit, fun: write_all_quit,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "write-quit-all!", name: "write-quit-all!",
alias: Some("wqa!"), aliases: &["wqa!", "xa!"],
doc: "Writes changes from all views to disk and close all views forcefully (ignoring unsaved changes).", doc: "Writes changes from all views to disk and close all views forcefully (ignoring unsaved changes).",
fun: force_write_all_quit, fun: force_write_all_quit,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "quit-all", name: "quit-all",
alias: Some("qa"), aliases: &["qa"],
doc: "Close all views.", doc: "Close all views.",
fun: quit_all, fun: quit_all,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "quit-all!", name: "quit-all!",
alias: Some("qa!"), aliases: &["qa!"],
doc: "Close all views forcefully (ignoring unsaved changes).", doc: "Close all views forcefully (ignoring unsaved changes).",
fun: force_quit_all, fun: force_quit_all,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "theme", name: "theme",
alias: None, aliases: &[],
doc: "Change the theme of current view. Requires theme name as argument (:theme <name>)", doc: "Change the theme of current view. Requires theme name as argument (:theme <name>)",
fun: theme, fun: theme,
completer: Some(completers::theme), completer: Some(completers::theme),
}, },
TypableCommand { TypableCommand {
name: "clipboard-yank", name: "clipboard-yank",
alias: None, aliases: &[],
doc: "Yank main selection into system clipboard.", doc: "Yank main selection into system clipboard.",
fun: yank_main_selection_to_clipboard, fun: yank_main_selection_to_clipboard,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "clipboard-yank-join", name: "clipboard-yank-join",
alias: None, aliases: &[],
doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc. doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
fun: yank_joined_to_clipboard, fun: yank_joined_to_clipboard,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "primary-clipboard-yank", name: "primary-clipboard-yank",
alias: None, aliases: &[],
doc: "Yank main selection into system primary clipboard.", doc: "Yank main selection into system primary clipboard.",
fun: yank_main_selection_to_primary_clipboard, fun: yank_main_selection_to_primary_clipboard,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "primary-clipboard-yank-join", name: "primary-clipboard-yank-join",
alias: None, aliases: &[],
doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc. doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc.
fun: yank_joined_to_primary_clipboard, fun: yank_joined_to_primary_clipboard,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "clipboard-paste-after", name: "clipboard-paste-after",
alias: None, aliases: &[],
doc: "Paste system clipboard after selections.", doc: "Paste system clipboard after selections.",
fun: paste_clipboard_after, fun: paste_clipboard_after,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "clipboard-paste-before", name: "clipboard-paste-before",
alias: None, aliases: &[],
doc: "Paste system clipboard before selections.", doc: "Paste system clipboard before selections.",
fun: paste_clipboard_before, fun: paste_clipboard_before,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "clipboard-paste-replace", name: "clipboard-paste-replace",
alias: None, aliases: &[],
doc: "Replace selections with content of system clipboard.", doc: "Replace selections with content of system clipboard.",
fun: replace_selections_with_clipboard, fun: replace_selections_with_clipboard,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "primary-clipboard-paste-after", name: "primary-clipboard-paste-after",
alias: None, aliases: &[],
doc: "Paste primary clipboard after selections.", doc: "Paste primary clipboard after selections.",
fun: paste_primary_clipboard_after, fun: paste_primary_clipboard_after,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "primary-clipboard-paste-before", name: "primary-clipboard-paste-before",
alias: None, aliases: &[],
doc: "Paste primary clipboard before selections.", doc: "Paste primary clipboard before selections.",
fun: paste_primary_clipboard_before, fun: paste_primary_clipboard_before,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "primary-clipboard-paste-replace", name: "primary-clipboard-paste-replace",
alias: None, aliases: &[],
doc: "Replace selections with content of system primary clipboard.", doc: "Replace selections with content of system primary clipboard.",
fun: replace_selections_with_primary_clipboard, fun: replace_selections_with_primary_clipboard,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "show-clipboard-provider", name: "show-clipboard-provider",
alias: None, aliases: &[],
doc: "Show clipboard provider name in status bar.", doc: "Show clipboard provider name in status bar.",
fun: show_clipboard_provider, fun: show_clipboard_provider,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "change-current-directory", name: "change-current-directory",
alias: Some("cd"), aliases: &["cd"],
doc: "Change the current working directory (:cd <dir>).", doc: "Change the current working directory (:cd <dir>).",
fun: change_current_directory, fun: change_current_directory,
completer: Some(completers::directory), completer: Some(completers::directory),
}, },
TypableCommand { TypableCommand {
name: "show-directory", name: "show-directory",
alias: Some("pwd"), aliases: &["pwd"],
doc: "Show the current working directory.", doc: "Show the current working directory.",
fun: show_current_directory, fun: show_current_directory,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "encoding", name: "encoding",
alias: None, aliases: &[],
doc: "Set encoding based on `https://encoding.spec.whatwg.org`", doc: "Set encoding based on `https://encoding.spec.whatwg.org`",
fun: set_encoding, fun: set_encoding,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "reload", name: "reload",
alias: None, aliases: &[],
doc: "Discard changes and reload from the source file.", doc: "Discard changes and reload from the source file.",
fun: reload, fun: reload,
completer: None, completer: None,
}, },
TypableCommand { TypableCommand {
name: "tree-sitter-scopes", name: "tree-sitter-scopes",
alias: None, aliases: &[],
doc: "Display tree sitter scopes, primarily for theming and development.", doc: "Display tree sitter scopes, primarily for theming and development.",
fun: tree_sitter_scopes, fun: tree_sitter_scopes,
completer: None, completer: None,
@ -2437,14 +2444,14 @@ mod cmd {
}, },
TypableCommand { TypableCommand {
name: "vsplit", name: "vsplit",
alias: Some("vs"), aliases: &["vs"],
doc: "Open the file in a vertical split.", doc: "Open the file in a vertical split.",
fun: vsplit, fun: vsplit,
completer: Some(completers::filename), completer: Some(completers::filename),
}, },
TypableCommand { TypableCommand {
name: "hsplit", name: "hsplit",
alias: Some("sp"), aliases: &["hs", "sp"],
doc: "Open the file in a horizontal split.", doc: "Open the file in a horizontal split.",
fun: hsplit, fun: hsplit,
completer: Some(completers::filename), completer: Some(completers::filename),
@ -2452,16 +2459,13 @@ mod cmd {
]; ];
pub static COMMANDS: Lazy<HashMap<&'static str, &'static TypableCommand>> = Lazy::new(|| { pub static COMMANDS: Lazy<HashMap<&'static str, &'static TypableCommand>> = Lazy::new(|| {
let mut map = HashMap::new(); TYPABLE_COMMAND_LIST
.iter()
for cmd in TYPABLE_COMMAND_LIST { .flat_map(|cmd| {
map.insert(cmd.name, cmd); std::iter::once((cmd.name, cmd))
if let Some(alias) = cmd.alias { .chain(cmd.aliases.iter().map(move |&alias| (alias, cmd)))
map.insert(alias, cmd); })
} .collect()
}
map
}); });
} }

View file

@ -4,82 +4,89 @@
(line_comment) (line_comment)
] @comment ] @comment
; field in top level decl, and in struct, union... [
(ContainerField variable: (IDENTIFIER)
(IDENTIFIER) @property variable_type_function: (IDENTIFIER)
(SuffixExpr (IDENTIFIER) @type)? ] @variable
)
; error.OutOfMemory; parameter: (IDENTIFIER) @variable.parameter
(SuffixExpr
"error"
"."
(IDENTIFIER) @constant
)
; var x: IDENTIFIER [
type: (SuffixExpr (IDENTIFIER) @type) field_member: (IDENTIFIER)
field_access: (IDENTIFIER)
] @variable.property
; IDENTIFIER{} ;; assume TitleCase is a type
constructor: (SuffixExpr (IDENTIFIER) @constructor)
; fields
(FieldInit (IDENTIFIER) @property)
; foo.bar.baz.function() calls
( (
(SuffixOp
(IDENTIFIER) @function
)
.
(FnCallArguments)
)
; function() calls
(
(
(IDENTIFIER) @function
)
.
(FnCallArguments)
)
; functionn decl
(FnProto
(IDENTIFIER) @function
(SuffixExpr (IDENTIFIER) @type)?
("!")? @function.macro
)
; function parameters and types
(ParamDecl
(IDENTIFIER) @variable.parameter
":"
[ [
(ParamType (SuffixExpr (IDENTIFIER) @type)) variable_type_function: (IDENTIFIER)
(ParamType) field_access: (IDENTIFIER)
] parameter: (IDENTIFIER)
] @type
(#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$")
)
;; assume camelCase is a function
(
[
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
parameter: (IDENTIFIER)
] @function
(#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$")
) )
; switch ;; assume all CAPS_1 is a constant
(SwitchItem (
(SuffixExpr [
"." variable_type_function: (IDENTIFIER)
. field_access: (IDENTIFIER)
(IDENTIFIER) @constant ] @constant
) (#match? @constant "^[A-Z][A-Z_0-9]+$")
) )
[
function_call: (IDENTIFIER)
function: (IDENTIFIER)
] @function
exception: "!" @function.macro
(
(IDENTIFIER) @variable.builtin
(#eq? @variable.builtin "_")
)
(PtrTypeStart "c" @variable.builtin)
(
(ContainerDeclType
[
(ErrorUnionExpr)
"enum"
]
)
(ContainerField (IDENTIFIER) @constant)
)
field_constant: (IDENTIFIER) @constant
(BUILTINIDENTIFIER) @function.builtin
((BUILTINIDENTIFIER) @keyword.control.import
(#any-of? @keyword.control.import "@import" "@cImport"))
(INTEGER) @number (INTEGER) @number
(FLOAT) @number (FLOAT) @number
[ [
(STRINGLITERAL) (LINESTRING)
(STRINGLITERALSINGLE) (STRINGLITERALSINGLE)
] @string ] @string
(CHAR_LITERAL) @string (CHAR_LITERAL) @constant.character
(EscapeSequence) @escape
(FormatSequence) @string.special
[ [
"allowzero" "allowzero"
@ -95,6 +102,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
[ [
"true" "true"
"false" "false"
] @constant.builtin.boolean
[
"undefined" "undefined"
"unreachable" "unreachable"
"null" "null"
@ -104,21 +114,18 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
"else" "else"
"if" "if"
"switch" "switch"
] @keyword.control.conditional
[
"for" "for"
"while" "while"
"return" ] @keyword.control.repeat
"break"
"continue" [
"defer" "or"
"errdefer" "and"
"async" "orelse"
"nosuspend" ] @operator
"await"
"suspend"
"resume"
"try"
"catch"
] @keyword.control
[ [
"struct" "struct"
@ -127,21 +134,48 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
"error" "error"
"packed" "packed"
"opaque" "opaque"
"test"
"usingnamespace"
"export"
"extern"
"const"
"var"
"comptime"
"threadlocal"
] @keyword ] @keyword
[ [
"pub" "try"
"error"
"catch"
] @function.macro
; VarDecl
[
"comptime"
"threadlocal"
"fn" "fn"
] @keyword.function ] @keyword.function
[
"const"
"var"
"test"
"pub"
"usingnamespace"
] @keyword
[
"return"
"break"
"continue"
] @keyword.control
; Macro
[
"defer"
"errdefer"
"async"
"nosuspend"
"await"
"suspend"
"resume"
"export"
"extern"
] @function.macro
; PrecProc ; PrecProc
[ [
"inline" "inline"
@ -149,10 +183,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
"asm" "asm"
"callconv" "callconv"
"noalias" "noalias"
] @attribute ] @keyword.directive
[ [
(BUILTINIDENTIFIER)
"linksection" "linksection"
"align" "align"
] @function.builtin ] @function.builtin
@ -164,9 +197,6 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
(AdditionOp) (AdditionOp)
(MultiplyOp) (MultiplyOp)
(PrefixOp) (PrefixOp)
"or"
"and"
"orelse"
"*" "*"
"**" "**"
"->" "->"
@ -174,6 +204,7 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
".?" ".?"
".*" ".*"
"=" "="
"?"
] @operator ] @operator
[ [
@ -186,6 +217,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
[ [
".." ".."
"..." "..."
] @punctuation.special
[
"[" "["
"]" "]"
"(" "("
@ -195,4 +229,7 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor)
(Payload "|") (Payload "|")
(PtrPayload "|") (PtrPayload "|")
(PtrIndexPayload "|") (PtrIndexPayload "|")
] @punctuation ] @punctuation.bracket
; Error
(ERROR) @keyword

View file

@ -1,8 +1,9 @@
indent = [ indent = [
"block", "Block",
"match_block", "BlockExpr",
"arguments", "ContainerDecl",
"parameters" "SwitchExpr",
"InitList"
] ]
outdent = [ outdent = [

84
runtime/themes/nord.toml Normal file
View file

@ -0,0 +1,84 @@
# Author : RayGervais<raygervais@hotmail.ca>
# "ui.linenr.selected" = { fg = "#d8dee9" }
# "ui.text.focus" = { fg = "#e5ded6", modifiers= ["bold"] }
# "ui.menu.selected" = { fg = "#e5ded6", bg = "#313f4e" }
# "info" = "#b48ead"
# "hint" = "#a3be8c"
# Polar Night
# nord0 - background color
"ui.background" = { bg = "#2e3440" }
"ui.statusline.inactive" = { fg = "#d8dEE9", bg = "#2e3440" }
# nord1 - status bars, panels, modals, autocompletion
"ui.statusline" = { fg = "#88c0d0", bg = "#3b4252" }
"ui.popup" = { bg = "#232d38" }
"ui.window" = { bg = "#232d38" }
"ui.help" = { bg = "#232d38", fg = "#e5ded6" }
# nord2 - active line, highlighting
"ui.selection" = { bg = "#434c5e" }
"ui.cursor.match" = { bg = "434c5e" }
# nord3 - comments
"comment" = "#4c566a"
"ui.linenr" = { fg = "#4c566a" }
# Snow Storm
# nord4 - cursor, variables, constants, attributes, fields
"ui.cursor.primary" = { fg = "#d8dee9", modifiers = ["reversed"] }
"attribute" = "#d8dee9"
"variable" = "#d8dee9"
"constant" = "#d8dee9"
"variable.builtin" = "#d8dee9"
"constant.builtin" = "#d8dee9"
"namespace" = "#d8dee9"
# nord5 - suble UI text
# nord6 - base text, punctuation
"ui.text" = { fg = "#eceff4" }
"punctuation" = "#eceff4"
# Frost
# nord7 - classes, types, primiatives
"type" = "#8fbcbb"
"type.builtin" = { fg = "#8fbcbb"}
"label" = "#8fbcbb"
# nord8 - declaration, methods, routines
"constructor" = "#88c0d0"
"function" = "#88c0d0"
"function.macro" = { fg = "#88c0d0" }
"function.builtin" = { fg = "#88c0d0" }
# nord9 - operator, tags, units, punctuations
"punctuation.delimiter" = "#81a1c1"
"operator" = { fg = "#81a1c1" }
"property" = "#81a1c1"
# nord10 - keywords, special
"keyword" = { fg = "#5e81ac" }
"keyword.directive" = "#5e81ac"
"variable.parameter" = "#5e81ac"
# Aurora
# nord11 - error
"error" = "#bf616a"
# nord12 - annotations, decorators
"special" = "#d08770"
"module" = "#d08770"
# nord13 - warnings, escape characters, regex
"warning" = "#ebcb8b"
"escape" = { fg = "#ebcb8b" }
# nord14 - strings
"string" = "#a3be8c"
# nord15 - integer, floating point
"number" = "#b48ead"