Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 712
Patrick vD Avatar asked Apr 30 '16 23:04

Patrick vD


People also ask

How do I run a .CS file in Visual Studio Code?

Open Program. cs by clicking on it. The first time you open a C# file in Visual Studio Code, OmniSharp loads in the editor. Select Yes when Visual Studio Code prompts you to add the missing assets to build and debug your app.

Why C file is not running in VS Code?

Go to the menu Code > Preferences > Settings. In the User tab on the left panel, expand the Extensions section. Find and select Run Code Configuration. Find and check the box Run in Terminal.

Is VS Code a plain text editor?

At Epicodus, we use a free text editor called Visual Studio Code. Visual Studio Code, also known as VS Code, was designed with web developers and computer programmers in mind. It includes many useful features that help write and navigate code more efficiently.


1 Answers

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.

like image 141
John Koerner Avatar answered Sep 24 '22 16:09

John Koerner