Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define or support a code language on Visual Studio

I just got Visual Studio, and every time I try running the code, a message pops up and says "code language not supported or defined. This happens with any language I try to use. How do I fix it?

like image 937
Jerry Matheson Avatar asked Jul 11 '26 13:07

Jerry Matheson


2 Answers

In the bottom right corner of the window notice where it says "plain text", Click this and you should see all the available language options. It's probably set to autodetect right now.

like image 122
Patrick Avatar answered Jul 14 '26 09:07

Patrick


STEPS to follow:

1) Install the "CODE RUNNER" extension in Visual Studio (VS) (if you have not done so, yet).

2) After that, go to VS "Settings" (by clicking the wheel) and, in the search field on the top, enter: "run code".

3) You'll see, to the right, all the options available for "Code Runner" settings. Scroll down, and you'll see a field that says,

Code-runner: Executor Map By File Extension.

Set the executor of each file extension.

4) Click on: "Edit in Settings.json".

5) Then, scroll down until you see "code-runner.executorMapByFileExtension" field brackets. You'll be able to see all the files extensions (e.g., ".vb", ".scala", etc.) and the corresponding executor application that run such files after the colons, to the right.

6) If you don't see the extension for the file you're trying to run (e.g., ".js"), just enter it following the same (json) format as the ones above, with the executor program (that you need to know) that runs it, to the right.

EXAMPLE: in the Mac, for a javascript (JS) file with extension ".js" (assuming you've already installed NODE, the JS executor app), you should enter a line at the end (inside the last bracket) such as,

".js": "node"

(NOTE: make sure you put a coma (,) at the end of the previous line, right before your addition)

7) SAVE your edit, and run your program by clicking the arrow on the top right corner of Visual Studio window. Your program output will be shown on the OUTPUT tab in the section below.

like image 23
surplus Avatar answered Jul 14 '26 10:07

surplus