Subject: Re: bug#60256: 29.0.60; Maybe improve tree sitter default treesit-language-at function

From: Yuan Fu <[email-masked]>
Date: Sat, 24 Dec 2022 14:43:18 -0800

Eli Zaretskii <[email-masked]> writes:

>> From: Wilhelm H Kirschbaum <[email-masked]>
>> Date: Thu, 22 Dec 2022 12:30:09 +0200
>> 
>> 
>> We can detect the language from treesit-parser-included-ranges, so
>> instead of taking the first parser from the list what about taking 
>> the first parser within known ranges?
>
> Yuan, any comments?

Yeah, sorry for the delay. I don’t think it’s worth it, because (1) I
expect major modes with multiple langauges to implement
treesit-language-at-point-function which takes care of all the work, and
(2) in the rare case where there are multiple languages and no
treesit-language-at-point-function, using the first language whose range
spans point (this patch) is not necessarily correct: the host language (eg, HTML
among HTML, CSS & JavaScript) always covers the whole buffer, only
embedded languages has ranges.

Yuan