Bug 473425 - LSP doesn't detect methods used in SIGNAL()/SLOT() macros when searching for references
Summary: LSP doesn't detect methods used in SIGNAL()/SLOT() macros when searching for ...
Status: RESOLVED NOT A BUG
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: Git
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-15 16:33 UTC by Ahmad Samir
Modified: 2023-08-18 18:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Samir 2023-08-15 16:33:02 UTC
When using "find references" with a method marked as a Qt signal, instances that are wrapped in the SIGNAL() macro in a QObject::connect() call aren't detected.

It looks like Qt Creator special-cases SIGNAL/SLOT macros to find those references, see:
https://codereview.qt-project.org/c/qt-creator/qt-creator/+/227189

(I am not familiar enough with the LSP plugin code in Kate, otherwise I would have tried to create a patch).
Comment 1 Christoph Cullmann 2023-08-17 16:59:26 UTC
As LSP works via clangd, I don't see that we can do that, if one wants that, this would need to be handled in clangd.
Kate doesn't have a direct clang backend, and I think it should stay that way given the amount of manpower that would need.
Comment 2 Ahmad Samir 2023-08-18 16:15:47 UTC
I see; I thought since Qt Creator has switched to clangd (instead of libclang backend) that this works with clangd too; perhaps they have another way of listing references to methods wrapped in SIGNAL/SLOT.

Sorry for the noise.
Comment 3 Waqar Ahmed 2023-08-18 17:52:00 UTC
clangd provides AST in an xml like format which you can use to get more info about the current file and maybe do some extra operations on it. Maybe that's how qtcreator is able to achieve this. But afair, qtcreator has a third cplusplus backend based on a small c++ parser so maybe it's using that.

For the issue itself, I generally use search plugin and it works nicely for finding refs even in SIGNAL()/SLOT() macros or QMetaObject::invokeMethod("stringMethod") stuff.
Comment 4 Ahmad Samir 2023-08-18 18:00:38 UTC
(In reply to Waqar Ahmed from comment #3)
> clangd provides AST in an xml like format which you can use to get more info
> about the current file and maybe do some extra operations on it. Maybe
> that's how qtcreator is able to achieve this. But afair, qtcreator has a
> third cplusplus backend based on a small c++ parser so maybe it's using that.
> 
> For the issue itself, I generally use search plugin and it works nicely for
> finding refs even in SIGNAL()/SLOT() macros or
> QMetaObject::invokeMethod("stringMethod") stuff.

Yeah, same here I use the search plugin; but sometimes while refactoring code I might forget, or the code supports multiple platforms with the help of #ifdefS, so I want to only see the parts relevant to Linux ...etc.
Comment 5 Christoph Cullmann 2023-08-18 18:19:14 UTC
I think in the patch below one sees that the handling is in there libclang based backend

https://codereview.qt-project.org/c/qt-creator/qt-creator/+/227189