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

[Bug] Find ways to fix duplication in local css source files #83

Open
phoenisx opened this issue Oct 21, 2022 · 3 comments
Open

[Bug] Find ways to fix duplication in local css source files #83

phoenisx opened this issue Oct 21, 2022 · 3 comments
Assignees
Labels
breaking-change bug Something isn't working

Comments

@phoenisx
Copy link
Contributor

VSCode has started to push CSS Variables into the auto-complete list, when the variables are defined in the same file that a user is working on.

This causes unnecessary duplicates as mentioned here: #66 (comment)

This bug is opened to find if there's any possible way to fix this issue.
I feel there's one way to fix this: do not populate the auto-complete list (with variables from a source file which is what the user is currently working on as well. (This applies to only CSS and similar files)

Just a thought, need to test this, and figure out if this is functional and fixes the issue or not.

@phoenisx phoenisx added the bug Something isn't working label Oct 21, 2022
@phoenisx phoenisx self-assigned this Oct 21, 2022
@Farnsi
Copy link

Farnsi commented Apr 3, 2023

It would be ok, if it removes the duplicates from folders above.

I think it is not so easy to detect which one has precedence in the same folder, cause it does not know which file is included first.

@phoenisx
Copy link
Contributor Author

phoenisx commented Apr 4, 2023

Yeah, precedence of variables is a challenge. We can keep a context of where the variables were created, but I still feel it wouldn't solve our problem, cause variables can be defined anywhere, and could also be nested.

if it removes the duplicates from folders above.

I couldn't understand this statement. Which folders are you talking about?

@Farnsi
Copy link

Farnsi commented Apr 4, 2023

I couldn't understand this statement. Which folders are you talking about?

Example

index.css      ; with variable --var1: red
|- somedir
   |- some.css ; with variable --var1: blue

If you work in some.css and use --var it shows --var1 twice, one with red, one with blue

But this is not wrong, cause CSSVar did not know if some.css is included before index.css.

"Static Solution" with an option eliminate-precedence: it should eleminate --var1 from the file above (if we not work in that folder, depending on current file).

A better non static solution: integrate a callback (include a js method from e.g. .vscode/cssvar.cjs), so that we can set our own custom sort order and priority for included files.
This function needs as parameters a list of all vars und associated filenames and the current working file.
It should return a list with vars & values, that could be used in the current file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants