A very odd problem. In VS Code I have 2 .css files one with just a :root{}
section that has 3 custom properties in it. In the other file I have a reference to 2 elements with the background-color
set. When I comment one element out, I can see all 3 of the custom properties in the list of suggestions, but as soon as I uncomment the 2nd element I can only see 1 property in the list of suggestions. code below… it seems to be related to using the var()
function … rather than to the elements. If I only have 1 element, say the #header
, then add a second line, say color: var(--???);
I get the same behavior. I have rebooted, restarted, made a new project, etc. There are no extensions running and only one that is installed is LiveServer (but disabled). Version info …
Version: 1.90.0 (user setup)
Commit: 89de5a8d4d6205e5b11647eb6a74844ca23d2573
Date: 2024-06-04T19:33:54.889Z
Electron: 29.4.0
ElectronBuildId: 9593362
app-basics.css:
:root {
--color-0: red;
--color-1: green;
--color-2: blue;
}
header-footer.css:
#header {
background-color: var(--color-1);
}
/* #dummy {
background-color: var(--color-1);
} */
Adding a second element like #dummy
should have no effect on the custom properties that I can see. I have tried rebooting, restarting, making a new project, renaming the custom properties, re-ordering the properties, checking spelling and syntax. VS code shows no errors or problems with the files. I am stumped on this one.