microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.11k stars 28.82k forks source link

[css] Autocomplete for media queries #61125

Open ghost opened 5 years ago

ghost commented 5 years ago

VSCode doesn't offer autocompletion for media queries. Why is that?

2018-10-17_104706

proimage commented 5 years ago

x100!

There should also be a way to get ahead of the curve and allow users to enable support for Level 4 media queries via a user setting.

ghost commented 5 years ago

Made this snippet recently, triggers by typing "media"


    "prefix": "media(){}",
    "body": [
      "@media (${1|max-width,min-width|}: ${2|479,480,767,768,980,981|}px) {",
      "\t${3:body} {",
      "\t\t$0",
      "\t}",
      "}"
    ],
    "description": "media queries"
  }
rsolomonjr commented 5 years ago

Made this snippet recently, triggers by typing "media"

    "prefix": "media(){}",
    "body": [
      "@media (${1|max-width,min-width|}: ${2|479,480,767,768,980,981|}px) {",
      "\t${3:body} {",
      "\t\t$0",
      "\t}",
      "}"
    ],
    "description": "media queries"
  }

Where do you place it? css.json?

jesperjen98 commented 2 years ago

I would love to work on this issue.

aeschli commented 2 years ago

@jesperjen98 That would be great. The change will be in https://github.com/Microsoft/vscode-css-languageservice. Check out https://github.com/microsoft/vscode-css-languageservice/blob/a2417092c382f4ac2f86145d0c44d6bce1279ae1/src/services/cssCompletion.ts#L110 as a starting point

jesperjen98 commented 2 years ago

@aeschli sorry for the long silence from me, but after a long time of debbuging and testing i have written an implentation for the autocomplete. The implementation is based on how the IPropertyData interface is implemented. I have submitted a pull request but if there is anything that needs to be changed in the implementation i would love to keep working on it. Feedback is also greatly appreciated.

aeschli commented 2 years ago

Thanks @jesperjen98, I'll have a look ASAP. https://github.com/microsoft/vscode-css-languageservice/pull/256/

kevincharp commented 3 months ago

Since 2018 this problem has not been solved?

Was there any solution/configuration to get autocompletion or suggestions when using media querys in css files?

image