Giter Club home page Giter Club logo

Comments (9)

starball5 avatar starball5 commented on July 17, 2024

book-keeping note: https://stackoverflow.com/q/78604916/11107541

from vscode.

aeschli avatar aeschli commented on July 17, 2024

What's happening is that when the code completion is invoked the first time, textual proposals are shown as the CSS language server has no proposals.
Once there's a color name in the file, the CSS language server shows that color. The textual proposals don't show anymore

  • textual proposals uses the contents of all open editors
  • the css extension only uses the current document
  • the textual proposals are considered a 'fallback' is there's no language server providing any results.

from vscode.

starball5 avatar starball5 commented on July 17, 2024

Under what circumstances is this likely to be addressed?

  • Without any @imports?
  • If the variable-using file @imports the variable-declaring file(s)?
  • If some other CSS file @imports them both (or HTML <link>s them both)- the variable-declaring file first?

from vscode.

kemerait avatar kemerait commented on July 17, 2024

aeschli, it doesn't seem to matter what the type of property is...for example if I add a property of --myvalue: 32; and then assign the width: var(--myvalue) and further down try to assign the color: var(--xx); it offers me only --myvalue (an integer) and not one of the color properties. Does this fit within the same explenation?

from vscode.

aeschli avatar aeschli commented on July 17, 2024

Yes, the css extension doesn't know what type the variable is. It just proposes all variable names that it can find in the current document.
Following imports is currently not planed. But I can look into looking at the contents of all open editors that show CSS files.

from vscode.

kemerait avatar kemerait commented on July 17, 2024

Thanks very much for looking into the problem. From my perspective it would seem that displaying all of the properites every time would be very beneficial. Without that functionality, it degrades the usefulness of the custom properties. Instead of Intellisense including those choices each time, it forces me to go back to a long list of properties in 1 or more files each time I want to use one. A more sensible way might be to always show all of the textual proposals and then maybe either order by or highlight those that also already exist in the current document, but having them disappear makes no sense and is not useful at all. Thanks again!

from vscode.

starball5 avatar starball5 commented on July 17, 2024

I can look into looking at the contents of all open editors that show CSS files

Would this just be for custom properties declared in a rule with the :root selector? That would be the safer option correctness-wise. Even then, it'd be risking wrong suggestions with shadow DOM involved.

from vscode.

aeschli avatar aeschli commented on July 17, 2024

Available variables are only known at runtime, when a rule is matched. Even then it's not wrong to access an undefined variable
So proposing all variables found is what we should do.

from vscode.

kemerait avatar kemerait commented on July 17, 2024

I would think it should behave the way it does the first time you use var() ... using it a second or nth time shouldn't change the behaviour, which it now does...consistency is best.

from vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.