Function: go-work-ts-mode
go-work-ts-mode is an autoloaded, interactive and byte-compiled
function defined in go-ts-mode.el.gz.
Signature
(go-work-ts-mode)
Documentation
Major mode for editing go.work files, powered by tree-sitter.
In addition to any hooks its parent mode prog-mode might have run,
this mode runs the hook go-work-ts-mode-hook, as the final or
penultimate step during initialization.
Probably introduced at or before Emacs version 31.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/go-ts-mode.el.gz
;;;###autoload
(define-derived-mode go-work-ts-mode prog-mode "Go Work"
"Major mode for editing go.work files, powered by tree-sitter."
:group 'go
;; `treesit-ready-p' also checks for buffer size.
(when (and (treesit-ensure-installed 'gowork)
(treesit-ready-p 'gowork))
(setq treesit-primary-parser (treesit-parser-create 'gowork))
;; Comments.
(setq-local comment-start "// ")
(setq-local comment-end "")
(setq-local comment-start-skip (rx "//" (* (syntax whitespace))))
(setq-local comment-start-line-regexp comment-start-skip)
;; Indent.
(setq-local indent-tabs-mode t
treesit-simple-indent-rules go-work-ts-mode--indent-rules)
;; Font-lock.
(setq-local treesit-font-lock-settings go-work-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
'((comment)
(keyword)
(number)
(bracket error operator)))
(treesit-major-mode-setup)))