ChuanqiXu9 / clangd-for-modules

A preview for C++20 Named Modules Support in clangd.
Other
18 stars 1 forks source link

Does autocomplete work for imported modules? #9

Open graydotnet opened 3 weeks ago

graydotnet commented 3 weeks ago

Does autocomplete work for imported modules?

ChuanqiXu9 commented 3 weeks ago

What do you mean?

graydotnet commented 2 weeks ago

Autocomplete does not seem to work with clangd in vscode. When I have a module and import it in another source file, the symbols from the imported module aren't exposed in autocomplete.

ChuanqiXu9 commented 2 weeks ago

Autocomplete does not seem to work with clangd in vscode. When I have a module and import it in another source file, the symbols from the imported module aren't exposed in autocomplete.

This is not expected. Even if the upstreaming clangd, you can enable it by --experimental-modules-support. And the clangd in this repo enable this option by default.

graydotnet commented 2 weeks ago

I am using LLVM 19.1.0-rc3.

Here is a repo: https://gist.github.com/graydotnet/0882f40fc5848b7cfc66f7ff1392a5c1

If you start typing "he" in the function try_autocomplete_here, it does not autocomplete the namespace "hello". Similar if you have "hello::s", "hello::say" is not autocompleted.

ps -x | grep clangd
1023232 ?        Sl     0:02 /usr/bin/clangd --experimental-modules-support
❯ clang --version
clang version 19.1.0-rc3 (https://github.com/llvm/llvm-project.git 437434df21d839becb453f6821564662e9824f02)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/trevor/Code/llvm-project/build/bin
❯ clangd --version
clangd version 19.1.0-rc3 (https://github.com/llvm/llvm-project.git 437434df21d839becb453f6821564662e9824f02)
Features: linux
Platform: x86_64-unknown-linux-gnu
ChuanqiXu9 commented 2 weeks ago

Yeah, it looks like it is true that autocompletion doesn't work well.

It can only work basically to show the signature but not the autocompletion. image

ChuanqiXu9 commented 2 weeks ago

Given this repo is majorly for speeding up, I think we can raise the issue in clangd's bug tracker: https://github.com/clangd/clangd/issues