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?

2

6 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.

Here is a solution: Close your folder from the Explorer and reopen and run your file. It solves the issue

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.

You saw that error message in vscode because you probably used the shortcut Alt+Ctrl+N to run the code while the output terminal is selected instead of the script. try click the mouse in the script area and do it again, it should work. if the run the code by pressing the button on the top right corner and you still see the same error msg that means you need to check .Jason settings.

Read the language support page for MS Visual Studio:

You can define a languages in the files.associations setting.

If you haven't setup language support:

Option 1: In the right bottom of the window notice where it says "plain text", Click this and you should see all the available options. It probably provides the available list of language .

Option 2: Uninstall the current version and install stable version of visual studio code

On my case, I follow first option at first but I could able to solve the problem so I uninstall the visual studio code and solving the problem using stable version. Try once I may work on your case

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy