> Did you identify the specific issues?

Yes, I noticed that when implementing the LSP plugin, see below.

> I agree it's sometimes an issue and I believe I've suffered from 
it with e.g. CSS, bit also that unconditionally using the filetype value 
everywhere might cause other issues -- or maybe it wouldn't?

I think we should make sure that user-specified `wordchars` always contain all 
characters from `GEANY_WORDCHARS` no matter what crazy thing the users define. 
Apart from that it should be fine IMO _except_ one thing - some languages allow 
unicode characters to be part of identifiers too and we should possibly allow 
them as well.

> Anyway, identifying the actual problems that this causes would.be great :)

What's below are only the problematic cases - I'm skipping those that 
seem to be OK. The biggest offender is `read_current_word()` from which it 
propagates to other functions.

**1st level** - direct usage of `GEANY_WORDCHARS`:
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L1691
- with NULL `wc` argument, it uses `GEANY_WORDCHARS`.

**2nd level** - usage of `read_current_word()`:
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L1743
- uses `GEANY_WORDCHARS` when wc == NULL

https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L1793-L1794
- propagates the problem to plugins which, when `wordchars` isn't 
specified, uses `GEANY_WORDCHARS`. Note that plugins don't have access to 
`wordchars` from filetype config file and have to hard-code something for every 
language or add some configuration (see 
https://github.com/techee/geany-lsp/blob/3a31ec9be8323c668299d1c292b7c401f2e9427b/lsp/data/lsp.conf#L72
 in geany-lsp)

https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L2222
- uses `GEANY_WORDCHARS` for everything except CSS and Latex and breaks 
autocompletion of unicode identifiers

**3rd level** - usage of `editor_get_word_at_pos()`:
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L703
- may break scope autocompletion

**3rd level** - usage of `editor_find_current_word()`:
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L292
- current word stored (end emitted with signal) with mouse right-click - I 
haven't investigated where exactly this leads

https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L2002
- calltips probably don't work for unicode symbols or symbols containing 
some special characters

https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/symbols.c#L1715
- again, may break symbol goto

https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/keybindings.c#L1666
- I haven't checked in detail what this one might cause

In addition, there's also 
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/editor.c#L1752
I haven't checked the places where this function is used and why it's 
used instead of `editor_find_current_word()` and whether this is correct.

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

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

Reply via email to