Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question USS Syntax Highlighting in Visual Studio?

Discussion in 'UI Toolkit' started by megawhile, Feb 21, 2021.

  1. megawhile

    megawhile

    Joined:
    Oct 20, 2019
    Posts:
    21
    USS Syntax Highlighting in Visual Studio? how is it possible?
     
  2. danm36

    danm36

    Joined:
    May 18, 2016
    Posts:
    10
    USS is just CSS with a different extension. In Visual Studio (Not Visual Studio Code, not sure how to set it up there), at the top click 'Tools', then 'Options...'. In the left pane, open up the 'Text Editor' dropdown, then click 'File Extension'. In the right pane, type 'uss' into the Extension textbox and for the Editor set CSS Editor, then Add. OK out of that window and you should be sorted. If you already have a uss file open, you'll need to close it and open it again for the syntax highlighting to take effect.

    One downside for this is that you'll get green underlines for Unity-specific properties like
    -unity-background-image-tint-color
    that don't exist in normal CSS, but I think you can turn off that validation by going to the same Options window as before, then below File Extension you'll see 'CSS'. Open that dropdown, then click 'Advanced'. In there, set 'Detect invalid vendor specific items' to false, and those underlines will go away. Be aware that this will affect you if you do actual CSS work in web development (Not that normal web development uses many vendor prefixed properties these days).
     
    megawhile likes this.
  3. megawhile

    megawhile

    Joined:
    Oct 20, 2019
    Posts:
    21
    nice! thank you, idk why i dont see the File Extension point, thats the solution ! :)
     
    danm36 likes this.