Variable: go-ts-mode-abbrev-table

go-ts-mode-abbrev-table is a variable defined in go-ts-mode.el.gz.

Value

#<obarray n=1>

Documentation

Abbrev table for go-ts-mode.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/go-ts-mode.el.gz
;;;###autoload
(define-derived-mode go-ts-mode prog-mode "Go"
  "Major mode for editing Go, powered by tree-sitter.

\\{go-ts-mode-map}"
  :group 'go
  :syntax-table go-ts-mode--syntax-table

  ;; `treesit-ready-p' also checks for buffer size.
  (when (and (treesit-ensure-installed 'go)
             (treesit-ready-p 'go))
    (setq treesit-primary-parser (treesit-parser-create 'go))

    ;; Comments.
    (c-ts-common-comment-setup)

    ;; Navigation.
    (setq-local treesit-defun-type-regexp
                (regexp-opt '("method_declaration"
                              "function_declaration"
                              "type_declaration")))
    (setq-local treesit-defun-name-function #'go-ts-mode--defun-name)

    (setq-local treesit-thing-settings
                `((go
                   (list
                    ,(rx bos (or "import_spec_list"
                                 "var_spec_list"
                                 "type_parameter_list"
                                 "parameter_list"
                                 "parenthesized_type"
                                 "type_arguments"
                                 "field_declaration_list"
                                 "block"
                                 "parenthesized_expression"
                                 "special_argument_list"
                                 "argument_list"
                                 "literal_value")
                         eos))
                   (sexp-default
                    ;; For `C-M-f' in "switch a |{ }"
                    (lambda (node)
                      (equal (treesit-node-type (treesit-node-parent node))
                             "expression_switch_statement")))
                   (sentence
                    (or "declaration" "statement")))))

    ;; Imenu.
    (setq-local treesit-simple-imenu-settings
                `(("Function" "\\`function_declaration\\'" nil nil)
                  ("Method" "\\`method_declaration\\'" nil nil)
                  ("Struct" "\\`type_declaration\\'" go-ts-mode--struct-node-p nil)
                  ("Interface" "\\`type_declaration\\'" go-ts-mode--interface-node-p nil)
                  ("Type" "\\`type_declaration\\'" go-ts-mode--other-type-node-p nil)
                  ("Alias" "\\`type_declaration\\'" go-ts-mode--alias-node-p nil)))

    ;; Indent.
    (setq-local indent-tabs-mode t
                treesit-simple-indent-rules go-ts-mode--indent-rules)

    ;; Electric
    (setq-local electric-indent-chars
                (append "{}()" electric-indent-chars))

    ;; Font-lock.
    (setq-local treesit-font-lock-settings (go-ts-mode--font-lock-settings))
    (setq-local treesit-font-lock-feature-list
                '(( comment definition)
                  ( keyword string type)
                  ( builtin constant escape-sequence label number)
                  ( bracket delimiter error function operator property variable)))

    (treesit-major-mode-setup)))