Skip to content

Commit

Permalink
feat: add golang repository context support (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys authored Oct 14, 2023
1 parent 9dc5acb commit b9df0eb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/tabby-scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 27 additions & 0 deletions crates/tabby-scheduler/queries/go.scm
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions crates/tabby-scheduler/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,17 @@ lazy_static! {
.unwrap(),
),
),
(
"go",
TagsConfigurationSync(
TagsConfiguration::new(
tree_sitter_go::language(),
include_str!("../queries/go.scm"),
"",
)
.unwrap(),
),
),
])
};
}

0 comments on commit b9df0eb

Please sign in to comment.