Homepage: https://www.gnu.org/software/emacs
Author: Perry Smith
Major mode for editing Ruby files using tree-sitter
This file defines ruby-ts-mode which is a major mode for editing Ruby files that uses Tree Sitter to parse the language. More information about Tree Sitter can be found in the ELisp Info pages as well as this website: https://tree-sitter.github.io/tree-sitter/ For this major mode to work, Emacs has to be compiled with tree-sitter support, and the Ruby grammar has to be compiled and put somewhere Emacs can find it. See the docstring of `treesit-extra-load-path'. This mode doesn't associate itself with .rb files automatically. You can do that either by prepending to the value of `auto-mode-alist', or using `major-mode-remap-alist'. Tree Sitter brings a lot of power and versitility which can be broken into these features. * Font Lock The ability to color the source code is not new but what is new is the versatility to enable and disable particular font lock rules. I suggest reviewing variable treesit-font-lock-level and function treesit-font-lock-recompute-features to get a better understanding of the following. Currently tree treesit-font-lock-feature-list is set with the following levels: 1: comment method-definition parameter-definition 2: keyword regexp string type 3: builtin-variable builtin-constant builtin-function delimiter escape-sequence constant global instance interpolation literal symbol assignment 4: bracket error function operator punctuation Thus if treesit-font-lock-level is set to level 3 which is its default, all the features listed in levels 1 through 3 above will be enabled. i.e. those features will font lock or colorize the code accordingly. Individual features can be added and removed via treesit-font-lock-recompute-features. describe-face can be used to view how a face looks. * Indent ruby-ts-mode tries to adhere to the indentation related user options from ruby-mode, such as ruby-indent-level, ruby-indent-tabs-mode, and so on. Type 'M-x customize-group RET ruby RET' to see the options. * IMenu * Navigation * Which-func