A language object defines how to parse a particular programming language. It is usually dynamically loaded from a shared library (
tree-sitter-load-path is a list of directories that the function
tree-sitter-require uses to search for these shared libraries. This is similar to how the built-in function
require searches for Emacs libraries on
load-path. The default value contains the directory used by the
tree-sitter CLI tool.
;; Load the language definition for Rust, if it hasn't been loaded. ;; Return the language object. (tree-sitter-require 'rust)
tree-sitter-langs is a language bundle that contains shared libraries for some languages (as well as syntax highlighting queries). When it is loaded, its shared libraries are prioritized over the CLI’s directory.
Syntax-aware language-agnostic mechanisms are meant to be defined by
tree-sitter-mode and its dependent minor modes. They determine the language object to use by consulting the variable
tree-sitter-major-mode-language-alist. This list is empty by default, and gets populated by
tree-sitter-langs when it is loaded, and by language major modes that are
Language major modes use these generic mechanisms to provide functionalities specific to their languages. Currently, there are not many language major modes built on top of
tree-sitter. An example is csharp-mode.
For the full list of languages bundled by
tree-sitter-langs, see the submodules under its repos/ directory.