Search code examples
c#unity-game-engineintellisensevisual-studio-code

Why is VS Code treating .cs files as plain text, but everything else normally?


I have a Unity Project open in Visual Studio Code, with 3 .csproj files, a launch.json and settings.json file. I'm using the VS Code plug-in for unity, and the Unity Tools extension for VS Code.
If I open a .js script, VS Code treats it as such, and all the highlighting happens. But if I open a .cs script, it treats it as a Plain Text document, and I get no formatting or IntelliSense. If I try to select the language manually, I can select most any language I like, except for C#, which is missing from the list. screenshot of the .cs and the .js files side by side


Solution

  • You can manually install C# support. It looks like it was made optional in the February update of Code.

    Type F1 to get to the command window and type ext install to install extensions. Get the C# extension and restart Code.

    See the documentation for more information on C# support.