
code language not supported or defined
code language not supported or defined
How to solve for Visual studio code (code runner)
Content
0 -> so I have my file open in Visual Studio
2.34 -> code but when I try to run it
6.72 -> I get this message it says code language
9.42 -> not supported or defined so why did it
12.36 -> happen and what does it mean so there
13.86 -> are basically two main reasons for it to
15.66 -> happen the first one is that the
17.699 -> extension of your file is wrong so wrong
20.22 -> how so to understand it let's open the
22.439 -> file in the Windows File Explorer to do
24.96 -> that I'm going to right click on the
26.58 -> name of the file over here on the top
29.699 -> and then I'm going to choose reveal in
31.92 -> file explorer over here
34.62 -> now at first glance it seems that this
36.84 -> file is okay right I mean it has a name
39.059 -> hello world and then it has an extension
41.04 -> dot py which is the extension for python
43.8 -> files and python is the language I'm
45.84 -> trying to use so it should work
47.579 -> shouldn't it well not exactly you see by
50.219 -> default Windows hides the extensions for
52.62 -> known file types so in reality even
54.84 -> though it seems that the extension of
56.46 -> this file is dot py it's not the real
58.5 -> extension if you want Windows to show
60.18 -> their real extensions of files we need
61.98 -> to explicitly ask it from Windows to do
64.559 -> that I'm going to click on view
67.08 -> and the last option is show
70.26 -> and here I'm going to choose file name
72.479 -> extensions now notice what happens as
74.46 -> soon as I click this option
76.5 -> we now see that the real extension of
78.36 -> the file is txt so what seemed to be the
80.939 -> extension dot py is actually just part
82.979 -> of the name of the file itself and since
85.08 -> the real extension was dot txt Visual
87.659 -> Studio code didn't recognize it
89.22 -> correctly as a python file but as a text
91.68 -> file and it couldn't run a text file now
93.84 -> if we get back to visual studio code
95.4 -> itself
96.54 -> we can see the very same thing here so
98.7 -> the name of the file is hello
100.7 -> world.py.txt and that's why Visual
103.079 -> Studio code didn't recognize it
104.7 -> correctly so what we need to do is
106.259 -> simply chop The Dot txt from the name of
108.78 -> the files and we can do it from either
110.28 -> the Windows File Explorer from here so I
112.86 -> can right click on the file
114.659 -> then choose show more options
117.719 -> and Renee
120 -> and then I can go ahead and delete the
121.979 -> dot txt the other option is to do it
124.5 -> from Visual Studio code itself and to do
126.719 -> that I'm going to open the Explorer from
128.64 -> the left over here
130.319 -> and then right click on the file that I
132 -> want to rename
133.379 -> and choose rename
136.8 -> and I'm just going to remove the dot txt
139.02 -> extension
141.06 -> and now the extension of the file will
142.86 -> be dot py which is the extension for
145.02 -> python files and notice what happens as
147.3 -> soon as I hit enter
149.459 -> now Visual Studio code did recognize it
151.92 -> correctly as a python file and if I try
154.5 -> to run the file now
158.28 -> we can see that it did run correctly now
160.86 -> notice that Visual Studio code try to
162.9 -> guess the programming language according
164.58 -> to the extension of the file and usually
166.44 -> does a good job but if for any reason it
168.72 -> didn't guess correctly you can always
170.16 -> change it yourself and to do that we can
172.56 -> click here and that's where we can see
175.08 -> which programming language is used and
176.94 -> as we can see right now python is being
178.8 -> used which is the programming language
180.3 -> that I want to use but I can click here
182.58 -> where it says python
184.319 -> and chooses my programming language from
186.42 -> a long list of options in my case I'm
188.459 -> not going to change it because python is
190.2 -> what I want but if for any reason it
192.3 -> shows a wrong programming language for
193.86 -> you go ahead and change it
195.959 -> there is another common reason for this
198.12 -> error and this one is especially
199.5 -> relevant for web developers who use HTML
202.319 -> files so as you can see here we have the
204.659 -> same problem we had before and the
206.22 -> extension instead of just being dot HTML
208.62 -> is dot html.txt which is not what we
211.92 -> want so I'm going to rename it
216.959 -> and chop the dot txt so we'll only be
219.9 -> left with DOT HTML like this
223.56 -> and now the file is recognized correctly
225.659 -> as an HTML file but still when I try to
228.36 -> run this file
231.18 -> I get the same error code language not
233.4 -> supported or defined the reason is that
235.56 -> HTML files are not supported by code
237.84 -> Runner which is the extension that we're
239.459 -> trying to use to run this file so
241.2 -> instead of running the file from here
242.519 -> what we're going to do is run it
244.08 -> directly from the browser so to do that
245.939 -> I'm just going to open the file in the
247.5 -> Windows File Explorer as we did before
249.12 -> so right click on the name of the file
250.92 -> over here and reveal in File Explorer
255 -> and you can see the icon of the browser
257.1 -> which means that this file can be opened
259.019 -> in a web browser so I'm just going to
260.579 -> double click on the file
263.58 -> and now it's been opened in a web
265.32 -> browser and we can see the file as
267.06 -> expected
Source: https://www.youtube.com/watch?v=eI9aOM1VW8g