Subject: bug#77746: [PATCH] sh-mode: Fix incorrect word syntax for punctuation in sh-mode

From: James Cherti <[email-masked]>
Date: Tue, 15 Apr 2025 15:45:53 -0400

On 2025-04-15 14:25, Eli Zaretskii wrote:
>> Date: Tue, 15 Apr 2025 12:22:08 -0400
>> Cc: [email-masked], [email-masked]
>> From: James Cherti <[email-masked]>
>>
>> On 2025-04-15 11:24, Eli Zaretskii wrote:
>>   >> From: Stefan Monnier <[email-masked]>
>>   >> Cc: James Cherti <[email-masked]>,  [email-masked],
>>   >>    [email-masked]
>>   >> Date: Tue, 15 Apr 2025 11:17:02 -0400
>>   >>
>>   >>>> The issue occurs in both sh-mode and bash-ts-mode.
>>   >>> I'm surprised that bash-ts-mode should use syntax tables, instead of
>>   >>> relying on the results of parsing by tree-sitter.
>>   >>
>>   >> It's not front-and-center in his bug report, but what he means by
>>   >> "completion" seems to be mostly dabbrev completion, which doesn't make
>>   >> use of tree-sitter.
>>   >
>>   > He also mentioned font-lock.
>>
>> Yes, this patch fixes dabbrev, functions such as
>> (highlight-symbol-at-point), and any other function that
>> relies on thing-at-point for symbol detection.
>>
>> (The core issue is inaccurate symbol detection. This patch
>> improves it by excluding characters that should not be
>> considered part of a valid variable name.)
> 
> I'd expect a parser to detect variable names correctly, and without
> the help of our syntax tables and related code.

Hello Eli,

It would be highly convenient if the Tree-sitter parser
could accurately detect variable names (e.g., the symbol at point).
While this would not fix sh-mode, it would at least enable an
improved editing experience when using bash-ts-mode.

--
James Cherti
GitHub: https://github.com/jamescherti
Website: https://www.jamescherti.com/