> OK, [made the changes]
Looks good.
> I don't quite understand the use of tm_tag_local_var_t. I was thinking that
> perhaps it was only hidden on the sidebar but still accessible via
> Ctrl-click, but that doesn't seem to be the case.
This is used for parsers like C/C++ that also parse function bodies and extract
all variables from functions - displaying them in the sidebar is just too
verbose. I don't remember exactly how ctrl+click is implemented for these but
it's possible that it works only within a function. I don't know if there is
something in the verilog parser where tm_tag_local_var_t could be applied.
> Overall, my concern is what's the purpose of the different tags. I think it
> has to do with how they "propagate" to other files and contexts, and that one
> tm_tag_t behaves differently from another.
The only problem I can think of is what we call "scope autocompletion". E.g.
for C something like
```C
typedef struct {
int x;
int y;
} Foo;
int main(void) {
Foo foo;
foo. // <--- here you should get an autocompletion popup with x and y
}
```
I think `.` is hard-coded in the Geany code and the tag manager checks whether
`foo` is of a type that can contain members - see
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/tagmanager/tm_workspace.c#L56-L58
This typically works well for "normal" languages but honestly we kind of ignore
what mess it could produce in other languages ;-).
> For example, if I open a file that declares a certain C typedef, or C++
> class, and use it in another file, it appears highlighted in light blue. I
> suppose this has to do with ctags "exporting" the type to other files.
What we do is that we extract tags that can be types
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/tagmanager/tm_workspace.c#L60-L62
and then inject the names of these types to all the Scintilla editors as fake
keywords so they get colorized.
However, you'd have to enable this behavior for Verilog in
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/document.c#L2702
otherwise no such coloring will happen. The index 3 means that the type goes to
keyword at index 3 which however isn't defined for verilog in
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/src/highlightingmappings.h#L1889-L1895
and would have to be added there. The verilog lexer seems to define more
keyword groups so it should work if you decide to give it a try.
https://github.com/geany/geany/blob/c043996a9a3dc1b0aa36571cd5f5d61fd8d2eb59/scintilla/lexilla/lexers/LexVerilog.cxx#L1076-L1084
So it depends whether you want to enable such a coloring - if not, it shouldn't
happen automatically and you are free to use whatever `tm_tag_...` you wish -
otherwise you have to be more careful.
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4039#issuecomment-2469267798
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/pull/4039/[email protected]>