> Actually I didn't mean where the code is using it, but rather what are the 
> user-visible symptoms of the code not doing it correctly :)

Well, those functions above aren't where the code is using `GEANY_WORDCHARS`, 
but rather "where the code is using it incorrectly". So the user-visible 
symptoms follow from these. Now to test all the situations we would need a 
ctags parser supporting all the features and some extra identifier character 
such as `$`, `-`, etc. I've been lazy to search for such a parser and simulated 
this on C by removing `_` from `GEANY_WORDCHARS` and considering this the 
"missing identifier character" (such as `$` or `-` for other languages):

`editor_start_auto_complete()` - check the screenshot below - the word boundary 
isn't determined correctly and offers autocompletion only for the sequence 
following the last `_`. I'm pretty sure you'll run into the same thing with 
Verilog which allows `$` inside identifiers.
<img width="440" alt="Screenshot 2024-11-17 at 22 57 38" 
src="https://github.com/user-attachments/assets/6b3c8073-88c4-432b-851b-967f0c34d440";>

`autocomplete_scope()` - scope autocompletion works for variables without `_` 
but not for variables with `_`.
<img width="458" alt="Screenshot 2024-11-17 at 22 59 28" 
src="https://github.com/user-attachments/assets/8e62aede-fe30-4242-a588-8c8c48b6d6ba";>

`editor_show_calltip()` - no calltip for functions containing `_` because of 
incorrect word boundaries
<img width="621" alt="Screenshot 2024-11-17 at 23 00 26" 
src="https://github.com/user-attachments/assets/b2b8a92e-d533-4949-bc51-b285de1b2207";>

`symbols_goto_tag()` - again, because of incorrect word boundaries the goto 
attempt is made for an incorrect word. For a Verilog example see 
https://github.com/geany/geany/pull/4037#discussion_r1845239877
<img width="303" alt="Screenshot 2024-11-17 at 22 56 12" 
src="https://github.com/user-attachments/assets/fbd6fdf0-da35-46e9-bf81-f22b1da883dc";>

`editor_get_word_at_pos()` - I have no example but clearly this function 
propagates this error to plugins using it.

In any case, `read_current_word()` is the source of all these problems and if 
it were modified to use `wordchars`, users could modify this behavior for the 
specific needs of the languages they use (or better, we'd provide the right 
`wordchars` in the default configuration). We could avoid the hacks in 
`editor_start_auto_complete()` which handles CSS and Latex but nothing else. We 
could also make sure that `wordchars` contains at least `GEANY_WORDCHARS` to 
harden against bad user configurations.

One good thing I was wrong about is unicode characters - those `!IS_ASCII()` 
checks seem to do the right thing in `read_current_word()` and all the simple 
unicode cases with Czech I tried worked fine for me.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/4038#issuecomment-2481635007
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/issues/4038/[email protected]>

Reply via email to