diff --git a/Cargo.lock b/Cargo.lock index 962bb2a702fc..888e718d1e84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3205,6 +3205,7 @@ dependencies = [ "tokio", "tracing", "tracing-test", + "tree-sitter-go", "tree-sitter-python", "tree-sitter-rust", "tree-sitter-tags", @@ -3925,6 +3926,16 @@ dependencies = [ "regex", ] +[[package]] +name = "tree-sitter-go" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad6d11f19441b961af2fda7f12f5d0dac325f6d6de83836a1d3750018cc5114" +dependencies = [ + "cc", + "tree-sitter", +] + [[package]] name = "tree-sitter-python" version = "0.20.2" diff --git a/crates/tabby-scheduler/Cargo.toml b/crates/tabby-scheduler/Cargo.toml index 451953234256..531f6fdfbc4c 100644 --- a/crates/tabby-scheduler/Cargo.toml +++ b/crates/tabby-scheduler/Cargo.toml @@ -21,6 +21,7 @@ file-rotate = "0.7.5" tree-sitter-python = "0.20.2" tree-sitter-rust = "0.20.3" tree-sitter-typescript = "0.20.3" +tree-sitter-go = "0.20.0" [dev-dependencies] temp_testdir = "0.2" diff --git a/crates/tabby-scheduler/queries/go.scm b/crates/tabby-scheduler/queries/go.scm new file mode 100644 index 000000000000..d8d52719f72e --- /dev/null +++ b/crates/tabby-scheduler/queries/go.scm @@ -0,0 +1,27 @@ +( + (comment)* @doc + . + (function_declaration + name: (identifier) @name) @definition.function + (#strip! @doc "^//\\s*") + (#set-adjacent! @doc @definition.function) +) + +( + (comment)* @doc + . + (method_declaration + name: (field_identifier) @name) @definition.method + (#strip! @doc "^//\\s*") + (#set-adjacent! @doc @definition.method) +) + +(call_expression + function: [ + (identifier) @name + (parenthesized_expression (identifier) @name) + (selector_expression field: (field_identifier) @name) + (parenthesized_expression (selector_expression field: (field_identifier) @name)) + ]) @reference.call + +(type_declaration (type_spec name: (type_identifier) @name)) @definition.type \ No newline at end of file diff --git a/crates/tabby-scheduler/src/dataset.rs b/crates/tabby-scheduler/src/dataset.rs index 215a1021e17d..63c6284e07b4 100644 --- a/crates/tabby-scheduler/src/dataset.rs +++ b/crates/tabby-scheduler/src/dataset.rs @@ -259,6 +259,17 @@ lazy_static! { .unwrap(), ), ), + ( + "go", + TagsConfigurationSync( + TagsConfiguration::new( + tree_sitter_go::language(), + tree_sitter_go::TAGGING_QUERY, + "", + ) + .unwrap(), + ), + ), ]) }; }