How does Visual Studio choose which editor to use

2020-02-15 04:36发布

问题:

My project stores html code fragments for use in templating in files with a custom extension (*.phtml). I find that Visual Studio is inconsistent in its use of editors when I edit these files. Sometimes it provides no intellisense, sometimes it treats the files as XML (which is better than nothing), and sometimes I get lucky and it provides me with the HTML editor.

I've configured Visual Studio to treat *.phtml files as HTML, but that doesn't seem to make any difference.

What more can I do to convince Visual Studio to always use the HTML Editor for *.phtml files?

回答1:

Right-clicking a file in solution explorer shows an "Open with ..." option, the window that it opens has a choice of editors plus a "Set as default" option.