summaryrefslogtreecommitdiff
path: root/lisp/progmodes/go-ts-mode.el
Commit message (Collapse)AuthorAgeFilesLines
* Update go-ts-mode to support latest tree-sitter-go grammarYuan Fu2024-04-091-2/+11
| | | | | | | | | | tree-sitter-go changed method_spec to method_elem in https://github.com/tree-sitter/tree-sitter-go/commit/b82ab803d887002a0af11f6ce63d72884580bf33 * lisp/progmodes/go-ts-mode.el: (go-ts-mode--method-elem-supported-p): New function. (go-ts-mode--font-lock-settings): Conditionally use method_elem or method_spec in the query.
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* Add selector_expression indentation ruleTheodor Thornhill2023-06-231-0/+1
| | | | * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): New rule.
* Fix apostrophe handling in rust-ts-mode and go-ts-mode (Bug#63708)Йордан Миладинов2023-06-031-0/+1
| | | | | | | | | | | * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--syntax-propertize): Treat apostrophes as strings if used to define character literals. Treat LT and GT as pairs if used to define type parameters (formerly they were treated as pairs only for type arguments). * lisp/progmodes/go-ts-mode.el (go-ts-mode--syntax-table): Treat apostrophes as strings if used to define rune literals. Copyright-paperwork-exempt: yes
* ; Minor doc cleanups in go-ts-mode.elEli Zaretskii2023-05-041-4/+3
| | | | | | * lisp/progmodes/go-ts-mode.el (go-ts-mode--iota-query-supported-p) (go-ts-mode--other-type-node-p, go-mod-ts-mode--in-directive-p): Doc fixes.
* go-ts-mode: Use iota query only if supported (Bug#63086)Randy Taylor2023-05-041-1/+9
| | | | | | | | | | | iota query support was added on January 5, 2022. To support older versions of the tree-sitter-go grammar (like the latest tagged version, v0.19.1, which was released on March 3, 2021), check if the query is supported before trying to use it. * lisp/progmodes/go-ts-mode.el (go-ts-mode--iota-query-supported-p): New function. (go-ts-mode--font-lock-settings): Use it.
* Update ts modes missed in 4c16fd3a512 to use column-0Dmitry Gutov2023-03-041-1/+1
| | | | | | * lisp/progmodes/ruby-ts-mode.el (ruby-ts--indent-rules): * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Change point-min anchor to column-0.
* Fix go-ts-mode multi-line string indentation (bug#61923)Yuan Fu2023-03-041-1/+2
| | | | | * lisp/progmodes/go-ts-mode.el: (go-ts-mode--indent-rules): Add indent rule for multi-line sting.
* Revert previous change in go-ts-mode.elYuan Fu2023-03-031-1/+1
| | | | | | | | | Reverts 59365f928565f1be551b1697b9246b00cb87a9b7 and 56cd810b9d1a4d537bee5a2fd954d6e0d346631a. Reverting because the use of treesit-ready-p is very much intentional. * lisp/progmodes/go-ts-mode.el (treesit-ready-p): Revert change.
* * lisp/progmodes/go-ts-mode.el: Use treesit-language-available-p.Yuan Fu2023-03-011-1/+1
| | | | treesit-ready-p does more checks than language grammar availability.
* Don’t signal warning when loading go-ts-mode.el without grammarYuan Fu2023-03-011-1/+1
| | | | | | * lisp/progmodes/go-ts-mode.el: Add a QUIET flag to the call of treesit-ready-p, so that it doesn't signal a warning if go-mod (tree-sitter grammar) is not available.
* Rename the newly added -ref- faces to -use-Dmitry Gutov2023-02-281-3/+3
| | | | | | * lisp/font-lock.el (font-lock-variable-use-face) (font-lock-property-use-face): Rename from font-lock-variable-ref-face and font-lock-property-ref-face. Update all references (bug#61655).
* Add more/finer faces for tree-sitterDmitry Gutov2023-02-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/modes.texi (Faces for Font Lock): Update the list of faces (bug#61655). * etc/NEWS: Update the list of new faces. * lisp/cus-theme.el (custom-theme--listed-faces): Update. * lisp/font-lock.el (font-lock-function-call-face) (font-lock-variable-ref-face, font-lock-property-ref-face): New faces. (font-lock-property-name-face): Rename from 'font-lock-property-face'. * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Use new faces. More 'enumerator' query to 'definition' feature. (c-ts-mode--fontify-declarator, c-ts-mode--fontify-variable): Use new faces. * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/js.el (js--treesit-fontify-assignment-lhs) (js--treesit-font-lock-settings): Use new faces. Highlight variable definitions inside array and object destructuring patterns. * lisp/progmodes/python.el (python--treesit-variable-p): Exclude identifiers in parameters. (python--treesit-settings): Use new faces. Highlight function parameters. Move 'keyword' up to still highlight 'self' as keyword. * lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings): Use new faces. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): Use new faces. * lisp/textmodes/css-mode.el (css--treesit-settings): Use font-lock-property-ref-face. * lisp/textmodes/toml-ts-mode.el (toml-ts-mode--font-lock-settings): Use font-lock-property-ref-face. * lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode--font-lock-settings): Same.
* go-ts-mode: Highlight variable declarationsDmitry Gutov2023-02-061-1/+7
| | | | | * lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings): Highlight variable declarations in 'definition' feature.
* go-ts-mode: Fix highlighting of function name in call_expressionDmitry Gutov2023-02-061-6/+5
| | | | | | * lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings): Remove :override from the 'property' rules and move them above 'variable' (bug#61302). Just like in rust-ts-mode.
* ; go-ts-mode--indent-rules: Indent to 0 at top levelDmitry Gutov2023-02-051-0/+1
|
* Make highlighting more regular across TS modes (bug#61205)Dmitry Gutov2023-02-051-9/+17
| | | | | | | | | | | | | | | | | | | | | * doc/emacs/display.texi (Parser-based Font Lock): Update description of treesit-font-lock-level, moving 'property' to level 4. * lisp/treesit.el (treesit-font-lock-level): Likewise, in docstring. * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Do that here. * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): Add a comment. * lisp/progmodes/go-ts-mode.el (go-ts-mode): Add 'definition' to level 1. Move 'function', 'property' and 'variable' to level 4. (go-ts-mode--font-lock-settings): Move a bunch of existing rules to 'definition'. Add highlighting of function parameters. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode) (rust-ts-mode--font-lock-settings): Same. And also change "scoped identifiers" highlights to only match capitalized names.
* Fix switch statement indentation for go-ts-mode (bug#61238)Davide Masserut2023-02-041-0/+4
| | | | | | | | | | * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add indentation for type switch and select case blocks * test/lisp/progmodes/go-ts-mode-resources/indent.erts: New .erts file to test indentation of Go constructs and prevent regression of bug fixes. * test/lisp/progmodes/go-ts-mode-tests.el: New file with go-ts-mode tests.
* Fix go-ts-mode indentation and set indent offset to 8 (Bug#61006)Randy Taylor2023-01-261-1/+3
| | | | | | | * lisp/progmodes/go-ts-mode.el (go-ts-mode-indent-offset): Change default value to 8. (go-ts-mode--indent-rules): Add indentation for parameters and interfaces.
* Make tree-sitter based modes optionalEli Zaretskii2023-01-201-6/+6
| | | | | | | | | | | | | | | | | | | | | * 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)
* Improve go-ts-mode Imenu, navigation and electric pair (bug#60407)Evgeni Kolev2023-01-081-40/+67
| | | | | | | | | | | | | | | | | | | The Imenu items are extended to support "Method", "Struct", "Interface", "Alias" and "Type". go-ts-mode is updated to use the Imenu facility added in commit b39dc7ab27a696a8607ab859aeff3c71509231f5. Variable electric-indent-chars is set in order to improve integration with Electric Pair mode. * lisp/progmodes/go-ts-mode.el (go-ts-mode--imenu-1) (go-ts-mode--imenu): Remove functions. (go-ts-mode--defun-name, go-ts-mode--interface-node-p) (go-ts-mode--struct-node-p, go-ts-mode--other-type-node-p) (go-ts-mode--alias-node-p): New functions. (go-ts-mode): Improve Imenu settings, navigation, add Electric Pair mode settings.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* Add go-ts-mode and go-mod-ts-mode (Bug#60025)Randy Taylor2022-12-151-0/+354
* admin/notes/tree-sitter/build-module/batch.sh: * admin/notes/tree-sitter/build-module/build.sh: Add go-mod support. * etc/NEWS: Mention them. * lisp/progmodes/eglot.el (eglot-server-programs): Add them. * lisp/progmodes/go-ts-mode.el: New major modes with tree-sitter support.