diff --git a/Cargo.lock b/Cargo.lock index ccf23cde0..4f617ade7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,9 +151,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" [[package]] name = "cc" -version = "1.2.20" +version = "1.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04da6a0d40b948dfc4fa8f5bbf402b0fc1a64a28dbf7d12ffd683550f2c1b63a" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" dependencies = [ "shlex", ] @@ -177,9 +177,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -913,7 +913,7 @@ dependencies = [ "itoa", "libc", "memmap2", - "rustix 1.0.5", + "rustix 1.0.7", "smallvec", "thiserror 2.0.12", ] @@ -1530,7 +1530,7 @@ dependencies = [ "regex-automata", "regex-cursor", "ropey", - "rustix 1.0.5", + "rustix 1.0.7", "tempfile", "unicode-segmentation", "which", @@ -1637,7 +1637,7 @@ dependencies = [ "log", "once_cell", "parking_lot", - "rustix 1.0.5", + "rustix 1.0.7", "serde", "serde_json", "slotmap", @@ -2374,9 +2374,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.5" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", @@ -2622,7 +2622,7 @@ dependencies = [ "fastrand", "getrandom 0.3.1", "once_cell", - "rustix 1.0.5", + "rustix 1.0.7", "windows-sys 0.59.0", ] @@ -2995,7 +2995,7 @@ checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" dependencies = [ "either", "env_home", - "rustix 1.0.5", + "rustix 1.0.7", "winsafe", ] diff --git a/book/src/command-line.md b/book/src/command-line.md index 7bf32bbda..2c0723fae 100644 --- a/book/src/command-line.md +++ b/book/src/command-line.md @@ -47,6 +47,8 @@ The following variables are supported: | `cursor_column` | The column number of the primary cursor in the currently focused document, starting at 1. This is counted as the number of grapheme clusters from the start of the line rather than bytes or codepoints. | | `buffer_name` | The relative path of the currently focused document. `[scratch]` is expanded instead for scratch buffers. | | `line_ending` | A string containing the line ending of the currently focused document. For example on Unix systems this is usually a line-feed character (`\n`) but on Windows systems this may be a carriage-return plus a line-feed (`\r\n`). The line ending kind of the currently focused document can be inspected with the `:line-ending` command. | +| `language` | A string containing the language name of the currently focused document.| +| `selection` | A string containing the contents of the primary selection of the currently focused document. | Aside from editor variables, the following expansions may be used: diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index d66f7bef1..5b2962a48 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -46,6 +46,7 @@ | dot | ✓ | | | `dot-language-server` | | dtd | ✓ | | | | | dune | ✓ | | | | +| dunstrc | ✓ | | | | | earthfile | ✓ | ✓ | ✓ | `earthlyls` | | edoc | ✓ | | | | | eex | ✓ | | | | @@ -180,6 +181,7 @@ | prolog | ✓ | | ✓ | `swipl` | | protobuf | ✓ | ✓ | ✓ | `buf`, `pb`, `protols` | | prql | ✓ | | | | +| pug | ✓ | | | | | purescript | ✓ | ✓ | | `purescript-language-server` | | python | ✓ | ✓ | ✓ | `ruff`, `jedi-language-server`, `pylsp` | | qml | ✓ | | ✓ | `qmlls` | @@ -200,6 +202,7 @@ | scala | ✓ | ✓ | ✓ | `metals` | | scheme | ✓ | | ✓ | | | scss | ✓ | | | `vscode-css-language-server` | +| slang | ✓ | ✓ | ✓ | `slangd` | | slint | ✓ | ✓ | ✓ | `slint-lsp` | | smali | ✓ | | ✓ | | | smithy | ✓ | | | `cs` | diff --git a/book/src/generated/static-cmd.md b/book/src/generated/static-cmd.md index f6a82020f..92a1fb2a1 100644 --- a/book/src/generated/static-cmd.md +++ b/book/src/generated/static-cmd.md @@ -153,6 +153,8 @@ | `goto_last_change` | Goto last change | normal: `` ]G ``, select: `` ]G `` | | `goto_line_start` | Goto line start | normal: `` gh ``, `` ``, select: `` gh ``, insert: `` `` | | `goto_line_end` | Goto line end | normal: `` gl ``, `` ``, select: `` gl `` | +| `goto_column` | Goto column | normal: `` g\| `` | +| `extend_to_column` | Extend to column | select: `` g\| `` | | `goto_next_buffer` | Goto next buffer | normal: `` gn ``, select: `` gn `` | | `goto_previous_buffer` | Goto previous buffer | normal: `` gp ``, select: `` gp `` | | `goto_line_end_newline` | Goto newline at line end | insert: `` `` | diff --git a/book/src/guides/textobject.md b/book/src/guides/textobject.md index 2cf3d3bec..b0efb03bc 100644 --- a/book/src/guides/textobject.md +++ b/book/src/guides/textobject.md @@ -23,6 +23,7 @@ The following [captures][tree-sitter-captures] are recognized: | `test.inside` | | `test.around` | | `parameter.inside` | +| `parameter.around` | | `comment.inside` | | `comment.around` | | `entry.inside` | diff --git a/book/src/keymap.md b/book/src/keymap.md index 2797eaee2..be7085351 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -213,6 +213,7 @@ Jumps to various locations. | Key | Description | Command | | ----- | ----------- | ------- | | `g` | Go to line number `` else start of file | `goto_file_start` | +| | | Go to column number `` else start of line | `goto_column` | | `e` | Go to the end of the file | `goto_last_line` | | `f` | Go to files in the selections | `goto_file` | | `h` | Go to the start of the line | `goto_line_start` | diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs index dcf440312..343cc9b95 100644 --- a/helix-loader/src/grammar.rs +++ b/helix-loader/src/grammar.rs @@ -451,7 +451,6 @@ fn build_tree_sitter_library( command .args(["/nologo", "/LD", "/I"]) .arg(header_path) - .arg("/Od") .arg("/utf-8") .arg("/std:c11"); if let Some(scanner_path) = scanner_path.as_ref() { @@ -469,7 +468,6 @@ fn build_tree_sitter_library( cpp_command .args(["/nologo", "/LD", "/I"]) .arg(header_path) - .arg("/Od") .arg("/utf-8") .arg("/std:c++14") .arg(format!("/Fo{}", object_file.display())) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index da215548f..dc770f92e 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -451,6 +451,8 @@ impl MappableCommand { goto_last_change, "Goto last change", goto_line_start, "Goto line start", goto_line_end, "Goto line end", + goto_column, "Goto column", + extend_to_column, "Extend to column", goto_next_buffer, "Goto next buffer", goto_previous_buffer, "Goto previous buffer", goto_line_end_newline, "Goto newline at line end", @@ -3839,6 +3841,28 @@ fn goto_last_line_impl(cx: &mut Context, movement: Movement) { doc.set_selection(view.id, selection); } +fn goto_column(cx: &mut Context) { + goto_column_impl(cx, Movement::Move); +} + +fn extend_to_column(cx: &mut Context) { + goto_column_impl(cx, Movement::Extend); +} + +fn goto_column_impl(cx: &mut Context, movement: Movement) { + let count = cx.count(); + let (view, doc) = current!(cx.editor); + let text = doc.text().slice(..); + let selection = doc.selection(view.id).clone().transform(|range| { + let line = range.cursor_line(text); + let line_start = text.line_to_char(line); + let line_end = line_end_char_index(&text, line); + let pos = graphemes::nth_next_grapheme_boundary(text, line_start, count - 1).min(line_end); + range.put_cursor(text, pos, movement == Movement::Extend) + }); + doc.set_selection(view.id, selection); +} + fn goto_last_accessed_file(cx: &mut Context) { let view = view_mut!(cx.editor); if let Some(alt) = view.docs_access_history.pop() { diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index b9189eb30..82baf336f 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -38,6 +38,7 @@ pub fn default() -> HashMap { "G" => goto_line, "g" => { "Goto" "g" => goto_file_start, + "|" => goto_column, "e" => goto_last_line, "f" => goto_file, "h" => goto_line_start, @@ -368,6 +369,7 @@ pub fn default() -> HashMap { "v" => normal_mode, "g" => { "Goto" "g" => extend_to_file_start, + "|" => extend_to_column, "e" => extend_to_last_line, "k" => extend_line_up, "j" => extend_line_down, diff --git a/helix-view/src/expansion.rs b/helix-view/src/expansion.rs index 96a71b8e5..99baf4bfb 100644 --- a/helix-view/src/expansion.rs +++ b/helix-view/src/expansion.rs @@ -33,6 +33,10 @@ pub enum Variable { BufferName, /// A string containing the line-ending of the currently focused document. LineEnding, + // The name of current buffers language as set in `languages.toml` + Language, + // Primary selection + Selection, } impl Variable { @@ -41,6 +45,8 @@ impl Variable { Self::CursorColumn, Self::BufferName, Self::LineEnding, + Self::Language, + Self::Selection, ]; pub const fn as_str(&self) -> &'static str { @@ -49,6 +55,8 @@ impl Variable { Self::CursorColumn => "cursor_column", Self::BufferName => "buffer_name", Self::LineEnding => "line_ending", + Self::Language => "language", + Self::Selection => "selection", } } @@ -58,6 +66,8 @@ impl Variable { "cursor_column" => Some(Self::CursorColumn), "buffer_name" => Some(Self::BufferName), "line_ending" => Some(Self::LineEnding), + "language" => Some(Self::Language), + "selection" => Some(Self::Selection), _ => None, } } @@ -215,5 +225,12 @@ fn expand_variable(editor: &Editor, variable: Variable) -> Result Ok(Cow::Borrowed(doc.line_ending.as_str())), + Variable::Language => Ok(match doc.language_name() { + Some(lang) => Cow::Owned(lang.to_owned()), + None => Cow::Borrowed("text"), + }), + Variable::Selection => Ok(Cow::Owned( + doc.selection(view.id).primary().fragment(text).to_string(), + )), } } diff --git a/languages.toml b/languages.toml index 680d0dcd8..13f70db4a 100644 --- a/languages.toml +++ b/languages.toml @@ -104,6 +104,7 @@ robotframework_ls = { command = "robotframework_ls" } ruff = { command = "ruff", args = ["server"] } ruby-lsp = { command = "ruby-lsp" } serve-d = { command = "serve-d" } +slangd = { command = "slangd" } slint-lsp = { command = "slint-lsp", args = [] } solargraph = { command = "solargraph", args = ["stdio"] } solc = { command = "solc", args = ["--lsp"] } @@ -1899,7 +1900,7 @@ source = { git = "https://github.com/mtoohey31/tree-sitter-gitattributes", rev = [[language]] name = "git-ignore" scope = "source.gitignore" -file-types = [{ glob = ".gitignore_global" }, { glob = "git/ignore" }, { glob = ".ignore" }, { glob = "CODEOWNERS" }, { glob = ".config/helix/ignore" }, { glob = ".helix/ignore" }, { glob = ".*ignore" }] +file-types = [{ glob = ".gitignore_global" }, { glob = "git/ignore" }, { glob = ".ignore" }, { glob = "CODEOWNERS" }, { glob = ".config/helix/ignore" }, { glob = ".helix/ignore" }, { glob = ".*ignore" }, { glob = ".git-blame-ignore-revs" }] injection-regex = "git-ignore" comment-token = "#" grammar = "gitignore" @@ -2577,6 +2578,20 @@ formatter = { command = "cue", args = ["fmt", "-"] } name = "cue" source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "8a5f273bfa281c66354da562f2307c2d394b6c81" } +[[language]] +name = "slang" +scope = "source.lang" +injection-regex = "slang" +file-types = ["slang"] +comment-token = "//" +block-comment-tokens = { start = "/*", end = "*/" } +language-servers = [ "slangd" ] +indent = { tab-width = 4, unit = " " } + +[[grammar]] +name = "slang" +source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-slang", rev = "327b1b821c255867a4fb724c8eee48887e3d014b" } + [[language]] name = "slint" scope = "source.slint" @@ -4313,3 +4328,24 @@ comment-tokens = "#" [[grammar]] name = "debian" source = { git = "https://gitlab.com/MggMuggins/tree-sitter-debian", rev = "9b3f4b78c45aab8a2f25a5f9e7bbc00995bc3dde" } + +[[language]] +name = "pug" +scope = "source.pug" +file-types = ["pug"] +comment-tokens = ["//", "//-"] +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "pug" +source = { git = "https://github.com/zealot128/tree-sitter-pug", rev = "13e9195370172c86a8b88184cc358b23b677cc46" } + +[[language]] +name = "dunstrc" +scope = "source.dunstrc" +comment-tokens = ["#", ";"] +file-types = [ { glob = "dunst/dunstrc" } ] + +[[grammar]] +name = "dunstrc" +source = { git = "https://github.com/rotmh/tree-sitter-dunstrc", rev = "9cb9d5cc51cf5e2a47bb2a0e2f2e519ff11c1431" } diff --git a/runtime/queries/dunstrc/highlights.scm b/runtime/queries/dunstrc/highlights.scm new file mode 100644 index 000000000..8964b43de --- /dev/null +++ b/runtime/queries/dunstrc/highlights.scm @@ -0,0 +1,14 @@ +(assign + (key) @attribute) + +(comment) @comment.line + +[ + "[" + "]" +] @punctuation.bracket + +"=" @operator + +(section + (name) @namespace) diff --git a/runtime/queries/erlang/highlights.scm b/runtime/queries/erlang/highlights.scm index 4bdeceaab..13b57e954 100644 --- a/runtime/queries/erlang/highlights.scm +++ b/runtime/queries/erlang/highlights.scm @@ -1,5 +1,5 @@ ; Comments -(tripledot) @comment.discard +(tripledot) @comment.unused [(comment) (line_comment) (shebang)] @comment @@ -114,10 +114,6 @@ ] @comment.block.documentation) (#any-of? @keyword "doc" "moduledoc")) -; Ignored variables -((variable) @comment.discard - (#match? @comment.discard "^_")) - ; Macros (macro "?"+ @keyword.directive @@ -163,3 +159,7 @@ (record field: (atom) @variable.other.member) (record name: (atom) @type) + +; Ignored variables +((variable) @comment.unused + (#match? @comment.unused "^_")) diff --git a/runtime/queries/pug/highlights.scm b/runtime/queries/pug/highlights.scm new file mode 100644 index 000000000..3e5c66fe0 --- /dev/null +++ b/runtime/queries/pug/highlights.scm @@ -0,0 +1,97 @@ +(comment) @comment + +( + doctype + (("doctype") @keyword.storage.type) + ((doctype_name) @type.enum.variant) +) + +(tag_name) @constant + +; Attributes +(id) @attribute +(class) @attribute +(attribute_name) @attribute + +(quoted_attribute_value) @string + +; Controls +( + conditional + ((keyword) @keyword.control.conditional) +) +( + case + ((keyword) @keyword.control) + ( + when + ((keyword) @keyword.control) + ) +) +( + each + ((keyword) @keyword.control.repeat) +) +( + else + ((keyword) @keyword.control.conditional) +) +( + while + ((keyword) @keyword.control.repeat) +) + +; Mixins +( + mixin_definition + ((keyword) @keyword.function) + ((mixin_name) @function.method) +) +( + mixin_use + (("+") @operator) + ((mixin_name) @function.method) +) + +; Includes +( + include + ((keyword) @keyword.directive) + ((filename) @string.special.path) +) + +; Inheritance +( + extends + ((keyword) @keyword.directive) + ((filename) @string.special.path) +) +( + block_definition + ((keyword) @keyword.directive) + ((block_name) @function.method) +) +( + block_append + ((keyword) @keyword.directive) + ((block_name) @function.method) +) +( + block_prepend + ((keyword) @keyword.directive) + ((block_name) @function.method) +) + +; Filters +( + filter + (":" @function.macro) + ((filter_name) @function.macro) + ((content) @special) +) + +; Inline JavaScript +( + unbuffered_code + (("-") @special) +) diff --git a/runtime/queries/pug/injections.scm b/runtime/queries/pug/injections.scm new file mode 100644 index 000000000..328787f57 --- /dev/null +++ b/runtime/queries/pug/injections.scm @@ -0,0 +1,3 @@ +((javascript) @injection.content + (#set! injection.language "javascript") +) diff --git a/runtime/queries/slang/highlights.scm b/runtime/queries/slang/highlights.scm new file mode 100644 index 000000000..030aea634 --- /dev/null +++ b/runtime/queries/slang/highlights.scm @@ -0,0 +1,371 @@ +; inherits: c + +; cpp +((identifier) @variable.other.member + (#match? @variable.other.member "^m_.*$")) + +(parameter_declaration + declarator: (reference_declarator) @variable.parameter) + +; function(Foo ...foo) +(variadic_parameter_declaration + declarator: (variadic_declarator + (_) @variable.parameter)) + +; int foo = 0 +(optional_parameter_declaration + declarator: (_) @variable.parameter) + +(field_declaration + (field_identifier) @variable.other.member) + +(field_initializer + (field_identifier) @variable.other.member) + +(function_declarator + declarator: (field_identifier) @function.method) + +(concept_definition + name: (identifier) @type) + +(alias_declaration + name: (type_identifier) @type) + +(namespace_identifier) @namespace + +((namespace_identifier) @type + (#match? @type "^[%u]")) + +(case_statement + value: (qualified_identifier + (identifier) @constant)) + +(using_declaration + . + "using" + . + "namespace" + . + [ + (qualified_identifier) + (identifier) + ] @namespace) + +(destructor_name + (identifier) @function.method) + +; functions +(function_declarator + (qualified_identifier + (identifier) @function)) + +(function_declarator + (qualified_identifier + (qualified_identifier + (identifier) @function))) + +(function_declarator + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function)))) + +(function_declarator + (template_function + (identifier) @function)) + +(operator_name) @function + +"operator" @function + +"static_assert" @function.builtin + + +(call_expression + (qualified_identifier + (identifier) @function)) + + +(call_expression + (qualified_identifier + (qualified_identifier + (identifier) @function))) + +(call_expression + (qualified_identifier + (qualified_identifier + (qualified_identifier + (identifier) @function)))) + +(call_expression + (template_function + (identifier) @function)) + +(call_expression + (qualified_identifier + (template_function + (identifier) @function))) + +(call_expression + (qualified_identifier + (qualified_identifier + (template_function + (identifier) @function)))) + +(call_expression + (qualified_identifier + (qualified_identifier + (qualified_identifier + (template_function + (identifier) @function))))) + +; methods +(function_declarator + (template_method + (field_identifier) @function.method)) + +(call_expression + (field_expression + (field_identifier) @function.method)) + +; constructors +((function_declarator + (qualified_identifier + (identifier) @constructor)) + (#match? @constructor "^%u")) + +((call_expression + function: (identifier) @constructor) + (#match? @constructor "^%u")) + +((call_expression + function: (qualified_identifier + name: (identifier) @constructor)) + (#match? @constructor "^%u")) + +((call_expression + function: (field_expression + field: (field_identifier) @constructor)) + (#match? @constructor "^%u")) + +; constructing a type in an initializer list: Constructor (): **SuperType (1)** +((field_initializer + (field_identifier) @constructor + (argument_list)) + (#match? @constructor "^%u")) + +; Constants +(this) @variable.builtin + +(null + "nullptr" @constant.builtin) + +(true) @constant.builtin.boolean + +(false) @constant.builtin.boolean + +; Literals +(raw_string_literal) @string + +; Keywords +[ + "try" + "catch" + "noexcept" + "throw" +] @keyword.control.exception + +[ + "decltype" + "explicit" + "friend" + "override" + "using" + "requires" + "constexpr" +] @keyword + +[ + "class" + "namespace" + "template" + "typename" + "concept" +] @keyword.storage.type + +[ + "co_await" + "co_yield" + "co_return" +] @keyword + +[ + "public" + "private" + "protected" + "final" + "virtual" +] @keyword.storage.modifier + +[ + "new" + "delete" + "xor" + "bitand" + "bitor" + "compl" + "not" + "xor_eq" + "and_eq" + "or_eq" + "not_eq" + "and" + "or" +] @keyword.operator + +"<=>" @operator + +"::" @punctuation.delimiter + +(template_argument_list + [ + "<" + ">" + ] @punctuation.bracket) + +(template_parameter_list + [ + "<" + ">" + ] @punctuation.bracket) + +(literal_suffix) @operator + +; hlsl +[ + "in" + "out" + "inout" + "uniform" + "shared" + "groupshared" + "discard" + "cbuffer" + "row_major" + "column_major" + "globallycoherent" + "centroid" + "noperspective" + "nointerpolation" + "sample" + "linear" + "snorm" + "unorm" + "point" + "line" + "triangleadj" + "lineadj" + "triangle" +] @keyword + +((identifier) @variable.builtin + (#match? @variable.builtin "^SV_")) +; ((identifier) @variable) + +(hlsl_attribute) @attribute + +(hlsl_attribute + [ + "[" + "]" + ] @attribute) + +"This" @type.builtin + +[ + "interface" + "extension" + "property" + "associatedtype" + "where" + "var" + "let" +] @keyword + +"__init" @constructor + +[ + "__subscript" + "get" + "set" +] @function.builtin + +(call_expression) @function + +(call_expression (identifier)) @function + +((call_expression + function: (identifier) @function.builtin) + (#any-of? @function.builtin + "frac" "abs" "acos" "acosh" "asin" "asinh" "atan" "atanh" "cos" "cosh" "exp" "exp2" "floor" "log" "log10" "log2" "round" "rsqrt" "sin" "sincos" "sinh" "sqrt" "tan" "tanh" "trunc" + "AllMemoryBarrier" "AllMemoryBarrierWithGroupSync" "DeviceMemoryBarrier" "DeviceMemoryBarrierWithGroupSync" "GroupMemoryBarrier" "GroupMemoryBarrierWithGroupSync" + "abort" "clip" "errorf" "printf" + "all" "any" "countbits" "faceforward" "firstbithigh" "firstbitlow" "isfinite" "isinf" "isnan" "max" "min" "noise" "pow" "reversebits" "sign" + "asdouble" "asfloat" "asint" "asuint" "D3DCOLORtoUBYTE4" "f16tof32" "f32tof16" + "ceil" "clamp" "degrees" "fma" "fmod" "frac" "frexp" "ldexp" "lerp" "mad" "modf" "radiants" "saturate" "smoothstep" "step" + "cross" "determinant" "distance" "dot" "dst" "length" "lit" "msad4" "mul" "normalize" "rcp" "reflect" "refract" "transpose" + "ddx" "ddx_coarse" "ddx_fine" "ddy" "ddy_coarse" "ddy_fine" "fwidth" + "EvaluateAttributeAtCentroid" "EvaluateAttributeAtSample" "EvaluateAttributeSnapped" + "GetRenderTargetSampleCount" "GetRenderTargetSamplePosition" + "InterlockedAdd" "InterlockedAnd" "InterlockedCompareExchange" "InterlockedCompareStore" "InterlockedExchange" "InterlockedMax" "InterlockedMin" "InterlockedOr" "InterlockedXor" + "InterlockedCompareStoreFloatBitwise" "InterlockedCompareExchangeFloatBitwise" + "Process2DQuadTessFactorsAvg" "Process2DQuadTessFactorsMax" "Process2DQuadTessFactorsMin" "ProcessIsolineTessFactors" + "ProcessQuadTessFactorsAvg" "ProcessQuadTessFactorsMax" "ProcessQuadTessFactorsMin" "ProcessTriTessFactorsAvg" "ProcessTriTessFactorsMax" "ProcessTriTessFactorsMin" + "tex1D" "tex1Dbias" "tex1Dgrad" "tex1Dlod" "tex1Dproj" + "tex2D" "tex2Dbias" "tex2Dgrad" "tex2Dlod" "tex2Dproj" + "tex3D" "tex3Dbias" "tex3Dgrad" "tex3Dlod" "tex3Dproj" + "texCUBE" "texCUBEbias" "texCUBEgrad" "texCUBElod" "texCUBEproj" + "WaveIsFirstLane" "WaveGetLaneCount" "WaveGetLaneIndex" + "IsHelperLane" + "WaveActiveAnyTrue" "WaveActiveAllTrue" "WaveActiveBallot" + "WaveReadLaneFirst" "WaveReadLaneAt" + "WaveActiveAllEqual" "WaveActiveAllEqualBool" "WaveActiveCountBits" + "WaveActiveSum" "WaveActiveProduct" "WaveActiveBitAnd" "WaveActiveBitOr" "WaveActiveBitXor" "WaveActiveMin" "WaveActiveMax" + "WavePrefixCountBits" "WavePrefixProduct" "WavePrefixSum" + "QuadReadAcrossX" "QuadReadAcrossY" "QuadReadAcrossDiagonal" "QuadReadLaneAt" + "QuadAny" "QuadAll" + "WaveMatch" "WaveMultiPrefixSum" "WaveMultiPrefixProduct" "WaveMultiPrefixCountBits" "WaveMultiPrefixAnd" "WaveMultiPrefixOr" "WaveMultiPrefixXor" + "NonUniformResourceIndex" + "DispatchMesh" "SetMeshOutputCounts" + "dot4add_u8packed" "dot4add_i8packed" "dot2add" + "RestartStrip" + "CalculateLevelOfDetail" "CalculateLevelOfDetailUnclamped" "Gather" "GetDimensions" "GetSamplePosition" "Load" "Sample" "SampleBias" "SampleCmp" "SampleCmpLevelZero" "SampleGrad" "SampleLevel" "GatherRaw" "SampleCmpLevel" + "SampleCmpBias" "SampleCmpGrad" + "WriteSamplerFeedback" "WriteSamplerFeedbackBias" "WriteSamplerFeedbackGrad" "WriteSamplerFeedbackLevel" + "Append" "Consume" "DecrementCounter" "IncrementCounter" + "Load2" "Load3" "Load4" "Store" "Store2" "Store3" "Store4" + "GatherRed" "GatherGreen" "GatherBlue" "GatherAlpha" "GatherCmp" "GatherCmpRed" "GatherCmpGreen" "GatherCmpBlue" "GatherCmpAlpha" + )) + +(interface_requirements + (identifier) @type) + +(binary_expression + [ + "is" + "as" + ] + right: (identifier) @type) + +[ + "as" + "is" +] @keyword.operator + +[ + "__exported" + "import" +] @keyword.control.import + +(property_declaration + (identifier) @variable.other.member) diff --git a/runtime/queries/slang/indents.scm b/runtime/queries/slang/indents.scm new file mode 100644 index 000000000..75ed7a936 --- /dev/null +++ b/runtime/queries/slang/indents.scm @@ -0,0 +1,6 @@ +; inherits: hlsl + +[ + (interface_specifier) + (extension_specifier) +] @indent diff --git a/runtime/queries/slang/injections.scm b/runtime/queries/slang/injections.scm new file mode 100644 index 000000000..2fd39cba0 --- /dev/null +++ b/runtime/queries/slang/injections.scm @@ -0,0 +1,5 @@ +((preproc_arg) @injection.content + (#set! injection.language "slang")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/slang/textobjects.scm b/runtime/queries/slang/textobjects.scm new file mode 100644 index 000000000..4658f46ca --- /dev/null +++ b/runtime/queries/slang/textobjects.scm @@ -0,0 +1,30 @@ +(function_definition + body: (_) @function.inside) @function.around + +(struct_specifier + body: (_) @class.inside) @class.around + +(interface_specifier + body: (_) @class.inside) @class.around + +(enum_specifier + body: (_) @class.inside) @class.around + +(union_specifier + body: (_) @class.inside) @class.around + +(parameter_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(argument_list + ((_) @parameter.inside . ","? @parameter.around) @parameter.around) + +(comment) @comment.inside + +(comment)+ @comment.around + +(enumerator + (_) @entry.inside) @entry.around + +(initializer_list + (_) @entry.around) diff --git a/runtime/queries/verilog/highlights.scm b/runtime/queries/verilog/highlights.scm index de65cab07..9cec88be1 100644 --- a/runtime/queries/verilog/highlights.scm +++ b/runtime/queries/verilog/highlights.scm @@ -106,6 +106,7 @@ "+" "/" "*" + "**" "^" "&" "|" @@ -118,8 +119,6 @@ "'{" "<=" "@" - "or" - "and" "==" "!=" "===" @@ -131,8 +130,15 @@ "%" ">>" "<<" + ">>>" + "<<<" "|=" (inc_or_dec_operator) + "?" +] @operator +[ + "or" + "and" ] @keyword.operator (cast