vscode-meson
vscode-meson copied to clipboard
Intellisense not listing files when plugin active
Description
Intellisense does not seem to list the project C/C++ files correctly, when under control of the meson plugin. It only sees files currently open in the IDE, or #include-d by the open files. "Go to Definition", "Find All References" etc. only work in that limited scope.
As soon as I deactivated the plugin it started to work again.
Our workspace is special in that the meson project is in a subdirectory (actually a git submodule). Maybe that could be the reason. The meson build commands work correctly, and the project is still correctly shown in the tree. But Intellisense is broken.
Sounds pretty special to your environment. A language server is only going to be useful for the files it knows about, those in the compilation database.
Sounds pretty special to your environment.
I don't know how you mean that. I consider it perfectly normal to have the main meson project in a subdirectory, especially since this is a git submodule that covers the C/C++ part of a larger project.
The Meson sidebar discovers the project perfectly:
The build comands work:
But IntelliSense is broken, as described above. When I enable the Meson plugin, I get this "Configuration Provider" set in Extensions > C/C++ > IntelliSense:
Then it no longer works. And I can't change the value, it is always set back to "mesonbuild.mesonbuild".
However, I just found how to disable that. Add this to .vscode/settings.json
"mesonbuild.modifySettings": false,
This seems to make it behave.
Still, this appears to be a bug.
What does "intellisense not listing files" mean?
Somehow IntelliSense needs to know which .cpp
files to scan. I assumed it will use the builddir/compile_commands.json
'file' entries. I set the C_Cpp › Default: Compile Commands correctly, but somehow it is not used by IntelliSense, or at least not to list the files, as long as "Configuration Provider" is set to "mesonbuild.mesonbuild".
How do you know it isn't used?
Like I initially described, "Go to Definition", "Find All References" etc. only work in the limited scope of opened files. As soon as I remove Meson plugin from the equation, either by disabling it, or by "mesonbuild.modifySettings": false
, (and restarting the IDE), IntelliSense starts to scan all files. "Go to Definition", "Find All References" etc. start to work.
I don't understand your project layout. Do you have C/C++ files outside of the submodule that you're trying to use "Go to Definition" or "Find All References" on?
There is a toplevel project, that contains various git submodules. The submodules cover different technologies and/or programming languages. One of them is a C/C++ project with a meson.build file.
-- top
|-- cpp project
| |-- meson.build
| |-- subprojects
| | ` - various
| |-- src
| |-- file1.cpp
| |-- file2.cpp
|-- other stuff
This should be a normal use case.
And like I said: the other functions like building or showing the project tree, work.