Skip to content

Commit

Permalink
chore(language/go): move custom tree-sitter query to golang module
Browse files Browse the repository at this point in the history
Instead of keeping the custom Go specific tree-sitter query in the
tree-sitter module, move it the golang module.
  • Loading branch information
jimeh committed Oct 4, 2022
1 parent d1dd30d commit 3b280e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 10 additions & 0 deletions modules/languages/siren-golang.el
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@
(add-to-list 'projectile-globally-ignored-directories "vendor/github.com")
(add-to-list 'projectile-globally-ignored-directories "vendor/gopkg.in"))

(with-eval-after-load 'tree-sitter-langs
(tree-sitter-hl-add-patterns 'go
[
;; Highlight built-in functions with the built-in face, based on:
;; https://github.com/tree-sitter/tree-sitter-go/pull/61
(call_expression
function: (identifier) @function.builtin
(.match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
]))

:config
(siren-define-golines-format-mode)

Expand Down
10 changes: 1 addition & 9 deletions modules/text-editing/siren-tree-sitter.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@

(use-package tree-sitter-langs
:hook
(tree-sitter-after-on . tree-sitter-hl-mode)

:config
(tree-sitter-hl-add-patterns 'go
;; from: https://github.com/tree-sitter/tree-sitter-go/pull/61
[(call_expression
function: (identifier) @function.builtin
(.match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))])
)
(tree-sitter-after-on . tree-sitter-hl-mode))

(provide 'siren-tree-sitter)
;;; siren-tree-sitter.el ends here

0 comments on commit 3b280e2

Please sign in to comment.