Commit graph

23 commits

Author SHA1 Message Date
Yuan Fu
52746ceb62
Remove duplicate indent rules in elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): There are
two forms adding heex-ts--indent-rules, remove one of them.
2024-10-07 17:27:13 -07:00
Yuan Fu
3cad7cc8dc
Set treesit-primary-parser for c and elixir ts mode
For buffers with multiple parsers, it's important to set this variable
so font-lock invalidation works smoothly.

* lisp/progmodes/c-ts-mode.el (c-ts-mode): Set treesit-primary-parser.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): Set
treesit-primary-parser.
2024-09-14 00:46:05 -07:00
Yuan Fu
0fd259d166
Fix elixir-ts-mode's range query
* lisp/progmodes/elixir-ts-mode.el:
(elixir-ts--treesit-range-rules): Add underscore in front of the name
capture, so Emacs won't put heex parser on it.
2024-09-08 20:52:20 -07:00
Stefan Monnier
c79a509384 Add non-TS modes as extra parent of TS modes (bug#68246)
Record the fact that TS modes are alternatives to the non-TS
modes using the new `derived-mode-add-parents` functionality.
Do the same for long standing similar issues with CPerl-mode.

* lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode):
* lisp/textmodes/toml-ts-mode.el (toml-ts-mode):
* lisp/textmodes/html-ts-mode.el (html-ts-mode):
* lisp/textmodes/css-mode.el (css-ts-mode):
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode, tsx-ts-mode):
* lisp/progmodes/sh-script.el (bash-ts-mode):
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
* lisp/progmodes/python.el (python-ts-mode):
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode):
* lisp/progmodes/json-ts-mode.el (json-ts-mode):
* lisp/progmodes/js.el (js-ts-mode):
* lisp/progmodes/java-ts-mode.el (java-ts-mode):
* lisp/progmodes/heex-ts-mode.el (heex-ts-mode):
* lisp/progmodes/go-ts-mode.el (go-ts-mode, go-mod-ts-mode):
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode):
* lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode):
* lisp/progmodes/csharp-mode.el (csharp-ts-mode):
* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode):
* lisp/progmodes/c-ts-mode.el (c-ts-mode, c++-ts-mode):
Add non-TS mode as extra parent.

