seolbinism
seolbinism

Reputation: 121

visual studio code not recognizing html files

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

Upvotes: 10

Views: 18635

Answers (8)

Vishal Tiwari
Vishal Tiwari

Reputation: 1

There are some following step to set the problem:

  1. Open vscode
  2. On top left click "File"
  3. Then go to "Preferences"
  4. Setting
  5. Search "HTML file association"
  6. Click "Add" and paste this: "*html": "html"

Upvotes: 0

Wahab Shah
Wahab Shah

Reputation: 2266

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

Upvotes: 0

Ali Salame
Ali Salame

Reputation: 1

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!

Upvotes: 0

Cyebukayire
Cyebukayire

Reputation: 947

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:

Upvotes: 1

mahendra rathod
mahendra rathod

Reputation: 1638

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

Upvotes: 6

Tanmoy Das
Tanmoy Das

Reputation: 1

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"
    },

Upvotes: 0

user1169907
user1169907

Reputation: 215

Adding this to file extensions worked for me:

"files.associations": {
        "*.html": "html"  
} 

Upvotes: 21

pablish
pablish

Reputation: 61

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

Upvotes: 6

Related Questions