Skip to content

Commit

Permalink
feat: add support for Go and TypeScript with TreeSitter-Go and TreeSi…
Browse files Browse the repository at this point in the history
…tter-TypeScript integration #2
  • Loading branch information
phodal committed Apr 9, 2024
1 parent 3f37385 commit b79c28f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/semantic-treesitter/go/GoTSConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ export const GoTSConfig: TSLanguageConfig = {
name: (identifier) @name.definition.method) @definition.method
`),
structureQuery: new MemoizedQuery(`
(package_clause
(package_identifier) @package-name)
(import_declaration
(import_spec
(import_path
(string_literal) @import-name))) @import-name
(function_declaration
name: (identifier) @function-name)
(method_declaration
name: (identifier) @method-name)
(type_declaration
(type_spec
(type_identifier) @type-name))
`),
namespaces: [
// variables
["const", "var", "func", "module"],
Expand Down
25 changes: 25 additions & 0 deletions src/semantic-treesitter/typescript/TypeScriptTSConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ export const TypeScriptTSConfig: TSLanguageConfig = {
(function_declaration
(identifier) @name.definition.method) @definition.method
`),
structureQuery: new MemoizedQuery(`
(import_statement
(import_clause
(named_import_clause
(import_specifier
(identifier) @import-name)))) @import-name
)
(class_declaration
name: (identifier) @class-name
body: (class_body
(method_definition
name: (property_identifier) @class-method-name
parameters: (formal_parameters (identifier)? @parameter)
)
)
)
(interface_declaration
(identifier) @interface-name
)
(program (function_declaration
name: * @function-name))
`),
namespaces: [
[
//variables
Expand Down

0 comments on commit b79c28f

Please sign in to comment.