* lisp/progmodes/cperl-mode.el (cperl-mode): Add `perl-mode` as
extra parent.
2024-03-09 10:29:06 -05:00
Wilhelm Kirschbaum
8a39216ce9 elixir-ts-mode: Highlight more method definitions
* lisp/progmodes/elixir-ts-mode.el (elixir-ts--font-lock-settings):
Also highlight method definitions where the arguments are literal
values, not identifiers (bug#67246).
2024-02-07 04:18:54 +02:00
Dmitry Gutov
eb90fb52b0 elixir-ts-mode: Bring the faces' use closer to other ts modes
* lisp/progmodes/elixir-ts-mode.el (elixir-ts--font-lock-settings):
Rename feature 'elixir-function-name' to 'elixir-definition' and
update all deferences.  Add parameters' highlighting with
font-lock-variable-name-face.  Change variable references'
highlighting to use font-lock-variable-use-face.
Move the feature 'elixir-variable' from feature level 3 to level 4, to
match other ts modes (bug#67246).
2024-02-07 04:18:54 +02:00
Wilhelm Kirschbaum
c1cdbb9872 Add access_call fontification to elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--font-lock-settings):
Add access_call queries to the elixir-variable feature (bug#67246).
2024-02-07 04:18:54 +02:00
Po Lu
070cb32463 ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
Wilhelm H Kirschbaum
463cd87f05 Various improvements to font-lock-settings for elixir-ts-mode
Changes and made from conversations from the Elixir slack channel,
the github issue
https://github.com/wkirschbaum/elixir-ts-mode/issues/35 and bug#67246.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--font-lock-settings): Update features.
(elixir-ts-mode): Update treesit-font-lock-feature-list.
(elixir-ts-font-comment-doc-identifier-face): Rename to
elixir-ts-comment-doc-identifier.
(elixir-ts-font-comment-doc-attribute-face): Rename to
elixir-ts-comment-doc-attribute.
(elixir-ts-font-sigil-name-face): Rename to elixir-ts-sigil-name.
(elixir-ts-atom-key-face)
(elixir-ts-keyword-key-face)
(elixir-ts-attribute-face): Add new custom face.
2023-11-29 05:14:59 +02:00
Eli Zaretskii
d5799ce666 ; Add commentary for exposing a mode hook to Custom
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode-hook): Add
commentary about the reasons for exposing the hook to Custom, per
the discussion in bug#67207.
2023-11-18 12:02:25 +02:00
Wilhelm H Kirschbaum
09de967f6c Add elixir-ts-mode-hook to elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode-hook):
Make hook available to customize.  (Bug#67207)
2023-11-18 11:57:08 +02:00
Wilhelm H Kirschbaum
2c72eecbaa Simplify sigil font-lock match for elixir-ts-mode
There is no need to match on specific sigils, except for regex.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--font-lock-settings): Update sigil match (bug#64275).
2023-10-26 03:26:23 +03:00
Eli Zaretskii
e6dd64aaba ; * lisp/progmodes/elixir-ts-mode.el (treesit-node-p): Declare. 2023-09-30 20:39:09 +03:00
Wilhelm H Kirschbaum
1f850d8d7b
Fix treesit-langauge-at-point for elixir-ts-mode.
The treesit-language-at-point function is only suppose to query the
host language.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--indent-rules): Add missing rules.
(elixir-ts--treesit-language-at-point): Update function to only query
the host language.
* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts: Add test
for inline docs.
2023-09-26 23:23:54 -07:00
Wilhelm H Kirschbaum
e03cfec0a4 Improve call indentation for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--indent-rules): Change match order.
(Bug#63110)

* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test case.
2023-04-29 12:16:56 +03:00
Wilhelm H Kirschbaum
e0e93f7eec Add bitstring indentation and navigation for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--sexp-regexp): Add bistring.
(elixir-ts--indent-rules): Handle bitstring indentation.
(Bug#63109)

* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test case.
2023-04-29 12:13:47 +03:00
Wilhelm H Kirschbaum
0563dbf95d Handle electric heredocs pairs in elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--electric-pair-string-delimiter): New helper.
(elixir-ts-mode): Add post-self-insert-hook.  (Bug#62536)
2023-04-06 13:05:39 +03:00
Wilhelm H Kirschbaum
c6bbc20c38 Propertize heredocs in elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--syntax-propertize-query): New variable.
(elixir-ts--syntax-propertize): New helper.
(elixir-ts-mode): Set syntax-propertize-function.  (Bug#62536)
2023-04-06 13:04:54 +03:00
Wilhelm H Kirschbaum
8678708ad1
Improve sigil fontification for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el:
(elixir-ts--font-lock-settings): Update sigil queries.
2023-04-04 23:01:21 -07:00
Wilhelm H Kirschbaum
eb0a9e4633
Improve list indentation for elixir-ts-mode
* lisp/progmodes/elixir-ts-mode.el:
(elixir-ts--argument-indent-offset): Add empty line check.
(elixir-ts--argument-indent-anchor): Change ERROR offset.
* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts:
Add test.
2023-04-04 23:01:21 -07:00
Wilhelm H Kirschbaum
997a8dbc48 Fix elixir-ts-mode.elc warning (bug#62155)
* lisp/progmodes/elixir-ts-mode.el: Only require heex-ts-mode once
elixir-ts-mode loads to avoid calling (treesit-ready-p 'heex)
during byte-compilation.
2023-03-16 09:52:39 +02:00
Mattias Engdegård
67a660eb13 ; * lisp/progmodes/elixir-ts-mode.el: remove duplicates from regexp 2023-03-15 12:43:18 +01:00
Wilhelm H Kirschbaum
d965d03087 Add elixir-ts-mode (Bug#61996)
* etc/NEWS: Mention the new mode.
* lisp/progmodes/elixir-ts-mode.el: New file.
* test/lisp/progmodes/elixir-ts-mode-tests.el: New file.
* test/lisp/progmodes/elixir-ts-mode-resources/indent.erts: New file.
* admin/notes/tree-sitter/build-module/batch.sh:
* admin/notes/tree-sitter/build-module/build.sh: Add Elixir support.
* lisp/progmodes/eglot.el (eglot-server-programs): Add elixir-ts-mode.
2023-03-12 17:41:44 +02:00