New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clangd] [C++20] [Modules] Code Intelligence is broken for named modules #58723
Comments
@llvm/issue-subscribers-clang-modules |
Please see clangd/clangd#1293 |
There are some slight differences. Modules has a lot of meanings. And this issue mainly cares about the named modules. So this issue should be a subset of issue of clangd1293 |
BTW, there is an another thing confusing me. Where do we (the clangd developers) report issues? In the llvm issues or in the clangd issues you give? |
I agree.
The clangd issue tracker pre-dates the entire LLVM project moving off of Bugzilla, and tends to be where most users report issues. |
Got it. Thanks. I am looking for to support named modules in clangd for clang. |
@HighCommander4 Hi, may I ask how can I add a test case from in clangd? From my explanation, the clangd can support the following case (although badly):
And we need to compile the small project manually by (the implicit build strategy needs more discussion and which is longer to be land):
Then in main.cpp, when I type
In modules, macros can't be found by the importee and the importee can only see the exported names. And I am looking for how to support it in clangd. And I want to sent this example as a test case to clangd to make sure that we can still see the exported names (good) to prevent any accidental changes. And here is my question. I looked at the examples in clangd, but it is far different from those in clang, which is simply sources. But the tests of clangd is full of json and I don't know where can I start. (If it is pretty simple to you, it'll be much appreciated if you commit it directly and I can learn from your example) Thanks |
@ChuanqiXu9 I actually can't reproduce your issue locally. When I set up a workspace with the files you describe, and I perform completion after In your screenshot, |
Hi,
I want to test the normal And if I click on the It surprises me it would add My clang and clangd is trunk 674a17e But after all, it looks good to me that you can reproduce the result that we can see |
Oh, I found where the The following macros are defined:
If we relates this to the suggestion for |
You're right. Clangd trunk has an "index the standard library" feature, where it indexes the standard library headers in the background even if no files in your project include them yet, so that standard library symbols can be offered as completion proposals right from the start. (I was testing with a slightly older trunk which did not have this feature enabled yet, that's why I wasn't seeing those completion proposals.) |
So, if it is possible to add this example to the in-tree tests? (the
to create the temporary working directory but I don't know the similar things in unittests. |
@ChuanqiXu9 Here is an example of a multi-file code completion test for clangd, where the additional file is a header. I haven't thought through how this might work with modules, especially prebuilt ones. Possibly the test infrastructure needs some changes to make that work. |
No, we can't do that. And we have consensus that the implicit build is bad so it won't come in the future too.
Agreed. I'll try to look at it. And it would be sufficient to me if we can create temporary directories in unit tests. I'll try to look at more examples and docs. @dwblaikie , hi, do you know how to create temporary directories in unit tests. (I CC you since I feel like you are familiar with the unittests. Or do you know who is the right person to ask this question?) |
Oh, I finally found the methods to add test in clangd in the traditional clang style. I sent https://reviews.llvm.org/D137693. And while the method to create temporary directory is still very meaningful, I might not pursue it recently. I feel such tests may be sufficient. And I want to close the issue after I sent a basic document in https://clang.llvm.org/docs/StandardCPlusPlusModules.html to tell people how to use clangd to do code completion. I know there are many bugs and problems still:
But after all, it would be good direction to me. |
Closed for the sake of @sam-mccall mentioned in https://reviews.llvm.org/D137770. We do need better design for this. And let's track it by a new issue when we had a good plan. |
Currently, when we write codes in named modules, we can't get help from code intelligence, which is bad. We need try to support code intelligence for named modules.
The text was updated successfully, but these errors were encountered: