|
From: | Wilhelm Kirschbaum |
Subject: | bug#66183: elixir-ts-mode test failure |
Date: | Tue, 26 Sep 2023 18:30:37 +0200 |
User-agent: | mu4e 1.9.3; emacs 30.0.50 |
Yuan Fu <casouri@gmail.com> writes:
On Sep 24, 2023, at 9:53 AM, john muhl via Bug reports for GNUEmacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org>wrote:The change in 5cba5ee8905 caused an elixir test to start failing. The white space at the start of the test is now in a heex range so pressing tab there matches a heex rule instead of the elixir one. Moving thedummy range to the end fixes the test.Thank you. I’ll make sure to remember also running elixir tests when I make a change.I looked around and found elixir-mode’s language-at-point functionworks in a way that isn’t what tree-sitter functionsexpect. Tree-sitter functions expect the major mode to derive language at point by querying the host language and do some pattern matching, rather than using language parser’s range. I took a quick look at elixir’s grammar and came up with this version for a POC. You probably
Sorry about that. I had absolutely no idea how it was expected to work.
need to adjust it but the idea is there.With the new language-at-point definition, treesit-language-at canreturn the correct language, and the test passes again. Yuan [2. text/x-patch; example.diff]...
This seems to work if you set named on: treesit-node-prev-sibling, otherwise it just tries to match the \"\"\" against H or F. (let* ((node (treesit-node-at point 'elixir))) (if (and (equal (treesit-node-type node) "quoted_content") (string-match-p (rx bos (or "H" "F") eos)- (treesit-node-text (treesit-node-prev-sibling node)))) + (treesit-node-text (treesit-node-prev-sibling node t))))
'heex 'elixir)))I will spend some time in the next couple of hours to catch up to all
the changes. Wilhelm
[Prev in Thread] | Current Thread | [Next in Thread] |