summaryrefslogtreecommitdiff
path: root/lisp/progmodes/json-ts-mode.el
Commit message (Collapse)AuthorAgeFilesLines
* Make tree-sitter based modes optionalEli Zaretskii2023-01-201-0/+4
| | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/c-ts-mode.el: Update Commentary. Make 'auto-mode-alist' update conditional on the tree-sitter and grammar libraries being available. * lisp/progmodes/cmake-ts-mode.el: * lisp/progmodes/csharp-mode.el: * lisp/progmodes/dockerfile-ts-mode.el: * lisp/progmodes/go-ts-mode.el: * lisp/progmodes/java-ts-mode.el: * lisp/progmodes/js.el: * lisp/progmodes/json-ts-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/ruby-ts-mode.el: * lisp/progmodes/typescript-ts-mode.el: * lisp/textmodes/css-mode.el: * lisp/textmodes/toml-ts-mode.el: * lisp/textmodes/yaml-ts-mode.el: Make 'auto-mode-alist' update for tree-sitter based modes be conditional on the tree-sitter and grammar libraries being available. (Bug#60559)
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* ; Avoid treesit-related byte-compiler warningsEli Zaretskii2022-12-281-0/+1
| | | | | | | | | * lisp/progmodes/json-ts-mode.el (treesit-node-child-by-field-name): * lisp/textmodes/toml-ts-mode.el (treesit-node-child-by-field-name): * lisp/progmodes/java-ts-mode.el (treesit-node-child-by-field-name): * lisp/progmodes/csharp-mode.el (treesit-node-child-by-field-name): Avoid byte-compilation warnings about treesit-node-type.
* Update tree-sitter major modes to use the new Imenu facilityYuan Fu2022-12-271-32/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See previous commit for more explanation. * lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-name): Handle more types. (c-ts-mode--imenu-1) (c-ts-mode--imenu): Remove functions. (c-ts-base-mode): Setup Imenu. * lisp/progmodes/csharp-mode.el (csharp-ts-mode--imenu-1) (csharp-ts-mode--imenu): Remove functions. (csharp-ts-mode): Setup Imenu. * lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu-1) (java-ts-mode--imenu): Remove functions. (java-ts-mode): Setup Imenu. * lisp/progmodes/js.el (js--treesit-imenu-1) (js--treesit-imenu): Remove functions. (js--treesit-valid-imenu-entry): New function. (js-ts-mode): Setup Imenu. * lisp/progmodes/json-ts-mode.el (json-ts-mode--defun-name): Trim the quotes. (json-ts-mode--imenu-1) (json-ts-mode--imenu): Remove functions. (json-ts-mode): Setup Imenu. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--imenu) (rust-ts-mode--imenu-1): Remove functions. (rust-ts-mode): Setup Imenu. * lisp/progmodes/typescript-ts-mode.el: (typescript-ts-base-mode): Remove treesit-defun-prefer-top-level, it's not used anymore. Setup Imenu. Setup treesit-defun-name-function. * lisp/textmodes/css-mode.el (css--treesit-imenu-1) (css--treesit-imenu): Remove functions. (css-ts-mode): Setup Imenu. * lisp/textmodes/toml-ts-mode.el (toml-ts-mode--defun-name): Fix it and add a fallback. (toml-ts-mode--imenu-1) (toml-ts-mode--imenu): Remove functions. (toml-ts-mode): Setup Imenu.
* Support treesit-defun-name in tree-sitter major modesYuan Fu2022-12-241-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/csharp-mode.el (csharp-ts-mode--defun-name): New function. (csharp-ts-mode--imenu-1): Extract into new function. (csharp-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/java-ts-mode.el (java-ts-mode--defun-name): New function. (java-ts-mode--imenu-1): Extract into new function. (java-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/js.el (js-treesit-current-defun): Remove function. This function is not used (for a while already). (js--treesit-defun-name): New function. (js--treesit-imenu-1): Extract into new function. (js-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/json-ts-mode.el (json-ts-mode--defun-name): New function. (json-ts-mode--imenu-1): Extract into new function. (json-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/python.el (python--treesit-defun-name): New function. (python--imenu-treesit-create-index-1): Extract into new function. (python-ts-mode): Setup treesit-defun-name-function. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--defun-name): New function. (rust-ts-mode--imenu-1): Extract into new function. (rust-ts-mode): Setup treesit-defun-name-function. * lisp/textmodes/css-mode.el (css--treesit-defun-name): New function. (css--treesit-imenu-1): Extract into new function. (css-ts-mode): Setup treesit-defun-name-function. * lisp/textmodes/toml-ts-mode.el (toml-ts-mode--get-table-name): Remove function. (toml-ts-mode--defun-name): New function. (toml-ts-mode--imenu-1): Extract into new function. (toml-ts-mode): Setup treesit-defun-name-function.
* Fix indentation in json-ts-mode (bug#60123)Jostein Kjønigsen2022-12-161-1/+2
| | | | | * lisp/progmodes/json-ts-mode.el (json-ts--indent-rules): Add indentation rules for arrays.
* Tweak various ts-mode's indent and fontification (bug#59931)Theodor Thornhill2022-12-121-1/+4
| | | | | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Add raw string literal font-locking. * lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Add text_block indent rule. (java-ts-mode--font-lock-settings): Add text_block font-locking. * lisp/progmodes/js.el (js-ts-mode): Prefer top-level navigation. * lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings): Add comment feature. (json-ts-mode): Use comment feature. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode): Prefer top-level navigation.
* ; Normalize GPLv3 license statements in new filesStefan Kangas2022-12-091-4/+3
|
* Fix syntax-table for tree-sitter modesTheodor Thornhill2022-12-071-3/+5
| | | | | | | | | | | | | | | | | | When adapting the 'c-populate-syntax-table' for tree-sitter, I misread the code, and thus some crucial entries were missing. For the relevant modes we use the same table as specified in the non-tree-sitter major mode. * lisp/progmodes/c-ts-mode.el (c-ts-mode--syntax-table): Add new entries. * lisp/progmodes/csharp-mode.el (csharp-ts-mode): Add new entries. * lisp/progmodes/java-ts-mode.el (java-ts-mode--syntax-table): Add new entries. * lisp/progmodes/json-ts-mode.el (json-ts-mode--syntax-table): Add new entries. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--syntax-table): Add new entries. * lisp/textmodes/css-mode.el (css-ts-mode): Add new entries.
* Add back pair feature in json-ts-mode fontification (bug#59833)Theodor Thornhill2022-12-051-1/+5
| | | | | | * lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings): Add back in removed pair feature. Also alphabetize features. (json-ts-mode): Use the new feature.
* Utilize new font-lock faces for more tree-sitter modes (Bug#59397)Randy Taylor2022-11-221-14/+18
| | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): Use font-lock-number-face. (java-ts-mode): Alphabetize features. * lisp/progmodes/js.el (js--treesit-operators): Define operators. (js--treesit-font-lock-settings): Use bracket, delimiter, escape-sequence, property, number, and operator font-lock faces. (js-ts-mode): Add them to the feature list and alphabetize. * lisp/progmodes/json-ts-mode.el (json-ts-mode--font-lock-settings): Use bracket, delimiter, escape-sequence, and number faces. Remove unused features. (json-ts-mode): Add them to the feature list and alphabetize. * lisp/progmodes/sh-script.el (sh-mode--treesit-settings): Use bracket, delimiter, number, misc-punctuation, and operator font-lock faces. (sh-mode--treesit-operators): Remove ; and ;; from list. (bash-ts-mode): Add them to the feature list and alphabetize. * lisp/progmodes/ts-mode.el (ts-mode--operators): Define operators. (ts-mode--font-lock-settings): Use escape-sequence, number, and operator font-lock faces. (ts-mode): Add them to the feature list and alphabetize.
* ; Silence byte-compiler warningsEli Zaretskii2022-11-211-0/+6
| | | | | | | | | | * lisp/textmodes/css-mode.el: * lisp/progmodes/python.el: * lisp/progmodes/json-ts-mode.el: * lisp/progmodes/js.el: * lisp/progmodes/java-ts-mode.el: * lisp/progmodes/c-ts-mode.el: Add declarations of tree-sitter functions.
* Limit recursion level for tree-sitter imenu functionsYuan Fu2022-11-201-1/+1
| | | | | | | | | | | | | | Generating imenu index doesn't require going down to the bottom of the tree (defun's are usually top-level). Add limit so we don't go too far down on very large buffers. * lisp/progmodes/c-ts-mode.el (c-ts-mode--imenu) * lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu) * lisp/progmodes/js.el (js--treesit-imenu) * lisp/progmodes/json-ts-mode.el (json-ts-mode--imenu) * lisp/progmodes/python.el (python-imenu-treesit-create-index) * lisp/textmodes/css-mode.el (css--treesit-imenu): Add limit to treesit-induce-sparse-tree.
* Fix uses of treesit-ready-pYuan Fu2022-11-191-1/+1
| | | | | | | | | | | * lisp/progmodes/c-ts-mode.el (c-ts-mode) (c++-ts-mode) * lisp/progmodes/java-ts-mode.el (java-ts-mode) * lisp/progmodes/js.el (js-ts-mode) * lisp/progmodes/json-ts-mode.el (json-ts-mode) * lisp/progmodes/python.el (python-ts-mode) * lisp/progmodes/sh-script.el (sh-mode) * lisp/progmodes/ts-mode.el (ts-mode): Remove the MODE argument.
* Fix some inconsistencies in *-ts-modesTheodor Thornhill2022-11-141-14/+25
| | | | | | | | | | | | | | | | | | | | (c-ts-mode--base-mode): Extract comment-* so that we can separate between C and C++. (c-ts-mode, c++-ts-mode): Set comment-* variables. * lisp/progmodes/css-ts-mode.el (css-ts-mode): Add electric-indent. * lisp/progmodes/java-ts-mode.el (java-ts-mode--imenu): Add categories. Only display categories that exist in the file. (java-ts-mode): Add electric-indent. * lisp/progmodes/json-ts-mode.el (json-ts-mode): Add electric-indent. * lisp/progmodes/ts-mode.el (ts-mode--font-lock-settings): Whitespace cleanup. (ts-mode): Add electric-indent.
* ; Minor typo fixes for tree-sitter modesYuan Fu2022-11-121-3/+3
| | | | | | | | | * etc/NEWS: Fix typos. Change Tree-sitter to tree-sitter. * lisp/progmodes/c-ts-mode.el * lisp/progmodes/css-ts-mode.el * lisp/progmodes/java-ts-mode.el * lisp/progmodes/json-ts-mode.el: Change Tree Sitter to tree-sitter. Fix typo.
* Add tree-sitter modes for C-like languagesTheodor Thornhill2022-11-121-0/+150
* etc/NEWS: Mention the new modes * lisp/progmodes/c-ts-mode.el: New major mode with tree-sitter support for C and C++. * lisp/progmodes/java-ts-mode.el: New major mode with tree-sitter support. * lisp/progmodes/json-ts-mode.el: New major mode with tree-sitter support. * lisp/progmodes/css-ts-mode.el: New major mode with tree-sitter support.