[VS Code] [vscode-cpptools plugin] Intellisense - Dim Inactive Regions: Where does vscode-cpptools get the values for variables used in "#IF" e.g. "GTK_CHECK_VERSION"?

Christian Lohmaier lohmaier at googlemail.com
Mon Dec 13 10:31:58 UTC 2021


Hi *,

On Sat, Dec 11, 2021 at 3:41 PM Christian Ohrfandl
<christian.ohrfandl at gmail.com> wrote:
>
> Hi
> tl;dr see the discussion I created here
> https://github.com/microsoft/vscode-cpptools/discussions/8523.

disclaimer: didn't read that yet :-)

> […]
> So where does the vscode-cpptools know the GTK version from and
> therefore is able to judge `GTK_CHECK_VERSION(4,0,0)`?

All "magic" comes from the compile_commands.json file that is
generated by the "make vim-ide-integration" command.
That file contains the invocation from which intellisense gets the
defines and header include paths.
So when not using that file intellisense will fall flat and struggle
to find headers, etc.

Now why it picks up a wrong version: no idea, would have to look at
the specific file and what the commandline is for the file.

> I also looked into my project's `.vscode` folder into the
> `c_cpp_properties.json` file and added the GTK4 library install dir
> `"/usr/local/include/gtk-4.0"` as follows:
> ```
> {
>      "configurations": [
>          {
>              "name": "Linux",
>              "includePath": [
>                  "${default}",
>                  "/usr/local/include/gtk-4.0",
>                  "/usr/include/gtk-3.0",
>                  "/usr/include/glib-2.0",
>                  "/usr/lib/x86_64-linux-gnu/glib-2.0/include",
>                  "/usr/include/pango-1.0"
>              ],
>              "defines": [],
>              "cStandard": "c17",
>              "intelliSenseMode": "linux-clang-x64"
>          }
>      ],
>      "version": 4
> }

So it seems you're not using the sample workspace file with the
compile-commands.json it seems. Or if you do: the include paths are
only the fallback in case there is no entry in the
compile_commands.json file, i.e. for externals that are built as part
of a LO compile.

> […]
> "So why not turn off the feature "Dim inactive regions"?", I thought.
> Well, this makes the code undimmed (yay) BUT IntelliSense STILL does not
> work (nay), which is a major problem for me.

Cannot really help with that.

> Can you help me out or is it a bug that IntelliSense does not work EVEN
> if the "dim inactive regions" option is disabled?

Define "does not work" - does code completion hints for the objects
not work? then it is a bug in the vscode cpp plugin/nothing LO's
integration can help with...

ciao
Christian


More information about the LibreOffice mailing list