Make Webstorm highlight .txt files as HTML - syntax-highlighting

So I have some project files all with .txt extensions which are really HTML templates. I am trying to syntax highlight those .txt files as HTML using Webstorm. Any tips on how to do that?

Open File > Settings > Editor > File Types > HTML files and add your extension to registered patterns in the right panel.
Source

Related

Cannot Edit Local File in VS Diff Mode

If I compare a local file to its parent file, I can edit, in the right pane of VS, the local file if the file extension is cpp or h. If I compare text files that have a different extension (e.g. file.abc), the comparison is against a copy of the local file (e.g. file - copy 2.abc), not against the local file itself, and the copy is not editable.
The file extension must be registered with the c++ editor (Tools | Options... | Text Editor | File Extension).
The following command line generates copies of the compared files.
devenv /diff c:\file.abc d:\file.abc compares c:\temp\file copy.abc to c:\temp\file copy 2.abc.
Is it possible to have the same behavior as for cpp & h?

When I create main.go file it automatically becomes a text file

When I create a file of any name with a .go prefix, GoLand's icon indicates that it is a Go file. However, when I create a main.go file, GoLand's icon indicates it is a plain text file. See image below. How can I fix this problem?
Navigate to Preferences / Settings | Editor | File Types, find type Text and exclude main.go file.

WebStorm does not recognized some Sass partial files with underscore

I don't know why but last Friday, my WebStorm project has stopped recognizing some Sass files and displayed them as text file:
Settings/Preferences
Editor | File Types
Find Text entry in top list
Find and remove offending entry in bottom list (will be _theme.scss or similar)

xampp directly open my html file

I created folder called en407 and inside it i create a file called assigment that contain html , css and also php.
http://localhost/en407b/
When i click on the assginmnt file , i should let me choose what file to open
http://localhost/en407b/assignment
but the link directly go to my html file which is index.html and the link remains
http://localhost/en407b/assignment
in my assignment file , it contain index.html , index2.html and other....
how to fix it???
At first you can't run PHP in .html files because the server does not recognize it as valid till you tell it to do it. To do this create a .htaccess file in your root web directory and add this line inside it:
AddType application/x-httpd-php .htm .html
This will tell Apache to process files with a .htm or .html file extension as PHP files.

Sublime Text 2 - Default Document Type

Is there a way to set a default document type when saving a NEW FILE?
I created several new files and I want to have a default value of .txt when saving a NEW FILE.
Create a new plugin Tools > Developer > New Plugin...
Paste this in:
import sublime, sublime_plugin
class EverythingIsPowerShell(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
Save and call it NewTabSyntax.py. New tabs will now default to Powershell.
You can change the syntax to whatever you prefer. To find out the "path" of a particular syntax, simply open a file of that syntax, open the console (View > Show Console) and type:
view.settings().get('syntax')
This plugin does it:
https://github.com/spadgos/sublime-DefaultFileType
seems pretty great.
Edit:
Ok, two things, there currently seems to be a small bug so the text file syntax is not being correctly picked up due to the whitespace in the filename. In addition you need to set the "use_current_file_syntax" to false, (otherwise the new file will default to whatever filetype you have open already when you hit Ctrl-N)... So the fix/workaround is this:
Put the following code in: Packages/User/default_file_type.sublime-settings
{ "default_new_file_syntax": "Packages/Text/Plain_text.tmLanguage",
"use_current_file_syntax": false }
NOTE THE UNDERSCORE.
Next, find the "Plain text.tmLanguage" file and copy and rename it (in the same folder) as "Plain_text.tmLanguage". [be sure to copy/duplicate it, do not just rename it, as it may have dependancies]
Restart, just to be sure, and this should do the trick.
Also note this plugin only works for new files created with Ctrl-N.
Working after these steps:
1.Uninstalled
2.Installed using Package Control
3.Test using default install (type Jave) <-- worked
4.Copy and Renamed file Sublime Text 2\Packages\Text\Plain text.tmLanguage > Sublime Text 2\Packages\Text\Plain_text.tmLanguage
5.Changed file Sublime Text 2\Packages\Default File Type\default_file_type.sublime-settings >
`{ "default_new_file_syntax": "Packages/Text/Plain_text.tmLanguage", "use_current_file_syntax": true }`
-- All working.
I did not need to copy any files into the 'Packages/User' folder
#fraxel _ Thanks for all the help and quick response.

Resources