Why is my PHP file class recognized as text file? - phpstorm

I'm working on a Laravel project and when I was creating a new file I miss spelled the php extension ("php") but I didn't notice until I clicked enter so my PHP class files now appear as text files in PhpStorm and appears no hints whenever I write something in any php file.
Im using PhpStorm 2020.2.

Settings (Preferences on macOS) | Editor | File Types
Locate "PHP" entry in the top list (Recognized File Types)
Ensure that the middle list (File Name Patterns) has *.php entry there.
If it's not there then add it. Looks like you somehow re-assigned it to the "Text" file type.
Altought blade.php get recognized right,
That's because *.blade.php is assigned to separate/dedicated "Blade" file type (so IDE can provide Blade-specific support there).

And if you already did as #LazyOne suggested and your file still showing as text then right click the file and do this:

Related

How to open a database file with no file type in SSMS?

I have a database file with no file type, I need to open it in SSMS first. When I try to open it, it says no editor for it. I tried to open it in a text editor by changing its name with a txt extension, it displayed unreadable code on the whole page. I have searched online it seems the only way is to change the file name with an extension. Is there any way to make SSMS recognize the generic extension file? Thanks
Larnu corrected me to use "Restore" instead of "Open". Thanks
New to database, need to learn everything.

How to change file type of a file in PhpStorm?

I have a TypeScript project I manage with PhpStorm. All the *.ts files are properly recognized as TypeScript files and in my file types setting I have the *.ts file map TypeScript.
All the files? No, one file stubbornly won't be treated as a TypeScript file but is shown as plain text. I have no idea how to mark this one as a TypeScript file.
All the *.ts file have the proper ts icon next to them. This one hasn't.
When I open the rogue .ts file, PhpStorm tells me that there are plugins for that file type, yet if I try to follow that route, all it leads me to is for PhpStorm to try to install the TypoScript plugin for which I have no need at all.
I tried:
renaming file from *.ts to *.txt and back to *.ts;
deleting it within PhpStorm and checking it out via git again;
right clicking the file in the Project pane hoping a setting is there in order to mark it as a TypeScript file, yet no such things seems to exist;
invalidating the cache and restart.
It remains a simple text file without syntax highlighting and other TypeScript code importing this file have the error that the references cannot be found within PhpStorm.
It's a valid TypeScript project though, tsc on command line runs fine.
How can I tell PhpStorm to treat this rogue .ts file as a TypeScript file as well?
Go to Preferences > File Types > Text Files and see if the name of the file is listed there. If it is, delete it from that list.

How can I reformat Source Code for files without file extension in WebStorm 2016.1.3?

How can I reformat Source Code for files without file extension in WebStorm 2016.1.3 ?
Example: I've a automated_generated_json_file_without_extension in one line and the name of the files are always different. I don't want to configure all these file names in "File Types" Dialog and register new patterns.
In Sublime you can change the file type at the right bottom corner, is there a similar function in WebStorm?
Unfortunately you cannot change file type of the file on the fly in WebStorm.
Possible workarounds:
Have a set of files (e.g. test.json, test.js etc) somewhere in a project where you can copy-paste this file content, reformat it there and copy it back.
Use "Scratch files" functionality (Tools | New Scratch File...) and then the same copy-paste content to reformat.

Chm file displaying Page can not be displayed

I have created compiled html (chm) file using the Microsoft html Help Workshop. when I tried to open the generated chm file, it is showing message "Page Can not be displayed". But when I click on content topic only then I am able to see corresponding page content.
Do I need to set any thing so show the selected page by default.
The short way:
If the CHM help file resides on a network drive please copy this file to a local hard drive first and try again. You'll find some additional and troubleshooting information at:
http://www.help-info.de/en/xml/maml_troubleshooting_hh.xml
http://www.grainge.org/pages/authoring/chm_mspatch/896358.htm
Problem: The help file will appear, but instead of the topic text you will see an error message "this page cannot be displayed".
Cause: Microsoft released some security patches that makes it impossible to view CHM files that are stored on a network drive (as opposed to CHM files stored on your own computer).
Solution: There is a work-around to allow viewing across a network as discussed on the following links:
http://west-wind.com/weblog/posts/2928.aspx
http://www.helpscribble.com/chmnetwork.html
The problems can also occur if the CHM file name or the path to the file contains a number sign (#). If the CHM file name contains the # symbol, then the topics in the table of contents do not appear. If the path contains the # symbol, then you may receive an access violation error message.
To work around this issue, remove the # symbol from the file name or from the path to the file.
If you have a compiled collection of CHM's (so called "merged CHM") some other problems are possible.
If you are new in using HTMLHelp Workshop:
Question: Is there a way to set a default page to be displayed when a .chm file is opened? I would like to display the page associated with the first item in the Table of Contents.
Answer: You can do this with Microsoft HTMLHelp Workshop.
Open your HHP file with HH Workshop
Click the first icon "Change project options" on the "Project" tab
Set the "Default file" from the file list of the combo box
Compile your project
HHP file example (open with notepad):
\\\
..
[OPTIONS]
Binary TOC=No
Binary Index=Yes
Compiled File=Help_Coding-Example_VB6.chm
Contents File=Help_Coding-Example_VB6.hhc
Index File=Help_Coding-Example_VB6.hhk
Default Window=main
Default Topic=index.htm
..
///
There is a solution:
In your HTML Help Workshop go to the "Project" tab
Press button "Change project options"
In the "Default file" field put the name of your default file which is already exist in your project. File should have .htm extension (for example about.htm)
Compile project again and you will see that problem is fixed

A PHP script file doesn't have PHP syntax formatting

In my PhpStorm, the file index.php, doesn't look like a PHP script, but a plain text file. How can I fix it?
Settings | File Types | Text files
Find and remove unwanted pattern there -- I expect this to be index.php or very similar
Similar SO questions:
PHPStorm renders a particular file name as plain text
Pycharm utils.py not getting syntax highlight
Follow this steps:
Open PHPStorm settings by using Ctrl+Alt+S
In search box type File types
Select file types option from left side panel
Find PHP Files (PHP) from Recognized file types
Check for .php extension in below area (Registered Patterns). If not found add PHP.
Right click on index.php and select "Mark as PHP".
(This option is there on PHPStorm 7.x, I'm not sure about 6.)