9

VS code has suddenly stopped recognizing html files (the file icon is the default one for files with no extension)

all other file extensions work just fine

all other file extensions work just fine

except for html

except for html

the tags still work but it won't autocomplete

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
seolbinism
  • 111
  • 1
  • 1
  • 3
  • If you type `@builtin html` in the search box of the extensions pane, what do you get? And, have you customised `files.associations`? – Álvaro González Nov 18 '18 at 14:56
  • Same for me, no 'files.associations' or exclusions in the settings and also no HTML files in the tree nav. Even the "open file" picker is not showing them. Adding the *.html association did not work... – JimBob Oct 07 '20 at 09:12

7 Answers7

18

Adding this to file extensions worked for me:

"files.associations": {
        "*.html": "html"  
} 
salpreh
  • 190
  • 2
  • 6
user1169907
  • 185
  • 1
  • 2
6

In my case, for this problem the solution was to manually add *.html to files.associations, in user settings. Its unlogical but it seems that somehow the extension wasn't associated to the type of file. Now everything works perfectly...

massisenergy
  • 1,764
  • 3
  • 14
  • 25
pablish
  • 61
  • 1
  • 2
5

Go to the settings (In mac it is Code -- > Preferences --> Settings)

  1. In the search bar search for Association.
  2. In Files:Associations click on Add items.
  3. update key = *.html & Value = html

Below is the screenshot for reference.

enter image description here

mahendra rathod
  • 1,438
  • 2
  • 15
  • 23
0

I had the same issue but none of the other solutions worked for me!

You can try this:

Go to the path where the "settings.json" file exits, for my case the path is: C:> Users> User123 > AppData > Roaming > Code > User > settings.json

Now, paste the code in the file:

"code-runner.executorMap": {
        "html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"",
    }

Now search for the "files.associations" section in your settings.json file: As an example

Now if you have the "files.associations" section then just add the line there:

"*html": "html" 

(don't forget to write a comma after a line if there are more lines in it)

or if you don't have a "files.associations" section, then copy paste the code there:

"files.associations": {
        "*.rmd": "markdown",
        "*html": "html"
    },
Yun
  • 3,056
  • 6
  • 9
  • 28
0

I had the same problem in Windows 10 a few minutes ago: Yeah, from the solutions above I did this but still had some errors:

File -- > Preferences --> Settings

In the search bar search for Files: Association.

In Files:Associations click on Add item button.

update Item = *.html & Value = HTML As shown below: enter image description here

When I saved, I got this error

Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.

The problem is that terminal.integrated.shellArgs settings have been deprecated.

One of the answers here will help:

Cyebukayire
  • 795
  • 7
  • 14
0

So I just had this problem and I figured it out the problem was from an extension that I installed which is the pyscript extension I disabled it and everything started to work again!

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 13 '22 at 14:50
0

Well if you have pyscript extension installed, disable it. It has conflicts with html files I guess.

Or if you don't want to disable it just ctrl+shift+p then change language mode. Select configure file association for html.

This applies for any extension not just pyscript. For me it was pyscript

Wahab Shah
  • 2,066
  • 1
  • 14
  • 19