Skip to content
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

Intellisense not listing files when plugin active #222

Open
markmaker opened this issue Mar 26, 2024 · 8 comments
Open

Intellisense not listing files when plugin active #222

markmaker opened this issue Mar 26, 2024 · 8 comments

Comments

@markmaker
Copy link

markmaker commented Mar 26, 2024

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.

@tristan957
Copy link
Contributor

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.

@markmaker
Copy link
Author

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:

Side Bar

The build comands work:

Meson: build

But IntelliSense is broken, as described above. When I enable the Meson plugin, I get this "Configuration Provider" set in Extensions > C/C++ > IntelliSense:

Configuration Provider

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.

@tristan957
Copy link
Contributor

tristan957 commented Mar 27, 2024

What does "intellisense not listing files" mean?

@markmaker
Copy link
Author

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".

@tristan957
Copy link
Contributor

tristan957 commented Mar 27, 2024

How do you know it isn't used?

@markmaker
Copy link
Author

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.

@tristan957
Copy link
Contributor

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?

@markmaker
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants